Export/Import Revit to Excel (ElementSetParameterByName failed)

Greetings,

I have created a small routine for exporting all elements inside a category (let’s say all pipes) and then write in excel some specific parameters displayed in all those elements (format of the exported excel will be, the first row has the header - parameter name, 4 columns for a total of 4 parameters ; remaining rows would list the data associated to each parameter). (in the attached picture 5D_QTO is the parameter name, the rest is the data for each element in that parameter)

To keep track of the elements coming out of revit and then the elements going back in revit i use element unique ID of each element.

Problem i’m getting is on the Element.SetParameterbyName node, when i run it most of the elements get filled (codes with format AAXXXXXXXXX, A-alphanumeric ; X-number) but the elements where the parameter is filled with "0’ only are not getting filled…i assume it’s due to this error.

I’m new to dynamo so i’m fairly lost here…

try between the output of List.deconstruct and the Node Element.SetParameterByName the Node flatten

(ps Youre input in the value input = the number 1 (list)) (storage type off the parameterName is not a number)

No luck, adding the flatten node i still get the same error (watch node before and after the flatten node shows same result).

The number 1 (list) is a custom parameter name i added (5D_QTO), the rest of the list is the data inside that parameter for each element

I have some elements that are filled with “0” only…different from all the rest, elements with that assigned are not getting filled when i try to import to revit, maybe this is connected to the error i’m getting?

Most likely the type of parameter is string (text) so, you need to convert all your data to String and then feed in the Element.SetParameterByName .Now the 0 value is number and that is why the error says that the parameter type should not be number. You can use different approaches here like String from Object node or other. You can also replace 0 values with something else. So it is up to you but the main problem is the type of the values that you are feeding.

Check the storage type you need
string or element Id?
you can use the node Parameter.StorageType to check

Yes, the type of parameter is text…i followed Petar suggestion and added a string from object node before the Element.SetParameterByName and it worked!

Many thanks.

1 Like