
! script name: names.d/unnameentity
! topic: remove entity name

!A
!A NAME:
!A
!A 	Un Name Entity
!A
!A DESCRIPTION:
!A
!A 	This script removes an entity name.
!A
!B INSTRUCTIONS:
!B
!B 	ENTITY NAME:	Input entity name   
!B
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: remove name ")

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


ActivateUndo
Ploop:!

Stat=SetInputFormat("n4","")
E1=PickEntity("PICK ELEMENT TO BE REMOVE NAME")
IF (ExitScript(Destination$)) THEN Leave

IF IsEntReferenced(E1) OR IsEntityDependent(E1) THEN
	Stat=SetInputFormat("a1",",Y,N,")
	Stat=ChangeLabelStr("Status","WARNING: VDM name dependency. A name change will give a VDM error.")
	Stat=GetValue("OVERRIDE VDM NAME. Yes or No ",Answer$)
	Stat=ChangeLabelStr("Status","         ")
	IF ExitScript(Destination$) THEN Leave
	IF Answer$= "N" THEN Ploop
END IF

ActivateUndo
Stat= AdvanceUndoNumber("remove entity name")
Stat= AddItemToUndo(WsUBModifyMode,E1)

Stat=NameEntity(E1,"")
IF WPKIsEntity(E1) THEN WPKSessionMark

GOTO Ploop

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