
! script name: pkgroups.d/pkfeaturecenters
! solids: center point for all hole feature groups

!A
!A NAME:
!A
!A 	Center Points for all solid hole feature groups.
!A
!A DESCRIPTION:
!A
!A 	center point for all hole feature groups
!A
!C NOTES:
!C
!C	To use this script the Hole must have been identified as a
!C	hole feature in the solid model. A hole feature in the solid
!C	model is a parasolid group of faces making up the hole
!C	along with a parasolids attribute which identifies the
!c	group as a hole feature.
!C
!# see also - htdocs/help.d/pkgroups.htm
!# see also - htdocs/help.d/parasolids.htm

Stat=ChangeLabelStr("ScriptNameStatus","Function: hole feature center points")

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

ActivateUndo

Stat= GLPlotOn
Start:!
Stat= SetInputFormat("a99",",PROCEED,")
Stat= GetValue("GROUP NAME, PROCEED ",Name$)
IF (ExitScript(Destination$)) THEN Leave
IF Name$="PROCEED" THEN Leave

Group= FindNamedGrp(Name$)
IF NOT ValidGeometry(Group) THEN Make_group
Stat= SetInputFormat("a1",",N,")
Stat= GetValue("GROUP EXISTS: New name",Name$)
IF (ExitScript(Destination$)) THEN Leave
GOTO Start

Make_group:!
Group= WPKFindGrpsByFeat(WsPKHoleFeature)
G1= WPKHoleGrpCenter(Group)
Stat= DeleteEntity(Group)
Stat= NameEntity(G1,Name$)

ActivateUndo
Stat= AdvanceUndoNumber("solid hole feature centers")
Stat= AddGroupToUndo(WsUBCreateMode,G1,1,WsTrue)

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