! script name: contrib/ascript/tsm.d/reversecontour
! topic: reverse direction of contour
! Version_270423.a

!A
!A NAME:
!A
!A      Reverse Contour
!A
!A DESCRIPTION:
!A
!A      This script automatically reverses the direction of a selected contour.
!A
!B INSTRUCTIONS:
!B
!B      PICK CONTOUR TO BE REVERSED: Pick an element
!B              on the contour that will be reversed.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: reverse contour ")

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


ActivateUndo
Ploop:!
E1=PickEntity("PICK CONTOUR TO BE REVERSED")
IF (ExitScript(Destination$)) THEN Leave

Contour= ParentGroup(E1)
ActivateUndo
Stat= AdvanceUndoNumber("reverse contour")
Stat= AddGroupToUndo(WsUBModifyMode,Contour,1,WsTrue)

Stat=ReverseContour(E1)
Stat=Highlight(E1,WsPickPen,WsDirArrowOn)

GOTO Ploop

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