
! script name: vpksolids.d/vpkdeletesheetface
! var_solids: delete a face from a sheet body

!A
!A NAME:
!A
!A 	Delete Face From Sheet VARIATIONAL
!A
!A DESCRIPTION:
!A
!A 	This script deletes a face from a sheet body.
!A
!B INSTRUCTIONS:
!B
!B	PICK FACE: Pick the face to be deleted.
!B
!B NOTES:
!B
!B	If the sheet body has only one face a wire body will result.
!B	Deleting the face cannot separate the body into two sheets.
!B
!# see also - htdocs/help.d/parasolids.htm


stat=ChangeLabelStr("ScriptNameStatus","Function: delete face ")

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

ActivateUndo
Var_object= CheckVarObject
IF (ExitScript(Destination$)) THEN Leave

Stat= GLPlotOn
Face_loop:!

E1=WPKPickEntity("PICK FACE",WsPKPickFace)
IF (ExitScript(Destination$)) THEN Leave
IF NOT WPKIsEntity(E1) THEN Face_loop
Stat= EntityNameCheck(E1,Face$)

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

WPKClearErrorFlag
RecordFunctionOn
Stat= RecordDescr("SOLIDS: delete face from sheet")
Stat= WPKDeleteFace(Face$)
RecordFunctionOff
Curr_record= CurrentVarRecord
CloseVarRecord

Stat= WPKSolidRecordOn(Curr_record)
ActivateUndo
Stat= AdvanceUndoNumber("delete face")
Stat= AddItemToUndo(WsUBPKSessionMark)
Stat= AddItemToUndo(WsUBCreateMode,Curr_record)
WPKErrorCheck

GOTO Face_loop

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