
! script name: rotate.d/3drotatecont
! topic: 3D rotate group of entities

!A
!A NAME:
!A
!A 	3D Rotate Group
!A
!A DESCRIPTION:
!A
!A 	This script allows a group of entities or a single entity to be
!A 	rotated and the option of the original being deleted.
!A
!B INSTRUCTIONS:
!B
!B 	PICK GROUP TO BE ROTATED: Pick an element on the group to be rotated.
!B
!B 	ROTATION ANGLE ABOUT AXIS: Enter the angular rotation amount around
!B 		the axis.
!B
!B 	PICK AXIS LINE: Pick the axis line to be used as the reference for
!B 		the rotation.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: 3d rotate group ")

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

Start: !
ActivateUndo

stat= SetInputFormat("n4","")

C1=PickGroupEnt("PICK GROUP TO BE ROTATED")
IF ExitScript(Destination$) THEN Leave

IF NOT ValidGeometry(C1) THEN Start
Stat=Highlight(C1,WsPickPen,WsDirArrowOff)

Stat=SetEqualsValue(Angle)
Angle=GetValue("ROTATION ANGLE ABOUT AXIS",Answer$)
IF ExitScript(Destination$) THEN Leave

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

Stat= EraseEntity(C1)
ActivateUndo
Stat= AdvanceUndoNumber("rotate")
Stat= AddGroupToUndo(WsUBModifyMode,C1,1,WsTrue)

Axis_trans= RotAboutAxisTrans(Axis_line,Angle)
Stat=TransGroupTrans(C1,Axis_trans)

PlotAll
GOTO Start

Leave: !
stat= SetInputFormat("n4","")

IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
