
! script name: 3dtrim.d/dellasttrim
! 3dtopic: undo last trim curve

!A
!A NAME:
!A
!A 	Undo Last Trim
!A
!A DESCRIPTION:
!A
!A 	This script allows the last trim curve to be undone.  The trim might
!A 	have made multiple curves and this procedure may have to be repeated
!A 	to undo all of them.
!A
!B INSTRUCTIONS:
!B
!B 	PICK SURFACE: Pick the surface to have the last trim curve undone.
!B

Stat=ChangeLabelStr("ScriptNameStatus","Function: delete last 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("del trim curve")
Stat= AddItemToUndo(WsUBModifyMode,Surface)

Stat=RemoveTrimCurve(Surface)

GOTO Start

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