
! script name: parasolids.d/pkplanarhatch
! solids: assign a planar hatch attribute

!A
!A NAME:
!A
!A 	Planar Hatch
!A
!A DESCRIPTION:
!A
!A	This script will assign a planar hatching attribute to a
!A	parasolids face. This attribute is a property of the solid model
!A	and can be read by other systems which use the parasolid kernel.
!A
!A	The hatch lines on the face are the intersections of a series
!A	of equally spaced parallel planes whose normals are in the
!A	specified direction. 
!A
!A~ image location - images/pkplanarhatch.gif
!A
!A NOTE:
!A
!A	This attribute may be computationally intensive for some surfaces.
!A	The computational overhead for planar surfaces is minimal.
!A
!# see also - htdocs/help.d/parasolids.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: assign planar hatch ")

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

ActivateUndo
Start: !

Stat= SetEqualsValue(0.25)
Stat=SetInputFormat("n4=","")
Pitch=GetValue("SPACING OF HATCH PLANES")
IF ExitScript(Destination$) THEN Leave

Stat= SetEqualsValue(1)
Stat=SetInputFormat("n4=","")
Dx=GetValue("X DIRECTION OF HATCH PLANES")
IF ExitScript(Destination$) THEN Leave

Stat= SetEqualsValue(1)
Stat=SetInputFormat("n4=","")
Dy=GetValue("Y DIRECTION OF HATCH PLANES")
IF ExitScript(Destination$) THEN Leave

Stat= SetEqualsValue(1)
Stat=SetInputFormat("n4=","")
Dz=GetValue("Z DIRECTION OF HATCH PLANES")
IF ExitScript(Destination$) THEN Leave


Face_loop:!
Stat=SetInputFormat("a1",",N,")
E1=WPKPickEntity("PICK FACE   New spacing ",WsPKPickFace,Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF Answer$="N" THEN Start
IF NOT WPKIsEntity(E1) THEN Face_loop


Pt= PointXYZ(0,0,0)
Stat= WPKSetPlanarHatch(E1,Pt,Pitch,Dx,Dy,Dz)
Stat= DeleteEntity(Pt)

ActivateUndo
Stat= AdvanceUndoNumber("planar hatch")
Stat= AddItemToUndo(WsUBPKSessionMark)
RefineAll

GOTO Face_loop

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