
! script name: delete.d/deleteoper
! topic: delete operation from current list

!A
!A NAME:
!A
!A 	Delete Operation
!A
!A DESCRIPTION:
!A
!A 	This script will delete an operation from the current
!A	operation list.
!A
!B INSTRUCTIONS:
!B
!B 	OPERATION TO BE DELETED: The selection box with the OPERATIONS
!B 		available will automatically appear for a selection
!B 		to be made.  Geometry associated with the operation to be
!B 		deleted will have the operation reference deleted also.
!B

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

DIM Destination$[256]
DIM Name$[256]
DIM Toolid$[256]
DIM Tool_grp$[256]
DIM Namelist$[4000]
DIM Namelist2$[4000]

DeActivateUndo
Start:!

Stat= UserDataNames(WsOperation,Namelist$)
IF NOT LEN(Namelist$) THEN Leave
Stat= RemoveFromList("OPERATION DATA",Namelist$,Namelist2$)
IF NOT LEN(Namelist2$) THEN Leave
Stat= GeneralListBox("OPERATIONS","selected operation",Namelist2$)

Stat=SetInputFormat("a99","")
Stat=GetValue("OPERATION TO BE DELETED",Name$)
IF ExitScript(Destination$) OR Name$= "CANCEL" THEN Leave

OperData=FindUserData(Name$,WsOperation)
IF ValidGeometry(OperData) THEN
	Stat=UnAssocUserData(OperData,WsOperation)
	Stat=DeleteEntity(OperData)
END IF
GOTO Start

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