
! script name: edit.d/edittool
! topic: edit tool type file

!A
!A NAME:
!A
!A 	Tool File
!A
!A DESCRIPTION:
!A
!A 	This script allows a tool type file to be edited.  Once a tool
!A 	type has been selected the tools available for that type will
!A 	be brought up for a selection to be made.  Then an editor
!A 	window will be brought up to allow the editing of a particular
!A 	tool type tool.  Some examples of tool types are:
!A
!A 		reamers
!A 		endmills
!A 		taps
!A 		centerdrills
!A 		twistdrills
!A 		counterbores
!A
!A 	Remember, these tool types may vary depending on what has been
!A 	defined for the particular system being used.
!A
!B INSTRUCTIONS:
!B
!B 	INPUT TYPE OF TOOL: The selection box with the 	available list
!B 		of tool types will automatically appear for a selection
!B 		to be made.
!B
!B 	INPUT TOOL FILE NAME TO BE EDITED: Once a tool type has been
!B 		selected, the selection box with the list of TOOLS
!B 		AVAILABLE will automatically appear for a selection to
!B 		be made.  Once a selection has been made, a xed editor
!B 		window will be brought up with the data that may be edited.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: tool file ")

DIM Destination$[256]
DIM Answer$[256]
DIM Name$[256]
DIM File_name$[256]
DIM Dir$[256]
DIM D_label$[256]
DIM Choice$[256]
DIM Namelist$[32000]
DIM Mask$[32]
DIM Tool_class$[512]

ActivateUndo
Start:!
Units= CurrentUnits

Tool_question:!

No_tools=ToolSelectBox("TOOLS","selected tool")

IF Not_tools THEN Leave
Stat=SetInputFormat("a99","")
Stat=GetValue("CHOOSE TOOL",Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF Answer$="CANCEL" THEN Leave
Name$=Answer$
LowerSelectBox

Tool=FindUserData(Name$,WsToolData)
IF NOT ValidGeometry(Tool) THEN Tool_question

IF Units= WsMetric THEN
	Toolstring$="Feed(mmpm):"
ELSE
	Toolstring$="Feed(ipm):"
END IF
Feed=GetUserValue(Tool,Toolstring$)
Stat=SetEqualsValue(Feed)

ActivateUndo
Stat= AdvanceUndoNumber("edit tool data")
Stat= AddItemToUndo(WsUBModifyMode,Tool)

Stat=SetInputFormat("n5=","")
Feed=GetValue("FEED RATE",Answer$)
IF (ExitScript(Destination$)) THEN Leave
Stat=PutUserValue(Tool,Toolstring$,Feed)

Toolstring$="Speed(rpm):"
Speed=GetUserValue(Tool,Toolstring$)
Stat=SetEqualsValue(Speed)

Stat=SetInputFormat("n0=","")
Speed=GetValue("SPINDLE SPEED",Answer$)
IF (ExitScript(Destination$)) THEN Leave
Stat=PutUserValue(Tool,Toolstring$,Speed)

GOTO Tool_question

Leave:!
LowerSelectBox
Stat=SetInputFormat("n4","")
IF (NOT LEN(Destination$)) THEN
	  LOAD "typecontrol"
ELSE
	  LOAD Destination$
END IF
END
