
! script name: pksolids.d/pkblock
! solids: construct a block in the current workplane

!A
!A NAME:
!A
!A 	Solid Block
!A
!A DESCRIPTION:
!A
!A 	This script will construct a solid rectangular block.  The position
!A 	of the block is specified by the center of the bottom face.
!A
!B INSTRUCTIONS:
!B
!B	X LENGTH:  Total length of the block in the X direction.
!B
!B	Y LENGTH:  Total length of the block in the Y direction.
!B
!B	Z LENGTH:  Total length of the block in the Z direction.
!B
!B	LOCATION POINT: Location of the center of the bottom face.
!B
!# see also - htdocs/help.d/parasolids.htm

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

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

Stat= GLPlotOn
Cloop:!

Stat=SetInputFormat("n4=","")
Stat=SetDepthEquals(Xlength)
XLength=InputDepth("X LENGTH")
IF ExitScript(Destination$) THEN Leave

Stat=SetInputFormat("n4=","")
Stat=SetDepthEquals(Ylength)
YLength=InputDepth("Y LENGTH")
IF ExitScript(Destination$) THEN Leave

Stat=SetInputFormat("n4=","")
Stat=SetDepthEquals(Zlength)
ZLength=InputDepth("Z LENGTH")
IF ExitScript(Destination$) THEN Leave

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

WPKClearErrorFlag
S1=WPKBlock(Pc,Xlength,Ylength,Zlength)
Stat= DeleteEntity(Pc)

ActivateUndo
Stat= AdvanceUndoNumber("solid block")
Stat= AddItemToUndo(WsUBPKSessionMark)
WPKErrorCheck

GOTO Cloop

Leave:!
IF NOT LEN(Destination$) THEN
	LOAD "typecontrol"
ELSE
	LOAD Destination$
END IF
END
