Hi All,
Can someone please advise how to assign the structural material to an instance created from a generic model family, type set to Framing? I've tried a few like property StructuralMaterialId or BuiltInParameter.MATERIAL_ID_PARAM
with no luck. I can manually set it.
I can post a revit file if needed.
Thanks in advance,
Jon
Solved! Go to Solution.
Solved by saikat. Go to Solution.
I too am struggling with this issue. I've got a framing family composed of multiple nested generics that all have associated material parameters. I need to be able to assign/change the material through the API. I can do it manually though the UI, and it works beautifully. It's just a giant pain in the --- to keep having to do it this way.
Here is something I tried quickly and it seemed to work fine. For testing purposes, I have hard coded the 'Carbon Steel' material ID in the code and used that ElementId in the material assignment process:
UIApplication uiApp = commandData.Application;
UIDocumentuiDoc = uiApp.ActiveUIDocument;
foreach (Element ele in
uiApp.ActiveUIDocument.Selection.Elements)
{
FamilyInstance box = ele asFamilyInstance;
if (null!= box)
{
using (Transaction trans = newTransaction(uiDoc.Document, "SetMaterial"))
{
trans.Start();
box.get_Parameter(
BuiltInParameter.STRUCTURAL_MATERIAL_PARAM).Set(newElementId(164753));
trans.Commit();
}
}
}
and eventually was able to see this:
Can't find what you're looking for? Ask the community or share your knowledge.