
! script name: rotate.d/3drotateent
! topic: 3D rotate single entity

!A
!A NAME:
!A
!A 	3D Rotate Entity
!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 ELEMENT: Pick the element 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 entity ")

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

Start: !
ActivateUndo

stat= SetInputFormat("n4","")

E1= PickEntity("PICK ELEMENT TO BE ROTATED")
IF (ExitScript(Destination$)) THEN Leave
Stat=SetInputFormat("n4"," ")

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

E2= RotEntAboutAxis(E1,Axis_line,Angle)
Stat= DeleteEntity(Pt)
Stat= DeleteEntity(Pr)

ActivateUndo
Stat= AdvanceUndoNumber("rotate")
Stat= AddItemToUndo(WsUBCreateMode,E2)
Stat= AddItemToUndo(WsUBDeleteMode,E1)

Stat=Unlink(E1)
Stat= DeleteEntity(E1)

PlotAll
GOTO Start

Leave: !
stat= SetInputFormat("n4","")
Stat= DeleteEntity(Pt)
Stat= DeleteEntity(Pr)

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