Ser Rebar Cover - Exterior Face

I am trying to set parameter “Rebar Cover - Exterior Face” to a wall.
I can get this parameter but when i try to Set it to a different value it gives me this error: “1. Failed to cast from Text to ElementId.”


I tried to assign a value that i got from another element but the error changed to “1. Failed to cast from Parameter Value to ElementId.”

Hi,

Could you share your model and definition, so we can simulate your error on our side?

Thank you for your reply.
Sure… In the grasshopper file i internalised the data but there is also the revit file if you want to open it too.
Project1.rvt (6.7 MB) Script.gh (9.3 KB)

hey @drilonshabani,

I have looked into your file. RebarCover Exterior parameter looks like a select parameter. There are options and you can select only one of them. Since it is not a text or number parameter, I haven’t been able to solve this issue.

Thank you for looking into it.
Maybe @eirannejad can suggest something?

Rebar Cover Types are DB.Structure.RebartCoverType in Revit API and they are actually a kind of element types. The “Rebar Cover - Exterior Face” parameter doesn’t store the name. It stores the element id to the rebar type - hence the error “can not convert from text to element id”

Revit_1aqWRq0szf

You need to query these types and provide that as the input to parameter setter. I’m showing two methods of querying here. One using the API type and a value selector, and another using a custom python component:

Script.gh (17.0 KB)

1 Like

Works perfectly.
Thank you very much!

1 Like