0

I am Writing an app to find the position of the Revit links in the Project. I use the locationPoint but it gives 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);
            } 
      }

I expect to find the x, y, z of the Revit linked file

Uam
  • 3
  • 2

1 Answers1

0

Look at 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.

Jeremy Tammik
  • 7,333
  • 2
  • 12
  • 17