
! script name: pkgroups.d/pkidentifyholes
! solids: identify cylindrical holes in a solid model

!A
!A NAME:
!A
!A 	Identify All
!A
!A DESCRIPTION:
!A
!A	This script will list the data for all holes in a body
!A	less than the maximum radius. The solid model is not modified,
!A	no attributes are attached to the body.
!A
!B INSTRUCTIONS:
!B
!B	MAXIMUM RADIUS: The script will identify all holes with radius
!B 		less than this value.
!B
!B	PICK BODY: Pick the body the holes are in.
!B
!C NOTES:
!C
!C      This script may be applied to any solid body.
!C
!C      To be identified a hole must be recognizable as a cylindrical
!C      hole by the parasolids kernel. Non-cylindrical holes
!C      are not recognized and are not identified.
!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: identify solid holes ")

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

ActivateUndo

Filename$="tempdata"
Stat= GLPlotOn
Units= CurrentUnits
IF Units= WsMetric THEN
        Radius= 25
        Length1= 125
ELSE
        Radius= 1
        Length1= 5
END IF

Stat= GLPlotOn
Ask_max_radius:!
Stat=SetInputFormat("n4=","")
Stat=SetRadiusEquals(Radius)
Radius=InputRadius("MAXIMUM RADIUS")
IF ExitScript(Destination$) THEN Leave

Pick_body:!
Pkbody= WPKCurrentBody
IF NOT WPKIsEntity(Pkbody) THEN
        Stat=SetInputFormat("n4","")
        E1=WPKPickEntity("PICK BODY")
        IF (ExitScript(Destination$)) THEN Leave
        IF NOT WPKIsEntity(E1) THEN Pick_body
        Pkbody= WPKParentBody(E1)
END IF

Stat= RemoveFile(Filename$)
Stat= WPKIdentifyHoles(Pkbody,Filename$,Radius)

GOTO Ask_max_radius

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