
! script name: pkgroups.d/pkholegrpcenter
! solids: center point for a solid hole feature group

!A
!A NAME:
!A
!A 	Solid Hole Feature Center Point
!A
!A DESCRIPTION:
!A
!A	This script creates the center point for a group
!A	of faces which has been identified as a hole feature.
!A
!B INSTRUCTIONS:
!B
!B	PICK ENTITY IN HOLE: Pick a solid entity which defines the
!B 		hole feature. It may be a face of the
!B 		feature or an edge of one of the faces.
!B
!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/pkholes.htm
!# see also - htdocs/help.d/pkgroups.htm
!# see also - htdocs/help.d/parasolids.htm

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

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

ActivateUndo

Stat= GLPlotOn
Start:!
PlotOn
E1=WPKPickEntity("PICK ENTITY IN HOLE")
IF (ExitScript(Destination$)) THEN Leave
IF NOT WPKIsEntity(E1) THEN Start

Pkgroup= WPKContainingGroup(E1,1,WsTrue)
IF Pkgroup= 0 THEN Pkgroup= E1

PlotOff
L1= WPKHoleGrpAxisLine(Pkgroup)
IF NOT ValidGeometry(L1) THEN Start
P1= ParameterPt(L1,0)
Stat= DeleteEntity(L1)
PlotOn
Stat= PlotEntity(P1)

ActivateUndo
Stat= AdvanceUndoNumber("solid hole center")
Stat= AddItemToUndo(WsUBCreateMode,P1)
GOTO Start

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