find position of Revit link
Not applicable
04-06-2019
11:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to find the position of Linked Revit models in my Project. The locationPoint gives null and I couldnot
find the position.
FilteredElementCollector collector = new FilteredElementCollector(myDoc);//
collector.OfClass(typeof(Instance)).OfCategory(BuiltInCategory.OST_RvtLinks);//RevitLinkType
foreach (Element elLink in collector)
{
Instance ins = elLink as Instance;
{
Instance ins = elLink as Instance;
RevitLinkType linkType = myDoc.GetElement(ins.GetTypeId()) as RevitLinkType;
LocationPoint pn = linkType.Location as LocationPoint;
LocationPoint pn = linkType.Location as LocationPoint;
if (null != pn)
{
TaskDialog.Show("rvt", "location " + pn.Point.X + " " + pn.Point.Y + " " + pn.Point.Z);
}
{
TaskDialog.Show("rvt", "location " + pn.Point.X + " " + pn.Point.Y + " " + pn.Point.Z);
}
}
Link copied