
! script name: delete.d/deletecpaths
! topic: delete all 3d cutterpaths

!A
!A NAME:
!A
!A 	Delete All 3D Cutterpaths
!A
!A DESCRIPTION:
!A
!A 	This script allows the deletion of all 3D Cutterpaths. The
!A 	elements  selected will be highlighted, the default color is red.  
!A 	This script will not permanently delete until
!A 	"Delete" is selected.
!A
!B INSTRUCTIONS:
!B
!B 	Restore or Delete: 
!B
!B 		R - Restore means that the cutterpaths will not be deleted.
!B 		D - Delete finializes the deletion process.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: delete all 3D cutterpaths")

DIM Answer$[256]
DIM Destination$[256]
DIM Choice$[256]
REAL Color_array(100)

!C 	If Ask_undo$="Y" the "Restore, Delete" options will be present.
!C 	If Ask_undo$="N" the script will automatically delete the elements
!C 	when they are picked.  NO CHANCE to change the selection.

DeActivateUndo

Ask_undo$="Y"

Start: !
Highlight_color=2

Group_loop:!

Group= GrpByEntType(WsCPathFileEnt)
Stat=Highlight(Group,Highlight_color,0)

IF Ask_undo$="Y" THEN

   Stat=SetInputFormat("a1=",",R,D,")
   Stat=SetEqualsValue(0,"D")
   Stat=GetValue("Restore or Delete",Answer$)
   IF (ExitScript(Destination$)) THEN Leave

ELSE

    Answer$="D"

END IF


IF Answer$="D" THEN

   Stat=UnLink(Group)

   Stat=DeleteGroup(Group)
   TransformCleanUp

ELSE

   PlotAll
   Stat=DeleteEntity(Group)

END IF

Leave: !
stat= DeleteEntity(Group)

Stat=SetInputFormat("n4=","")
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
