I have a script that converts elements from one family/type to another. It’s converting them over, but it’s not setting the params. It keeps saying the parameters can’t be found. I’ve actually cut and pasted the param names to make sure they’re correct. Can anyone point out what I am missing?
Thanks!
It’s probably a difference of type vs instance parameters. Instance parameters have to be set for the family instance and type parameters have to be set for the family type. Make sure you’re using the correct one for each parameter.
The only time I’m setting params is for type-based. I get the param values from the instance-based. Once the element has its type set to the one with the type-based params, shouldn’t it pick up the params that now belong to that element? Is Element.SetParameterByName not what is used for that scenario?
You set the family type but then get the family instance back. Now you’re trying to set a type parameter for a family instance, which won’t work. You need to get the family type after you’ve changed it.
Ah, I gotcha. I have to run Element.SetParameterByName on the element’s type. Got it.
Now a new error I wasn’t getting before. On the archilab ElementTypes.Duplicate:
Warning: ElementTypes.Duplicate operation failed. The call is ambiguous between the following methods or properties: 'Revit.Elements.ElementWrapper.Wrap(Autodesk.Revit.DB.Material, bool)' and 'Revit.Elements.ElementWrapper.Wrap(Autodesk.Revit.DB.FamilyInstance, bool)'
I’ve never seen that error before when using that node. Weird.