
! script name: pksurfaces.d/pkindentface
! solids: indent a face and subtract from a solid body.

!A
!A NAME:
!A
!A 	Indent Face
!A
!A DESCRIPTION:
!A
!A 	This script will indent a face into a body.
!A
!A~ image location - images/pkindentface.gif
!A
!B INSTRUCTIONS:
!B
!B 	PICK FACE: Pick the parasolid face to be indented.
!B
!B 	NORMAL OFFSET: Enter the thickness applied
!B 		in the normal direction.
!B
!C NOTES:
!C
!C	Not every face can be thickened. In general parasolids can
!C	thicken faces when the offset is less than the local curvature
!C	of the surfaces involved. It seems to handle sharp corners very well.
!C	It can to fail if the offset is great enough to elimimate faces.
!C
!# see also - htdocs/help.d/parasolids.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: indent a face ")

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


ActivateUndo
Stat= GLPlotOn

Start:!
Stat=SetInputFormat("n4=","")
Stat=SetDepthEquals(Offset)
Offset=InputDepth("NORMAL OFFSET")
IF ExitScript(Destination$) THEN Leave
IF ABS(Offset)= 0.0 THEN Start


Ploop:!
Stat=SetInputFormat("n4","")
E1=WPKPickEntity("PICK FACE",WsPKPickFace)
IF (ExitScript(Destination$)) THEN Leave
IF NOT WPKIsEntity(E1) THEN Face_loop

WPKClearErrorFlag
Body1= WPKParentBody(E1)
Body_type= WPKBodyType(Body1)
PlotOff
E2= WPKCopyFace(E1)
E3= WPKThickenSheet(E2,0.0,Offset)
PlotOn
Body2= WPKParentBody(E3)
G1= WPKSubtractBodies(Body1,Body2)
Stat= DeleteEntity(G1)

ActivateUndo
Stat= AdvanceUndoNumber("indent face")
Stat= AddItemToUndo(WsUBPKSessionMark)
WPKErrorCheck
GOTO Ploop

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