
! script name: pksurfaces.d/pkthickensurf
! solids: thicken a sheet body

!A
!A NAME:
!A
!A 	Thicken Sheet
!A
!A DESCRIPTION:
!A
!A	This script will thicken a sheet body. It will apply an offset
!A	in the forward and reverse normal directions to the sheet.
!A
!B~ image location - images/pkthickensheet.gif
!B
!B INSTRUCTIONS:
!B
!B 	PICK SHEET BODY: Pick the parasolid sheet body to be thickened.
!B
!B 	FORWARD NORMAL OFFSET: Enter the thickness applied in the forward
!B 		normal direction.
!B
!B 	REVERSE NORMAL OFFSET: Enter the thickness applied in the reverse
!B 		normal direction.
!B
!B NOTE:
!B
!B 	Not every sheet body can be thickened. In general parasolids can
!B 	thicken sheets when the offset is less than the local curvature
!B 	of the surfaces involved. It seems to handle sharp corners very well.
!B 	It can to fail if the offset is great enough to elimimate faces.
!B
!# see also - htdocs/help.d/parasolids.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: thicken a sheet body ")

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


ActivateUndo
Stat= GLPlotOn
Ploop:!

E1=WPKPickEntity("PICK SHEET BODY")
IF (ExitScript(Destination$)) THEN Leave
IF NOT WPKIsEntity(E1) THEN Ploop

Body= WPKParentBody(E1)
Body_type= WPKBodyType(Body)
IF Body_type<> WsPKSheetBody THEN Ploop

Stat=SetInputFormat("n4=","")
Stat=SetDepthEquals(Offset1)
Offset1=InputDepth("FORWARD NORMAL OFFSET")
IF ExitScript(Destination$) THEN Leave

Stat=SetInputFormat("n4=","")
Stat=SetDepthEquals(Offset2)
Offset2=InputDepth("REVERSE NORMAL OFFSET")
IF ExitScript(Destination$) THEN Leave

WPKClearErrorFlag
E2= WPKThickenSheet(E1,Offset1,Offset2)

ActivateUndo
Stat= AdvanceUndoNumber("thicken sheet body")
Stat= AddItemToUndo(WsUBPKSessionMark)
WPKErrorCheck

GOTO Ploop

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