Revit Architecture Forum
Welcome to Autodesk’s Revit Architecture Forums. Share your knowledge, ask questions, and explore popular Revit Architecture topics.
abbrechen
Suchergebnisse werden angezeigt für 
Anzeigen  nur  | Stattdessen suchen nach 
Meintest du: 

Delete View3D throws error

2 ANTWORTEN 2
GELÖST
Antworten
Nachricht 1 von 3
Anonymous
341 Aufrufe, 2 Antworten

Delete View3D throws error

Hello!

I have a problem when deleting a view.

I'm using this:

 

 

 

doc.Delete(existingView.Value().Id);

 

existingView.Value() will return the view and the view will have a valid Id.

 

The error thrown is this: 

 

 

 

Autodesk.Revit.Exceptions.ArgumentException: ElementId cannot be deleted.
Parameter name: elementId
   at Autodesk.Revit.DB.Document.Delete(ElementId elementId)

 

 

 

I saw in this post that the condition for this exception is : 

 

 

The element elementId does not exist in the document -or- ElementId cannot be deleted.

Can someone shred some light on why ElementId cannot be deleted ? What could be the cause ?

I also checked the first case and the element with that id is present in the document.

 

I'd like to mention that this is happening only on one model ( this model belongs to a client and i cannot share it ).

 

Thank you in advance for your replies.

 

2 ANTWORTEN 2
Nachricht 2 von 3
L.Maas
als Antwort auf: Anonymous

Not sure what the reason might be. There are some circumstances where a view can not be deleted.

 

error.png

 

In general the Revit API can only do what is possible in the GUI. So if yo try to do it 'manually' in the project can you delete the view?

 

I also recommend to install Revit Lookup. Revit Lookup allows you to explore the Revit database which might give you information on th eissue

 

Als I recommend to ask these kind of questiions in the Revit API forum. Better chance to get suitable answers.

Louis

EESignature

Please mention Revit version, especially when uploading Revit files.

Nachricht 3 von 3
Anonymous
als Antwort auf: L.Maas

Thank you for your answer.

 

I am able to delete the views from the GUI.

I will try with Revit Lookup maybe i will gather some extra info on why this is happening.

 

I will make another post on with this on Revit API forums (didn't knew that existed) & i'm gonna close this one.

 

 

Sie finden nicht, was Sie suchen? Fragen Sie die Community oder teilen Sie Ihr Wissen mit anderen.

In Foren veröffentlichen  

Autodesk Design & Make Report