我正在编写一个应用程序来查找项目中Revit链接的位置。我使用locationPoint但它给出了null。 Ť
FilteredElementCollector collector = new FilteredElementCollector(myDoc);//
collector.OfClass(typeof(Instance)).OfCategory(BuiltInCategory.OST_RvtLinks);
foreach (Element elLink in collector)
{
Instance ins = elLink as Instance;
RevitLinkType linkType = myDoc.GetElement(ins.GetTypeId()) as RevitLinkType;
LocationPoint pn = linkType.Location as LocationPoint;
TaskDialog.Show("rvt", "Name " + linkType.Name);
if (null != pn)
{
TaskDialog.Show("rvt", "location " + pn.Point.X + " " + pn.Point.Y + " " + pn.Point.Z);
}
}
我希望找到Revit链接文件的x,y,z
看看The Building Coder对Determining Host Document Location of a Linked Element的讨论:
RevitLinkInstance
派生自Instance
类,它是所有实例对象的基类。它提供了方法GetTransform
,用于检索实例的变换,以及GetTotalTransform
,包括真正的北变换。