
! script name: 3dtrim.d/reversetrim
! 3dtopic: reverse sides for last trim curve

!A
!A NAME:
!A
!A 	Reverse Trim 
!A
!A DESCRIPTION:
!A
!A 	This script will give the complimentary region for a given set of
!A 	trim curves on a surface.  For example, if the last trim curve was
!A 	on the inside, it will switch to the outside and vice versa.
!A
!B INSTRUCTIONS:
!B
!B 	PICK SURFACE: Pick surface associated with trim to be reversed.
!B

Stat=ChangeLabelStr("ScriptNameStatus","Function: reverse trim")

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

ActivateUndo
Start:!

Stat=SetPickMask(WsPickSurfOnly)
Stat=SetInputFormat("n0","")
Surface=PickEntity("PICK SURFACE",Answer$)
IF ExitScript(Destination$) THEN Leave
IF NOT ValidGeometry(Surface) THEN Pick_loop

Stat=SetPickMask(WsPickGeometry)

ActivateUndo
Stat= AdvanceUndoNumber("reverse trim")
Stat= AddItemToUndo(WsUBModifyMode,Surface)

Stat=ReverseValid(Surface)

GOTO Start

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