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.
Gelöst! Gehe zur Lösung
Gelöst von L.Maas. Gehe zur Lösung
Not sure what the reason might be. There are some circumstances where a view can not be deleted.
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
Please mention Revit version, especially when uploading Revit files.
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.