
! script name: pkgroups.d/pkconvertfacegrp
! solids: explode the faces of a parasolid face group.

!A
!A NAME:
!A
!A 	Convert Face Group 
!A
!A DESCRIPTION:
!A
!A 	This script explodes the faces of a face group
!A
!B INSTRUCTIONS:
!B
!B	PICK FACE GROUP: Pick the face group.
!B
!# see also - htdocs/help.d/pkgroups.htm
!# see also - htdocs/help.d/parasolids.htm


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

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

ActivateUndo

Stat= GLPlotOn
Start:!

E1=WPKPickEntity("PICK FACE GROUP")
IF (ExitScript(Destination$)) THEN Leave
IF NOT WPKIsEntity(E1) THEN Start

Pkgroup= WPKContainingGroup(E1,1,WsTrue)
IF NOT WPKIsEntity(Pkgroup) THEN Start

WPKClearErrorFlag
Group= WPKConvertGroup(Pkgroup,WsPKConvertFaces)

IF ValidGeometry(Group) THEN
	Name$= "Parasolids Face Group"
	Stat= ChangeGroupType(Group,WsSurfaceGroup)
	Stat= ChangeGrpName(Group,Name$)
	Stat= PlotEntity(Group)
END IF

ActivateUndo
Stat= AdvanceUndoNumber("convert face group")
Stat= AddGroupToUndo(WsUBCreateMode,Group,1,WsTrue)
WPKErrorCheck

GOTO Start

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