
! script name: turbopost.d/pickruled
! topic: pick ruled surfaces for wire edm command file

!A
!A NAME:
!A
!A 	PICK RULED SURFACES
!A
!A DESCRIPTION:
!A
!A 	This script allows the user to select ruled surfaces to be used for the
!A 	wire edm command file.
!A
!B INSTRUCTIONS:
!B
!B 	PICK RULED SURFACE, Proceed: Pick a ruled surface to be cut.  Proceed
!B 		will return the user to the command menu.  This question will
!B 		repeat, depending upon the pick type, until Proceed is selected.
!B
!# see also - htdocs/help.d/millturbo.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: pick ruled surfaces ")

DIM Destination$[256]
DIM Answer$[256]
DIM Command$[256]
DIM A$[256]
DIM Name$[256]


DeActivateUndo
Pick_loop:!

Stat=MakeActiveCurr

Stat=CurrActionName(Command$)
Command_type=CurrActionTyp

Pick_path:Stat=SetInputFormat("a6",",P,CANCEL,")
Surface=PickEntity("PICK RULED SURFACE,  Proceed",Answer$)
IF (ExitScript(Destination$)) THEN Leave

SELECT Answer$
CASE "CANCEL"
	LOAD "turbopost.d/turbocmd"
CASE "P","p"
	GOTO New_command
END SELECT

Etype= EntityType(Surface)
IF NOT (Etype = WsRuledSurfEnt) THEN Pick_path

Stat=Highlight(Surface,WsPickPen,WsDirArrowOff)


Output_path:!
Stat= SurfaceName(Surface,Name$)
A$="ASSIGN: Surf_name= "&CHR$(34)&Name$&CHR$(34)&";"
Stat=OutputCmdBuff(A$,0)
Stat=OutputCmdBuff(Command$,0)

IF Command_type=TpRuledSurf THEN New_command
GOTO Pick_loop


New_command:UpdateCmdFile
	Stat=SetPickMask(WsPickAll)
	Stat=SetInputFormat("n4=","")
	  LOAD "turbopost.d/turbocmd"

Leave:!
stat= DeleteEntity(Ps)
stat= DeleteEntity(Pe)
IF (NOT LEN(Destination$)) THEN
	  LOAD "typecontrol"
ELSE
	  LOAD Destination$
END IF
END
