
! script name: parasolids.d/pksectioncontours
! solids: gives the section contours of a body

!A
!A NAME:
!A
!A 	Section Contours
!A
!A DESCRIPTION:
!A
!A 	This script gives the section contours of a solid body.
!A
!B INSTRUCTIONS:
!B
!B	PICK BODY: Pick the body to be sectioned.
!B
!B	Z LEVEL: Enter the z level of the slice in
!B 		 the current workplane.
!B
!# see also - htdocs/help.d/parasolids.htm


stat=ChangeLabelStr("ScriptNameStatus","Function: z section contours ")

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


Stat= GLPlotOn
Ploop:!
ActivateUndo

E1=WPKPickEntity("PICK SOLID BODY")
IF (ExitScript(Destination$)) THEN Leave
IF NOT WPKIsEntity(E1) THEN Ploop

Body= WPKParentBody(E1)
Body_type= WPKBodyType(Body)
IF Body_type<> WsPKSolidBody THEN Ploop


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


Group= WPKSectionContours(E1,Zlevel)

Stat= PlotEntity(Group)

ActivateUndo
Stat= AdvanceUndoNumber("section contours")
Stat= AddGroupToUndo(WsUBCreateMode,Group,0,WsTrue)
Stat= DeleteEntity(group)

GOTO Zlevel

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