Return Reference to Location

Return Reference to Location

Mark.Ackerley
Advocate Advocate
339 Views
2 Replies
Message 1 of 3

Return Reference to Location

Mark.Ackerley
Advocate
Advocate

Hi All,

 

Thanks in advance for your help.

 

I am  using Python (in Dynamo but this seemed more of an API question, apologies if it is out of place).

I'm trying to place families along pipes from a linked file. 

The pipes can be horizontal or vertical. 

I want to place the family centered on the the pipe location line.

I am looking to use this new family by instance method  https://www.revitapidocs.com/2018/4545a04f-b5e8-1921-5a4c-d734bc4874ca.htm

 

I know that I can set my Revit view to Coarse and Tag the Geometry (which appears to be the location line, I don't seem able to return this model line from the element geometry, only a solid).

 

However, when I try to return References to the linked Element, I appear only to be able to return them from the Element Solid Faces / Edges.  If I create family from these, it fails because the placemenet / location line is not on the Reference (surface). 

 

I can possibly establish the Face / Edge which aligns with the placement / location line, place my family and shift it back, but it seems incongruous.

 

I would be very grateful if anyone had a suggestion for how to return the Reference to the Location Line (which I am able to use for Tagging).

 

This link seemingly manages to tag an element without needing to return solids, but it seems to fail in Python, and the API doesn't have a create reference method, so I am obviously not understanding something! https://thebuildingcoder.typepad.com/blog/2019/05/tagging-a-linked-element.html

 

 

All assistance greatfullly received.

 

Mark

0 Likes
340 Views
2 Replies
Replies (2)
Message 2 of 3

zrodgersTSSSU
Advocate
Advocate

Is there a reason it has to be a reference. Could you just get the pipes location curve then use that as the placement point for the tag? Something like:

 

foreach (ElementId elemId in selectedIds)
                {
                    Element elem = uidoc.Document.GetElement(elemId);

                    Curve eleCurve = (elem.Location as LocationCurve).Curve;

                    //evaluate curve

                } 

 

 

Then get the midpoint or evaluate at a certain distance. 

 

 

Message 3 of 3

Mark.Ackerley
Advocate
Advocate

Hi,

 

Thanks for your response.

 

I actually found that I had to use a face reference to place a line-based family, so I didn't pursue this any further.

 

Kind regards,

 

Mark

0 Likes