
! script name: vcircles.d/reverseentdir
! var_topic: reverses an entity direction without creating a new entity.

!A
!A NAME:
!A
!A 	Reverses an entities direction VARIATIONAL
!A
!A DESCRIPTION:
!A
!A 	This script reverses  an entities direction.
!A
!B INSTRUCTIONS:
!B
!B	PICK ENTITY: Pick the entity to be oriented.
!B
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: reverse entity direction")

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

Var_object= CheckVarObject
IF ExitScript(Destination$) THEN Leave

ActivateUndo
Start:Stat=SetInputFormat("n4","")
E1=PickEntity("PICK ENTITY")
IF ExitScript(Destination$) THEN Leave
IF NOT ValidDependency(E1) THEN Pick_point
Stat= EntityNameCheck(E1,Element$)


ActivateUndo
Stat= AdvanceUndoNumber("reverse direction")
Stat= AddItemToUndo(WsUBModifyMode,Element$)

RecordFunctionOn
Stat= RecordDescr("ORIENT: reverse direction")
Stat= RevEntDirection(Element$)
RecordFunctionOff
Curr_record= CurrentVarRecord
CloseVarRecord

Stat= AddItemToUndo(WsUBCreateMode,Curr_record)
GOTO Start

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

