
! script name: wscturn.d/setconstants

!A
!A NAME:
!A
!A 	SET CONSTANTS
!A
!A DESCRIPTION:
!A
!A 	This script sets the named variables.
!A 	The following are the constants that
!A 	are set:
!A 		parallel distance
!A 		width of cut
!A 		finish allowance
!A 		cutter diameter
!A 		finish depth
!A 		mill direction
!A 		cutter offset
!A 		pick type          *** see NOTES
!A 		hole diameter
!A 		hole depth
!A 		bolt hole radius
!A
!B NOTES:
!B
!B 	pick type: This is the switch to determine which
!B 		option to use in rotate, invert, move and
!B 		make a named group. Pick type has three
!B 		options available.
!B 		1) SELECTION BOX
!B 		2) PICK INDIVIDUAL ELEMENTS
!B 		3) PICK A GROUP
!B 		The default is SELECTION BOX.
!B
!C  PLOTTER PENS:
!C
!C 	PLOTTER PENS allow the graphics pens to be assigned
!C 	a plotter pen.  Each pen may be assigned a velocity
!C 	by adding VS to the command.  For example, "SP5;VS7;"
!C 	will assign plotter pen 5 with a velocity of 7.  A
!C 	command of "VS;" will give maximum velocity.
!C
!C 	HP PLOTTERS have 6 built in linetypes. The second
!C 	parameter is the percentage of the diagonal distance.
!C 	For example, "LT1,2" is pattern 1 with spacing .02 of
!C 	the diagonal distance, the default is .04.
!C
!C PLOTTER LINETYPES:      RECOMMENDED VALUES FOR PAPER SIZES:
!C
!C                         A           B           D            E
!C
!C linetype0:  LT          LT          LT           LT           LT
!C linetype1:  LT          LT          LT           LT           LT
!C linetype2:  LT1,.75     LT1,3       LT1,1        LT1,.75      LT1,.5
!C linetype3:  LT1,1.5     LT1,5       LT1,2        LT1,1.5      LT1,1
!C linetype4:  LT1,..375   LT1,1.5     LT1,.5       LT1,.375     LT1,.25
!C linetype5:  LT2,2       LT2         LT2,2        LT2,.5       LT2,.375
!C linetype6:  LT4,1       LT4         LT4          LT4,1        LT4,1
!C linetype7:  LT5,2       LT5         LT5          LT5,2        LT5,1.5
!C linetype8:  LT6,2       LT6         LT6          LT6,2        LT6,1.5
!C linetype9:  LT          LT          LT           LT           LT
!C linetype10: LT5,1       LT5         LT5          LT5,1        LT5,1
!C linetype11: LT2,2       LT2         LT2          LT2,2        LT2,2
!C linetype12: LT6,2       LT6         LT6          LT6,2        T6,2
!C linetype13: LT2,2       LT2         LT2          LT2,2        LT2,2
!C linetype14: LT6,2       LT6         LT6          LT6,2        LT6,2
!C linetype15: LT5,2       LT5         LT5          LT5,2        LT5,2
!C

stat=ChangeLabelStr("ScriptNameStatus","Function: set constants ")

DIM Destination$[256]
DIM A$[512]
DIM B$[512]
DEG

! NOTE THAT PARAMETER 1 CONTAINS THE DESTINATION FILE AFTER USER CONSTANTS
IF ARGC<2 THEN
        Destination$= "typecontrol"
ELSE
        Destination$= ARGV(1)
	PRINT Destination$
	IF LEN(Destination$)=0 THEN 
        	Destination$= "typecontrol"
	END IF
END IF

Units= CurrentUnits

Conversion=1
IF Units= WsMetric THEN Conversion= 25.4

! Plotchains are updated for each fit and zoom if set to WsTrue
Update_2D= WsTrue
Update_3D= WsFalse
Stat=PlotUpdateToggle(Update_2D,Update_3D)

! Select Box and Color Box Expose Events generate screen repaints
Stat= BoxExposuresOnOff(WsTrue)

! Set Drafting standard Ansi is the default
Stat= SetDraftStandard(WsAnsiStandard)
!Stat= SetDraftStandard(WsIsoStandard)

Stat=SetDefaults(WsRulerPen,18)
Stat=SetDefaults(WsRulerType,0)
Stat=SetDefaults(WsZoomLineWidth,2)
Stat=SetDefaults(WsLineLength,20*Conversion)
Stat=SetDefaults(WsDirArrowHeight,.125*Conversion)
Stat=SetDefaults(WsDirArrowWidth,.250*Conversion)
Stat=SetPickMask(WsPickAll)
Stat=SetAbsIncrInput(WsAbsolute)
Stat=SetInputFormat("n0","")
Stat=SetPickReturn(WsGeomCenter)
Stat=SetAxesLabels("X","Y","Z")
Stat=SetLastPoint
Stat=SetPolarCenter

Stat=SetXyzInput(WsXyzInput)	! ***RECTANGULAR COORDINATE INPUT

Stat= SetCurrentColor(0)
Stat=SetCurrentLT(1)

Stat=SetInputSystem(WsXyzInput) !**** standard input
!Stat=SetInputSystem(WsXyOnly) !**** make system 2d only ******

V1=CreateVariable("job time",WsSystemVars,0.0)
V1=CreateVariable("save dirs",WsSystemVars,1)
V5=CreateVariable("finish allowance",WsSystemVars,0.020*Conversion)
V7=CreateVariable("finish depth",WsSystemVars,0.5*Conversion)
V8=CreateVariable("mill direction",WsSystemVars,"CL")
V11=CreateVariable("hole diameter",WsPointVars,0.5*Conversion)
V12=CreateVariable("hole depth",WsPointVars,0.5*Conversion)
V1=CreateVariable("http root dir",WsSystemVars,"/usr/weber/http/Web/")
V1=CreateVariable("synergy html dir",WsSystemVars,"Html.Syn/")
V1=CreateVariable("post dir",WsSystemVars,"/usr/weber/post_formats/")
V1=CreateVariable("tools dir",WsSystemVars,"/usr/weber/util/tooldata/tools/")
V1=CreateVariable("ltools dir",WsSystemVars,"/usr/weber/util/tooldata/tools/")
V1=CreateVariable("material dir",WsSystemVars,"/usr/weber/util/tooldata/materials/")
V1=CreateVariable("database dir",WsSystemVars,"/usr/weber/database/")
V1=CreateVariable("datatables dir",WsSystemVars,"/usr/weber/database/tables/")
V1=CreateVariable("properties dir",WsSystemVars,"/usr/weber/database/properties/")
V1=CreateVariable("hole features sub dir",WsSystemVars,"HoleFeatures.d")
V1=CreateVariable("iges in parameters",WsSystemVars,"-p3")
V1=CreateVariable("iges out parameters",WsSystemVars,"-p3")
V1=CreateVariable("DNC tape storage dir",WsSystemVars,"/usr/weber/ST/tape")
V1=CreateVariable("archive dir",WsSystemVars,"/usr/weber/archive/")
A$=" synfile command_file notepad tapefile .gif .jpg .html .htm .hpgl .plt "
V2=CreateVariable("archive file types",WsSystemVars,A$)
IF DoesFileExist("\Program Files\Windows NT\Accessories\wordpad.exe") THEN
	V2=CreateVariable("file editor",WsSystemVars,"\Program Files\Windows NT\Accessories\wordpad.exe")
ELSE
	IF DoesFileExist("\Program Files\Accessories\wordpad.exe") THEN
		V2=CreateVariable("file editor",WsSystemVars,"\Program Files\Accessories\wordpad.exe")
	ELSE
		V2=CreateVariable("file editor",WsSystemVars,"notepad.exe")
	END IF
END IF
V1=CreateVariable("flip crlf",WsSystemVars,1)

ON ERROR GOTO Leave

Plot_Mappings:!
stat= PlotPenMap(0,"SP1;VS")
stat= PlotPenMap(1,"SP1;VS")
stat= PlotPenMap(2,"SP2;VS")
stat= PlotPenMap(3,"SP3;VS")
stat= PlotPenMap(4,"SP4;VS")
stat= PlotPenMap(5,"SP5;VS")
stat= PlotPenMap(6,"SP6;VS")
stat= PlotPenMap(7,"SP7;VS")
stat= PlotPenMap(8,"SP8;VS")
stat= PlotPenMap(9,"SP9;VS")
stat= PlotPenMap(10,"SP10;VS")
stat= PlotPenMap(11,"SP11;VS")
stat= PlotPenMap(12,"SP12;VS")
stat= PlotPenMap(13,"SP13;VS")
stat= PlotPenMap(14,"SP14;VS")
stat= PlotPenMap(15,"SP15;VS")
stat= PlotPenMap(16,"SP16;VS")
stat= PlotPenMap(17,"SP17;VS")
stat= PlotPenMap(18,"SP18;VS")
stat= PlotPenMap(19,"SP19;VS")
stat= PlotPenMap(20,"SP20;VS")
stat= PlotPenMap(21,"SP21;VS")
stat= PlotPenMap(22,"SP22;VS")
stat= PlotPenMap(23,"SP23;VS")
stat= PlotPenMap(24,"SP24;VS")

stat= PlotLineTypeMap(0,"LT0;PT2")
stat= PlotLineTypeMap(1,"LT1;PT2")
stat= PlotLineTypeMap(2,"LT2;PT2")
stat= PlotLineTypeMap(3,"LT3;PT2")
stat= PlotLineTypeMap(4,"LT4;PT2")
stat= PlotLineTypeMap(5,"LT5;PT2")
stat= PlotLineTypeMap(6,"LT6;PT2")
stat= PlotLineTypeMap(7,"LT7;PT2")
stat= PlotLineTypeMap(8,"LT8;PT2")
stat= PlotLineTypeMap(9,"LT9;PT4")
stat= PlotLineTypeMap(10,"LT10;PT8")
stat= PlotLineTypeMap(11,"LT11;PT16")
stat= PlotLineTypeMap(12,"LT12;PT4")
stat= PlotLineTypeMap(13,"LT13;PT2")
stat= PlotLineTypeMap(14,"LT14;PT2")
stat= PlotLineTypeMap(15,"LT15;PT2")
stat= PlotLineTypeMap(16,"LT16;PT2")
stat= PlotLineTypeMap(17,"LT17;PT2")
stat= PlotLineTypeMap(18,"LT18;PT2")
stat= PlotLineTypeMap(19,"LT19;PT2")

Leave:!
Stat= ReadSettings("CadSettings",WsCadSettings)

Axis_lines:!
Stat=SetXyzInput(WsLatheInput)
G1= FindNamedGrp("AXIS LINES")
IF NOT ValidGeometry(G1) THEN 
	Units= CurrentUnits
	IF Units= WsMetric THEN
       		 Axis_length= 50
       		 Radius= 6
	ELSE
       		 Axis_length= 2
       		 Radius= 0.25
	END IF
	G1= AxisLines(0,Radius,Axis_length,1,5,3,8)
END IF

LOAD "userconstants:"&Destination$

END
