
! script name: parasolids.d/edgesonzlevel
! solids: find the edges on a z level

!A
!A NAME:
!A
!A 	Edges on Z Level
!A
!A DESCRIPTION:
!A
!A	This script will convert all edges which lie within a tolerance
!A	of a given z level.
!A
!B INSTRUCTIONS:
!B
!B	TRY TO MAKE CONTOURS  Yes or No  
!B
!B	Z LEVEL: Enter the z level on the current workplane.
!B
!# see also - htdocs/help.d/parasolids.htm


stat=ChangeLabelStr("ScriptNameStatus","Function: edges on z level ")

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

ActivateUndo

Units= CurrentUnits
IF Units= WsMetric THEN
        Tol= .005
ELSE
        Tol= .0002
END IF

Make_contours:!
Make_contours= WsFalse
stat= SetInputFormat("a1=",",Y,N,")
Stat= SetEqualsValue(0,"Y")
Stat=GetValue("TRY TO MAKE CONTOURS  Yes or No ",Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF Answer$="Y" THEN Make_contours= WsTrue

Z_level:!
stat= SetInputFormat("n4=","")
Stat= SetEqualsValue(Zlevel)
Stat=SetPickReturn(WsGeometryZ)
Zlevel=GetValue("Z LEVEL",Answer$)
IF (ExitScript(Destination$)) THEN Leave
Stat=SetPickReturn(WsGeometryEnd)

Group= WPKEdgesOnZPlane(Zlevel,Tol,Make_contours)
Stat= PlotEntity(Group)

ActivateUndo
Stat= AdvanceUndoNumber("edges on z level")
Stat= AddGroupToUndo(WsUBCreateMode,Group,0,WsTrue)
Stat= DeleteEntity(Group)
GOTO Make_contours

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