
! script name: 3dcpaths.d/explodecpaths
! 3dtopic: explodes a 3D cutterpath into geometry

!A
!A NAME:
!A
!A 	Explode: Multiple 3d cutter paths
!A
!A DESCRIPTION:
!A
!A 	This script allows a 3D cutter path to be exploded into a group
!A 	of paths.
!A
!B INSTRUCTIONS:
!B
!B 	PICK CUTTER PATH TO BE EXPLODED: Pick the cutter path to be exploded
!B

Stat=ChangeLabelStr("ScriptNameStatus","Function: explode 3d cutter paths ")

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

ActivateUndo
Ploop:!

Stat=SetPickMask(WsPickGeometry)
E1=PickEntity("PICK CUTTER PATH TO BE EXPLODED")
IF ExitScript(Destination$) THEN Leave

Etype=EntityType(E1)

IF Etype=WsCPathFileEnt THEN
	Contour=ExplodeCPaths(E1)

	ActivateUndo
        Stat= AdvanceUndoNumber("explode cpaths")
        Stat= AddGroupToUndo(WsUBCreateMode,Contour,1,WsTrue)
END IF

GOTO Ploop

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