
! script name: pksolids.d/circylinder
! solids: construct cylinder defined by a circle and length

!A
!A NAME:
!A
!A 	Cylinder: Solid cylinder from circle
!A
!A DESCRIPTION:
!A
!A 	This script constructs a cylinder of specified length and the circle
!A 	picked will be used as one end of the cylinder and will determine the
!A 	radius and orientation of the cylinder.
!A
!A
!B INSTRUCTIONS:
!B
!B 	PICK CIRCLE: Pick the circle to be used as one end of the cylinder
!B 		to be constructed.
!B
!B 	LENGTH: Enter the length of the cylinder to be constructed.
!B
!C NOTES:
!C
!C

Stat=ChangeLabelStr("ScriptNameStatus","Function: cylinder defined by a circle")

DIM Destination$[256]
DIM Answer$[256]


ActivateUndo
Length=1.0
Stat= GLPlotOn

Cloop:!
pcircle=PickSpecificEnt("PICK CIRCLE",WsPickCircles)
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(pcircle) THEN Cloop

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

WPKClearErrorFlag
C1=WPKCylinder(Pcircle,Length)

ActivateUndo
Stat= AdvanceUndoNumber("solid cylinder")
Stat= AddItemToUndo(WsUBPKSessionMark)
WPKErrorCheck
GOTO Cloop

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