
! script name: parasolids.d/pkdelfacegroup
! solids: delete a group of faces from a body and repair the hole.

!A
!A NAME:
!A
!A 	Delete Face Group
!A
!A DESCRIPTION:
!A
!A 	This script deletes a group of faces from a body. Basically the faces
!A	are deleted and the openings are closed by the modeler. Usually only
!A	faces which consist of analytic surfaces can be resolved.
!A
!B INSTRUCTIONS:
!B
!B	PICK FACE GROUP: Heal method
!B
!B NOTES:
!B
!B
!# see also - htdocs/help.d/parasolids.htm


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

OPTION BASE 1
DIM Destination$[256]
DIM Answer$[256]

ActivateUndo

Pick_color=2
Heal_method=2

Stat= GLPlotOn
Start:!

Stat=SetInputFormat("a1",",H,")
E1=WPKPickEntity("PICK FACE GROUP:   Heal method ",WsPKPickFace,Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF Answer$= "H" THEN
	GOSUB Ask_heal_method
	GOTO Start
END IF
IF NOT WPKIsEntity(E1) THEN Pick_loop

Pkgroup= WPKContainingGroup(E1,1)
Stat= WPKNameEntity(Pkgroup,Name$)
Stat= WPKHighlightEntity(Pkgroup)


Delete_faces:!
WPKClearErrorFlag

WPKClearErrorFlag
E2= WPKDeleteFaceList(0,Pkgroup,Heal_method)

ActivateUndo
Stat= AdvanceUndoNumber("delete face group")
Stat= AddItemToUndo(WsUBPKSessionMark)
WPKErrorCheck
GOTO Start

Ask_heal_method:!
Stat=SetInputFormat("a1=",",C,G,S,")
Stat=SetEqualsValue(0,"C")
Stat=GetValue("HEAL METHOD:  Cap, Grow, Shrink ",Answer$)
IF ExitScript(Destination$) THEN Leave
SELECT Answer$
CASE "G"
        Head_method=4
CASE "C"
        Head_method=2
CASE "S"
        Head_method=5
END SELECT
RETURN


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