如何查找链接的 Revit 文件的位置

How to find the position of a linked Revit file

我正在编写一个应用程序来查找 Revit 链接在项目中的位置。我使用 locationPoint 但它给出 null。 T

      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 discussion of Determining Host Document Location of a Linked Element

RevitLinkInstance is derived from the Instance class, the base class for all instance objects. It provides the methods GetTransform, to retrieve the transform of the instance, and GetTotalTransform that includes the true north transform as well.