简体   繁体   English

管道衣架 - 放置族实例 Revit API

[英]Duct hanger - place family instance Revit API

i'm trying to place a family using the API (c#).我正在尝试使用 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).当使用采用 (location, symbol, host, level, structural) 的 NewFamiltInstace 重载方法时 - 我希望在我插入的级别和主机(管道)的高程中获得衣架系列的实例.

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();
}

''' '''

在此处输入图像描述

Please study the Revit SDK sample FabricationPartLayout .请研究 Revit SDK 示例FabricationPartLayout That will solve your problem.这将解决你的问题。 The samples are available from the Revit Developer Center .这些示例可从Revit 开发人员中心获得。

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:在测试了 newFamilyInstance 的所有 11 个重载方法及其所需的 arguments,并使用 RevitLookUp 进行探听后,我设法获得了正确的重载方法,即:

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) face==> 作为参考 object (从我从所需级别的地板获得的 GeoElement 获得的 face Face 中提取它)

hanger_xyz==>an XYZ location hanger_xyz==>一个 XYZ 位置

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)新的 XYZ(0,1,0)==> 家庭的方向,因为它连接到 cielling 主机(从 revitLookUp 获得)

hangerSymbol ==> the familysymbol. hangerSymbol ==> 家族符号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM