
! script name: v3dinter.d/partedges
! var_topic: generates a curve along all edges of the part

!A
!A NAME:
!A
!A 	Intersect: Part Edges	VARIATIONAL
!A
!A DESCRIPTION:
!A
!A 	This script generates a curve along all edges in a group of surfaces.
!A
!B INSTRUCTIONS:
!B	
!B	PICK SURFACE: Pick the surface.
!B

Stat=ChangeLabelStr("ScriptNameStatus","Function: four edges ")

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

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

ActivateUndo
Tol=NamedVarVal("3D Intersect Tol",Ws3DSystemVars,0.005)

Start:!
Stat=Setup3dCutter(WsNullTool,0.0,0.0,0.0,0.0,0.0)

Pick_loop:!

Intersect2:!
Stat=SetPickMask(WsPickSurfOnly)
Stat=SetInputFormat("n4","")
Part_group=PickGroupEnt("PICK SURFACE GROUP ",WsSurfaceGroup)
IF ExitScript(Destination$) THEN Leave
IF NOT ValidDependency(Part_group) THEN Intersect2
Stat= EntityNameCheck(Part_group,Part_group$)

Stat=Highlight(Part_group,WsPickPen,WsDirArrowOff)
Stat=SetPickMask(WsPickGeometry)


Stat= GenerateVarName(WsGroupEnt,Name$)
RecordFunctionOn
Stat= RecordDescr("CURVE: Part edge curves")
Stat= SetRecDelLastExec
stat= Set3dInterOffset(0.0)
V1= FreeParameter("Tolerance",Tol)
G1= PartEdges(Part_group$,V1)
Stat= AutoNameGroup(G1,Name$)
Stat= SetNoPathFlag(G1,WsTrue)
RecordFunctionOff
Curr_record= CurrentVarRecord
CloseVarRecord
IF NOT ValidGeometry(G1) THEN
        DelLastVarRecord
ELSE
	ActivateUndo
	Stat= AdvanceUndoNumber("part edges")
	Stat= AddGroupToUndo(WsUBCreateMode,G1,1,WsTrue)
	Stat= AddItemToUndo(WsUBCreateMode,Curr_record)
END IF
GOTO Intersect2

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