Changing elements

Hi,

I have exported a list of parameters to a csv file from selected elements within revit. The parameters will be changed within excel. I am exporting the element id in the csv file. (i have tried exporting the unique id but i can only get it to export ‘none’ as a value so far).

I would to write a script that would then read the changed csv file, have it select the elements in revit by the element id and apply the changes back. Will this be possible?

I have read that unique id is a better id to use as element id can change over time. Is this correct?

I have seen something similar using dynamo. but i would prefer to just use python if possible. Any direction as to what methods to use would be great. Im happy to figure it out on my own as much as possible. but im unsure where to start for the importing of the data back into revit. specifically reselecting the elements based on id etc.

99% o the time, element Id is fine

to get an element by its id:

doc = revit.doc
ele = doc.GetElement(id)
# or if 'ele' is a list of element ids
list_elements = [doc.GetElement(i) for i in ele]


is there a way to make that revits current selection and highlight the elements? or would i have to first select all elements in revit and then run the code to filter for matching ids?

to set the selection:

to get the selection

I suggest you use the search function in the forum

1 Like

I had seen that dynamo script prior to posting but dismissed it as it was for dynamo and wasnt sure it was relevant.

I gave it another shot and had to edit it a little to get it to work, but i managed to get it working along with your extra code.

I appreciate your time and help @Jean-Marc , thankyou!