
! script name: pkgroups.d/pkidentifysimilar
! solids: identify similar hole features in a solid model

!A
!A NAME:
!A
!A 	Identify Similar
!A
!A DESCRIPTION:
!A
!A	This script will identify similar holes to the picked hole.
!A
!B INSTRUCTIONS:
!B
!B	PICK ENTITY IN HOLE: Pick an entity in the hole.
!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 similar ")

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

ActivateUndo

Filename$="tempdata"
Stat= GLPlotOn
Units= CurrentUnits
IF Units= WsMetric THEN
        Radius= 10000
ELSE
        Radius= 1000
END IF

Stat= GLPlotOn
Start:!
Stat=SetInputFormat("a1",",D,C,DW,CW,")
Stat=GetValue("SIMILAR:  Diameter, Configuration ",Answer$)
IF (ExitScript(Destination$)) THEN Leave
SELECT Answer$
CASE "D"
        Similar=2
CASE "C"
        Similar=1
CASE "DW"
        Similar=12
CASE "CW"
        Similar=11
END SELECT


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

Pkbody= WPKParentBody(E1)

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

GOTO Pick_hole

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