
! script name: 3dtrim.d/explodeuvtrim
! 3dtopic: explode UV curves associated with trim

!A
!A NAME:
!A
!A 	Explode UV Trim Curves
!A
!A DESCRIPTION:
!A
!A 	This script will take the UV curves associated with trim surface and
!A 	explode them out as contours in UV space.  The exploded contours will
!A 	appear in the XY plane in a 10x10 inch or 100x100 mm square.  ( The UV
!A 	space is normally a 1x1 inch or 1x1 mm square. )  This feature
!A 	applies to 3D surfaces only.
!A
!B INSTRUCTIONS:
!B
!B 	PICK SURFACE: Pick the surface associated with the UV curves to be
!B 		exploded.
!B

Stat=ChangeLabelStr("ScriptNameStatus","Function: explode uv trim curves ")

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

ActivateUndo
Start:!

Intersect2:StdWorkplane

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

Stat=SetPickMask(WsPickGeometry)

Curves=ExplodeTrimCurves(Surface)

ActivateUndo
Stat= AdvanceUndoNumber("xyz curve")
Stat= AddGroupToUndo(WsUBCreateMode,Curves,1,WsTrue)
GOTO Intersect2

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