
! script name: pkgroups.d/pkrotategroup
! solids: rotate a group of faces within a body

!A
!A NAME:
!A
!A 	Rotate Face Group
!A
!A DESCRIPTION:
!A
!A 	This script will rotate group of faces within a body.
!A
!A~ image location - images/pkrotatefacegrp.gif
!A
!B INSTRUCTIONS:
!B
!B 	PICK GROUP TO BE ROTATED: Pick the group to be rotated.
!B
!B 	REFERENCE POINT: Input the reference point.
!B	
!B 	ROTATION ANGLE: Enter the rotation angle.
!B
!C NOTES:
!C
!C      A group of faces may be rotated within a body provided the
!C      intersections with the neighboring elements are simple enough.
!C      The rotated faces must basically intersect the same faces that
!C      they did before the rotate. Faces cannot be eliminated, the rotated
!C      faces 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 group")

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

ActivateUndo

Stat= GLPlotOn
Pick_group:!
E1=WPKPickEntity("PICK FACE GROUP TO BE ROTATED")
IF (ExitScript(Destination$)) THEN Leave
IF NOT WPKIsEntity(E1) THEN Pick_group
G1= WPKContainingGroup(E1,1,WsTrue)
IF NOT WPKIsEntity(G1) THEN Pick_group

Pt=XyzInput("REFERENCE POINT ",WsXyOnly)
IF ExitScript(Destination$) THEN Leave
Stat= SetLastPoint(Pt)

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

T1= PlaneRotateTrans(Pt,Angle)

WPKClearErrorFlag
Stat=WPKTransFaceGroup(G1,T1)
Stat= DeleteEntity(Pt)

ActivateUndo
Stat= AdvanceUndoNumber("rotate group")
Stat= AddItemToUndo(WsUBPKSessionMark)
WPKErrorCheck
GOTO Pick_group

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