风管吊架 - 放置族实例 Revit API

发布于 2025-01-12 00:01:19 字数 811 浏览 0 评论 0原文

我正在尝试使用 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();
}

'''

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

白昼 2025-01-19 00:01:19

想通了。

在测试了 newFamilyInstance 的所有 11 个重载方法及其所需参数,并使用 RevitLookUp 进行窥探后,我设法获得了正确的重载方法,即:

FamilyInstance familyInstance = doc.Create.NewFamilyInstance(face, hanger_xyz, new XYZ(0, 1, 0), hangerSymbol);

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:

FamilyInstance familyInstance = doc.Create.NewFamilyInstance(face, hanger_xyz, new XYZ(0, 1, 0), hangerSymbol);

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文