
! script name: vpksolids.d/vpksimplescrewstart
! solids: starts a simple constant pitch screw
!A
!A NAME:
!A
!A 	Simple Screw Start:   VARIATIONAL
!A
!A DESCRIPTION:
!A
!A	This script starts a simple screw
!A
!B INSTRUCTIONS:
!B
!B		Left or Right HAND SCREW: Is the screw left or right hand.
!B
!B		SCREW DIAMETER  Diameter of od of the screw. 
!B
!B		PITCH    Give the pitch. 
!B
!B		CHANNEL DEPTH   Start depth of channel.
!B
!B		FLIGHT WIDTH   Starting width of flight.
!B
!B
!B NOTES:
!B
!B
!B
!# see also - htdocs/help.d/parasolids.htm

Stat=ChangeLabelStr("ScriptNameStatus","Function: start screw ")

OPTION BASE 1
DIM Destination$[256]
DIM Answer$[256]
DIM Name$[256]
DIM A$[256]
DIM Question$(20)[80]
DIM Reply$(20)[80]


Var_object= CheckVarObject
IF (ExitScript(Destination$)) THEN Leave

Units= CurrentUnits
IF Units= WsMetric THEN
	Shank_length=250
	Screw_diameter= 100
	Pitch= 100
	Screw_length=300
	Channel_depth= 20
	Flight_width= 10
	End_radius= 18
	Leading_radius= 6
	Trailing_radius= 9
ELSE
	Shank_length=10
	Screw_diameter=4.5
	Pitch= 4.5
	Screw_length=12
	Channel_depth= 0.87
	Flight_width= 0.45
	End_radius= 0.625
	Leading_radius= 0.25
	Trailing_radius= 0.375
END IF
Use_input_box=1

Start:!
Stat= GLPlotOn
IF Use_input_box THEN Make_questions

Stat=SetInputFormat("n4=","")
Stat=SetEqualsValue(Screw_length)
Shank_length=GetValue("SHANK LENGTH",Answer$)
IF ExitScript(Destination$) THEN Leave

Stat=SetInputFormat("n0","")
Stat=SetEqualsValue(Number_of_sections)
Number_of_sections=GetValue("NUMBER OF SECTIONS",Answer$)
IF ExitScript(Destination$) THEN Leave


Ask_diameter:!
Stat=SetInputFormat("n4=")
Stat=SetEqualsValue(Screw_diameter)
Screw_diameter=GetValue("SCREW DIAMETER ",Answer$)
IF ExitScript(Destination$) THEN Leave

Ask_start_pitch:!
Stat=SetInputFormat("n4=")
Stat=SetEqualsValue(Screw_diameter)
Pitch=GetValue("PITCH",Answer$)
IF ExitScript(Destination$) THEN Leave

Stat=SetInputFormat("n4=","")
Stat=SetEqualsValue(Screw_length)
Screw_length=GetValue("FIRST SECTION LENGTH",Answer$)
IF ExitScript(Destination$) THEN Leave

Ask_depth:!
Stat=SetInputFormat("n4=")
Stat=SetEqualsValue(Channel_depth)
Channel_depth=GetValue("CHANNEL DEPTH",Answer$)
IF ExitScript(Destination$) THEN Leave



Ask_flight_width:!
Stat=SetInputFormat("n4=")
Stat=SetEqualsValue(Flight_width)
Flight_width=GetValue("FLIGHT WIDTH ",Answer$)
IF ExitScript(Destination$) THEN Leave


Ask_lead_radius:!
Stat=SetInputFormat("n4=")
Stat=SetEqualsValue(Leading_radius)
Leading_radius=GetValue("LEADING RADIUS",Answer$)
IF ExitScript(Destination$) THEN Leave

Ask_trail_radius:!
Stat=SetInputFormat("n4=")
Stat=SetEqualsValue(Trailing_radius)
Trailing_radius=GetValue("TRAILING RADIUS ",Answer$)
IF ExitScript(Destination$) THEN Leave

GOTO Load_strategy


Make_questions:!
FOR I=1 TO 20
Question$(I)=""
Reply$(I)=""
NEXT I

Question$(1)= "SHANK LENGTH:  "
Reply$(1)= VAL$(Shank_length)

Question$(2)= "FRONT END RADIUS:  "
Reply$(2)= VAL$(End_radius)

Question$(3)= "NUMBER OF SECTIONS:  "
Reply$(3)= VAL$(5)

Question$(4)= "SCREW DIAMETER:  "
Reply$(4)= VAL$(Screw_diameter)

Question$(5)= "PITCH:  "
Reply$(5)= VAL$(Pitch)

Question$(6)= "FIRST SECTION LENGTH:  "
Reply$(6)= VAL$(Screw_length)

Question$(7)= "CHANNEL DEPTH:  "
Reply$(7)= VAL$(Channel_depth)

Question$(8)= "FLIGHT WIDTH:  "
Reply$(8)= VAL$(Flight_width)

Question$(9)= "LEADING RADIUS:  "
Reply$(9)= VAL$(Leading_radius)

Question$(10)= "TRAILING RADIUS:  "
Reply$(10)= VAL$(Trailing_radius)


Input_box:!
Stat= DisplayMessage(" ")
Stat=ChangeLabelStr("MultiLineShell","Reference Entity Prompts")
Input_stat=MultiInput(Question$(*),Reply$(*),0)
IF (ExitScript(Destination$)) THEN Leave
IF Input_stat=27 THEN Leave
Stat= DisplayMessage(" ")

Analyze_answers:!
A$= Reply$(1)
Answer$= TRIM$(A$)
IF NOT IsStringNumeric(Answer$) THEN Input_box
Shank_length=VAL(Answer$)

A$= Reply$(2)
Answer$= TRIM$(A$)
IF NOT IsStringNumeric(Answer$) THEN Input_box
End_radius=VAL(Answer$)

A$= Reply$(3)
Answer$= TRIM$(A$)
IF NOT IsStringNumeric(Answer$) THEN Input_box
Number_of_sections= VAL(Answer$)
IF Number_of_sections< 1 THEN Input_box

A$= Reply$(4)
Answer$= TRIM$(A$)
IF NOT IsStringNumeric(Answer$) THEN Input_box
Screw_diameter= VAL(Answer$)
IF Screw_diameter< 0.001 THEN Input_box

A$= Reply$(5)
Answer$= TRIM$(A$)
IF NOT IsStringNumeric(Answer$) THEN Input_box
Pitch= VAL(Answer$)
IF Pitch< 0.001 THEN Input_box

A$= Reply$(6)
Answer$= TRIM$(A$)
IF NOT IsStringNumeric(Answer$) THEN Input_box
Screw_length= VAL(Answer$)
IF Screw_length< 0.001 THEN Input_box

A$= Reply$(7)
Answer$= TRIM$(A$)
IF NOT IsStringNumeric(Answer$) THEN Input_box
Channel_depth= VAL(Answer$)
IF Channel_depth< 0.001 THEN Input_box

A$= Reply$(8)
Answer$= TRIM$(A$)
IF NOT IsStringNumeric(Answer$) THEN Input_box
Flight_width= VAL(Answer$)
IF Flight_width< 0.001 THEN Input_box

A$= Reply$(9)
Answer$= TRIM$(A$)
IF NOT IsStringNumeric(Answer$) THEN Input_box
Leading_radius=VAL(Answer$)

A$= Reply$(10)
Answer$= TRIM$(A$)
IF NOT IsStringNumeric(Answer$) THEN Input_box
Trailing_radius=VAL(Answer$)



Load_strategy:!
V1= NumericVariable("Shank_length",WsVariationVars,Shank_length)
V1= NumericVariable("Number_of_sections",WsVariationVars,Number_of_sections)
V1= NumericVariable("Od_dia",WsVariationVars,Screw_diameter)
V1= NumericVariable("Pitch",WsVariationVars,Pitch)
V1= NumericVariable("First_section_len",WsVariationVars,Screw_length)
V1= NumericVariable("Flight_width",WsVariationVars,Flight_width)
V1= NumericVariable("Channel_depth",WsVariationVars,Channel_depth)
V1= NumericVariable("Lead_radius",WsVariationVars,Leading_radius)
V1= NumericVariable("Trail_radius",WsVariationVars,Trailing_radius)
V1= NumericVariable("End_radius",WsVariationVars,End_radius)


A$= "vstrategy.d/strategytools:"&"/usr/weber/database/strategies/ScrewStrategies/StartSimpleScrew"
LOAD A$




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




