
! script name: v3dinter.d/expldtrimxyz
! var_topic: explode trim curve as an xyz curve

!A
!A NAME:
!A
!A 	Intersect: Trim Curve	VARIATIONAL
!A
!A DESCRIPTION:
!A
!A 	This script will take the trim curves associated with the surface and
!A 	explode them out as contours in XYZ space.  This feature applies to
!A 	3D surfaces only.
!A
!B INSTRUCTIONS:
!B
!B 	PICK TRIM CURVE ON SURFACE: Pick the surface along the trim curve.
!B

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

DIM Destination$[256]
DIM Answer$[256]
DIM Surface$[256]
DIM Name$[256]

Var_object= CheckVarObject
IF (ExitScript(Destination$)) THEN Leave

ActivateUndo
Start:!

Intersect2:!

Stat=SetPickMask(WsPickSurfOnly)
Stat=SetInputFormat("n4","")
Surface=PickEntity("PICK TRIM CURVE ON SURFACE",Answer$)
IF ExitScript(Destination$) THEN Leave
IF NOT ValidDependency(Surface) THEN Intersect2
Stat= EntityNameCheck(Surface,Surface$)

Which1=LastSurfTrimPick(Surface)

Stat=SetPickMask(WsPickAll)

Dir1=WsForward

Stat= GenerateVarName(WsGroupEnt,Name$)
RecordFunctionOn
Stat= RecordDescr("CURVE: Trim curve")
Stat= SetRecDelLastExec
Stat= Set3dInterOffset(0.0)
V1= FreeParameter("Which edge",Which1)
V2= FreeParameter("Direction",Dir1)
C1=ExplodeTrimXYZ(Surface$,V1,V2)
Stat= AutoNameGroup(C1,Name$)
Stat= SetNoPathFlag(C1,WsTrue)
RecordFunctionOff
Curr_record= CurrentVarRecord
CloseVarRecord
IF NOT ValidGeometry(C1) THEN
        DelLastVarRecord
ELSE
	ActivateUndo
	Stat= AdvanceUndoNumber("expld trim curve")
	Stat= AddGroupToUndo(WsUBCreateMode,C1,1,WsTrue)
	Stat= AddItemToUndo(WsUBCreateMode,Curr_record)
END IF
GOTO Intersect2

Leave:!
Stat=SetInputFormat("n4","")
Stat=SetPickMask(WsPickAll)
IF NOT LEN(Destination$) THEN
	LOAD "typecontrol"
ELSE
	LOAD Destination$
END IF
END
