
! script name: delete.d/deletealldims
! topic: delete all dimensions

!A
!A NAME:
!A
!A 	Delete All Dimensions
!A
!A DESCRIPTION:
!A
!A 	This script allows the deletion of all Dimensions.
!A
!B INSTRUCTIONS:
!B
!B 	Restore or Delete: 
!B
!B 		R - Restore means that the dimensions will not be deleted.
!B 		D - Delete finializes the deletion process.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: delete all dimensions")

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
Stat= SetDefaults(WsSelectedEntPen,Highlight_color)



Group_loop:!

Group= GrpByEntType(WsCompositeDimEnt)
Stat= SetSelectedFlag(Group,WsTrue)
Stat=PlotEntity(Group)
Group1= UnAttachedDimsGrp
Stat= SetSelectedFlag(Group1,WsTrue)
Stat=PlotEntity(Group1)

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=DeleteGroup(Group,WsTrue)
   Stat=DeleteGroup(Group1,WsTrue)
   TransformCleanUp
ELSE
   Stat= SetSelectedFlag(Group,WsFalse)
   Stat= SetSelectedFlag(Group1,WsFalse)
   Stat=PlotEntity(Group)
   Stat=PlotEntity(Group1)
   Stat=DeleteEntity(Group)
   Stat=DeleteEntity(Group1)
END IF

Leave: !
UnSelectAll
stat= DeleteEntity(Group)
stat= DeleteEntity(Group1)

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