风管吊架 - 放置族实例 Revit API
我正在尝试使用 API (c#) 放置一个家庭。
当使用采用(位置、符号、主机、级别、结构)的 NewFamiltInstace 重载方法时 - 我期望在我插入的级别以及主机(管道)的标高中获得衣架系列的实例。
相反 - 我在一楼得到了管道吊架,无论我在做什么,有人能理解为什么吗?我应该做什么才能让它达到所需的水平?
尝试了多种重载方法,尝试使用管道作为主机,水平仪作为主机等。吊架总是出现在地面的地板处。
我的交易代码:
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();
}
'''
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();
}
'''
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
想通了。
在测试了 newFamilyInstance 的所有 11 个重载方法及其所需参数,并使用 RevitLookUp 进行窥探后,我设法获得了正确的重载方法,即:
face==>;作为引用对象(从我从所需级别的地板获得的 GeoElement 获得的面中提取)
hanger_xyz==> XYZ 位置
new XYZ(0,1,0)==>家庭连接到 cielling 主机时的方向(从 revitLookUp 获取)
hangerSymbol ==>家庭的象征。
figured it out.
After testing all of the 11 overloaded methods for newFamilyInstance and their required arguments, and snooping around with RevitLookUp, i managed to get the right overloded method which is:
face==> as a Referemce object (extracted it from a face Face that i got from a GeoElement that i got from the desired level's floor)
hanger_xyz==>an XYZ location
new XYZ(0,1,0)==> a direction of the family as it is when it's attached to a cielling host ( got it from revitLookUp)
hangerSymbol ==> the familysymbol.