
! script name: pksolids.d/pkprism
! solids: construct a prism in the current workplane

!A
!A NAME:
!A
!A 	Solid Prism
!A
!A DESCRIPTION:
!A
!A 	This script will construct a prism. A prism is a regular polygon
!A	with n sides. 
!A
!A~ image location - images/pkprism.gif
!A
!B INSTRUCTIONS:
!B
!B	RADIUS: Input the radius of the circumscribed circle of the prism.
!B
!B	Z HEIGHT: Input the  height of the prism.
!B
!B	# OF SIDES: Input the number of sides.
!B
!B	LOCATION POINT: Input the location of the bottom center.
!B
!# see also - htdocs/help.d/parasolids.htm

Stat=ChangeLabelStr("ScriptNameStatus","Function: prism")

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

ActivateUndo
Units= CurrentUnits
IF Units= WsMetric THEN
Xlength=125
Ylength=125
Zlength=25
ELSE
Xlength=5
Ylength=5
Zlength=1
END IF

ActivateUndo
Units= CurrentUnits
IF Units= WsMetric THEN
        Radius= 25
	ZHeight= 25
ELSE
        Radius= 1
	ZHeight= 1
END IF

Stat= GLPlotOn
Cloop:!

Stat=SetInputFormat("n4=","")
Stat=SetRadiusEquals(Radius)
Radius=InputRadius("RADIUS")
IF ExitScript(Destination$) THEN Leave

Stat=SetInputFormat("n4=","")
Stat=SetDepthEquals(ZHeight)
ZHeight=InputDepth("Z HEIGHT")
IF ExitScript(Destination$) THEN Leave

Stat=SetInputFormat("n0=","")
Stat=SetEqualsValue(Nsides)
Nsides=GetValue("# OF SIDES",Answer$)
IF ExitScript(Destination$) THEN Leave

Stat=SetInputFormat("n4","")
Pc=XyzInput("LOCATION POINT ",WsXyzInput)
IF ExitScript(Destination$) THEN Leave
Stat= SetLastPoint(Pc)


WPKClearErrorFlag
S1=WPKPrism(Pc,Radius,ZHeight,Nsides)
Stat= DeleteEntity(Pc)

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

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