Deleting elements using Python

revit
python
dynamo

#1

Hello guys, i’m a very beginner at python programing, i’m trying to get some walls deleted with revit API in python but got an issue !
the Python shell tells me “expected element got wall” but i’m using all ELEMENTS of category !! Please some help


#2

The delete method expects element ids, not the actual element :slight_smile:


#3

@Martin_Spence1 thank you !! it worked fine :slight_smile:


#4

Sweet :+1::slight_smile:


#5

Hi, so the Element.ID node gives the Revit element ID as a string, how can that be fed into the Python script? Thanks


#6

worked it out, just need to add:

ID = Autodesk.Revit.DB.ElementId(walls)

before

doc.Delete(walls)