'Duct hanger - place family instance Revit API
i'm trying to place a family using the API (c#).
When using the NewFamiltInstace overloaded method that takes (location, symbol,host, level, structural) - i'm expecting to get the instance of the hanger family in the level i have inserted, and in the elevation of the host ( the duct).
instead - i get the duct hanger in the ground floor no matter what i'm doing, can any one understand why, and what sholud i do to get it in the desired level?
- tried multiple overloaded methods, tried using the duct as a host, the level as a host etc.. the hangers always show up at the floor of ground level.
the code from my transaction: '''
using (Transaction trans = new Transaction(doc, "Place Family"))
{
trans.Start();
int indx = 0;
foreach (XYZ hanger_xyz in hangerCoordinates)
{
if (!hangerSymbol.IsActive)
{
hangerSymbol.Activate();
}
doc.Create.NewFamilyInstance(hanger_xyz, hangerSymbol,duct,level, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
}
trans.Commit();
}
'''
Solution 1:[1]
Please study the Revit SDK sample FabricationPartLayout. That will solve your problem. The samples are available from the Revit Developer Center.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Dharman |

