
! script name: delete.d/singledelete
! topic: delete single element, no undo available

!A
!A NAME:
!A
!A 	Single Delete
!A
!A DESCRIPTION:
!A
!A 	This script allows the deletion of a single element.
!A
!B INSTRUCTIONS:
!B
!B 	DELETE WHICH ELEMENT: Pick the element to be deleted.
!B
!B NOTE:
!B
!B 	If an element in a contour or a group is deleted, the group
!B 	is automatically unlinked.
!B

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

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

ActivateUndo
Start: !

E1=PickEntity("DELETE WHICH ELEMENT")
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(E1) THEN Leave
IF IsEntVariational(E1) THEN Leave
IF IsEntReferenced(E1) THEN Leave

ActivateUndo
Stat= AdvanceUndoNumber("delete")
Stat= AddItemToUndo(WsUBDeleteMode,E1)

Stat=UnLink(E1)
Stat=DeleteEntity(E1)

Leave:!

Stat=SetInputFormat("n4","")

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