Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

find position of Revit link

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
1639 Views, 3 Replies

find position of Revit link

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;
                    RevitLinkType linkType = myDoc.GetElement(ins.GetTypeId()) as RevitLinkType;
                    LocationPoint pn = linkType.Location as LocationPoint;
                if (null != pn)
                {
                    TaskDialog.Show("rvt", "location " + pn.Point.X + "     " + pn.Point.Y + "    " + pn.Point.Z);
                }
            }
3 REPLIES 3
Message 2 of 4
jeremytammik
in reply to: Anonymous

Select your link in RevitLookup and explore its properties.

 

Does it have a Location property?

 

If so, you can access that through the API.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 4
jeremytammik
in reply to: Anonymous

I just noticed your identical question on StackOverflow and provided another answer there which may help further:

  

https://stackoverflow.com/questions/55556024/how-to-find-the-position-of-a-linked-revit-file

 

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.

 

Cheers,

 

Jeremy

 

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 4 of 4
jeremytammik
in reply to: Anonymous

oops, answered the wrong thread by mistake, please ignore, cannot delete answer, just edit...

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report