
! script name: rotate.d/2drotdelcont
! topic: 2D rotate group of entities and delete original

!A
!A NAME:
!A
!A 	2D Rotate and Delete 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 	REFERENCE POINT ABS X,Y: Enter the X,Y coordinates of the point
!B 		to be used as the reference for the rotate.
!B 		NOTE: See XYZ INPUT OPTIONS.
!B
!B 	ROTATION ANGLE: Enter the angular amount the entities should be
!B 		rotated.
!B
!# see also - points.d/xyzinput.hlp

stat=ChangeLabelStr("ScriptNameStatus","Function: 2d rotate and delete 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)

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

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

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

Stat= EraseEntity(C1)
Rot_trans= PlaneRotateTrans(Pt,Angle)
Stat=TransGroupTrans(C1,Rot_trans)
Stat= DeleteEntity(Pt,WsTrue)

PlotAll
GOTO Start

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

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