
! script name: pktransform.d/pkaxisrotface
! solids: rotate a face within a body

!A
!A NAME:
!A
!A 	Rotate a Face About an Axis
!A
!A DESCRIPTION:
!A
!A 	This script will rotate a face about an axis.
!A
!B INSTRUCTIONS:
!B
!B 	PICK FACE FACE TO BE ROTATED: Pick the face.
!B
!B 	ROTATION ANGLE ABOUT AXIS: Enter the rotation angle.
!B
!B 	PICK AXIS LINE: Pick the axis line.
!B
!C NOTES:
!C
!C      A face may be rotated within a body provided the
!C      intersections with the neighboring elements are simple enough.
!C      The rotated face must basically intersect the same faces that
!C      it did before the rotate. Faces cannot be eliminated, the rotated
!C      face cannot separate the body into multiple bodies. More things
!C      are possible with analytic surfaces than with non-analytic
!C      surfaces such as nurbs.
!C
!# see also - htdocs/help.d/parasolids.htm

Stat=ChangeLabelStr("ScriptNameStatus","Function: Rotate a face about an axis")

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

ActivateUndo

Stat= GLPlotOn
Pick_face:!
E1=WPKPickEntity("PICK FACE TO BE ROTATED")
IF (ExitScript(Destination$)) THEN Leave
IF NOT WPKIsEntity(E1) THEN Pick_face

Stat=SetInputFormat("n4="," ")
Stat=SetEqualsValue(Angle)
Angle=InputAngle("ROTATION ANGLE ABOUT AXIS")
IF ExitScript(Destination$) THEN Leave

Axis_line=PickSpecificEnt("PICK AXIS LINE ",WsPickLines)
IF ExitScript(Destination$) THEN Leave


WPKClearErrorFlag
T1= RotAboutAxisTrans(Axis_line,Angle)
Stat=WPKTransformFace(E1,T1)

ActivateUndo
Stat= AdvanceUndoNumber("rotate a face about axis")
Stat= AddItemToUndo(WsUBPKSessionMark)
WPKErrorCheck
GOTO Pick_face

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