
! script name: glfunc.d/glzclip
! 3dtopic: set z clip plane 

!A
!A NAME:
!A
!A	Z Clip Plane
!A
!A DESCRIPTION:
!A
!A 	This sets a clip plane parallel to the XY axis through an Z coordinate.
!A
!B INSTRUCTIONS:
!B
!B
!B 	Z COORDINATE: Input the Z coordinate for clipping
!B
!B	WHICH SIDE: ( +, - )  
!B
!C NOTE:
!C
!C      Clipping is a standard feature of Open GL. This script
!C      is provided to access that feature. The results are
!C      graphical in nature and do not represent model geometry.
!C      The image created is visual only.
!C
!C

Stat=ChangeLabelStr("ScriptNameStatus","Function: z clip plane")

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

Ask_value:!
Pick_return= CurrPickReturn
Stat=SetPickReturn(WsGeometryZ)
Stat=SetInputFormat("n4a1=",",P,")
Stat=SetEqualsValue(0.0)
Zvalue=GetValue("Z COORDINATE  Pick ",Answer$)
Stat=SetPickReturn(Pick_return)
IF ExitScript(Destination$) THEN Leave
IF Answer$= "P" THEN
        Stat=SetInputFormat("n4","")
        Pc=XyzInput("PICK",WsXyzInput)
        IF (ExitScript(Destination$)) THEN Leave
        IF NOT ValidGeometry(Pc) THEN Ask_value
        Zvalue= ZPointValue(Pc)
END IF

Stat=SetInputFormat("a1=",",+,-,")
Stat=SetEqualsValue(0.0,"+")
Stat=GetValue("WHICH SIDE: ( + , -) ",Answer$)
IF ExitScript(Destination$) THEN Leave

Side= (Answer$= "+")- (Answer$="-")


Stat= WGLClipPlane(2,0,0,Zvalue,0,0,Side)

PlotAll

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