Get Specific Reference from Family

Get Specific Reference from Family

swfaust
Advocate Advocate
3,994 Views
3 Replies
Message 1 of 4

Get Specific Reference from Family

swfaust
Advocate
Advocate

Is it possible to get a named reference plane from a family without going into the family editor API?

 

For example, I would like to have users be able to name a reference plane 'my arbitrary location' when they are creating a family in the family editor.  Then when it's loaded in the project, I would like to find an instance of it and be able to find the 'my arbitrary location' in the project and use that location data for other things in relation to the placement in the project.

 

I've seen this post: http://thebuildingcoder.typepad.com/blog/2015/05/how-to-retrieve-dimensioning-references.html but that basically says you would have to use some type of geometry analysis to figure out if it's the correct one or not.  Unfortunately it's user (or at least company) specific and varied so there is no way to identify it geometrically, but it would be easy for the user to label the reference plane with a name if I could get that data out...

0 Likes
3,995 Views
3 Replies
Replies (3)
Message 2 of 4

jeremytammik
Autodesk
Autodesk

Dear Stephen,

 

Thank you for your query.

 

I believe you are in luck.

 

Here are some notes from a previous case, 12730663 [Create dimension for detail items in drafting view]:

 

[Q] I want to dimension the detail item in drafting view. But the geometry of the family instance only can be retrieved by GetOriginalGeometry method, and there is any reference can be got. How can I add the dimension to detail items by API?

 

[A] For Revit 2018, we have new capabilities to get the standard references for family instances. I haven’t tested specifically with detail items, but I believe this should work for them as well:

 

Check out the section 'API access to FamilyInstance references' in What's New in the Revit 2018 API:

 

http://thebuildingcoder.typepad.com/blog/2017/04/whats-new-in-the-revit-2018-api.html#3.19

 

The following new methods have been added to enable easy access to FamilyInstance references that correspond to reference planes and reference lines in the family. Some use the options in the new enumeration FamilyInstanceReferenceType as input to identify "Strong" or "Weak" references or specific positional references in each of the 3 coordinate directions (as determined by the possible values of parameter "Is Reference" of reference planes and parameter "Reference" of reference lines in families).

 

  • FamilyInstance.GetReferences()
  • FamilyInstance.GetReferenceByName()
  • FamilyInstance.GetReferenceType()
  • FamilyInstance.GetReferenceName()

 

Prior to 2018, I don’t believe there is a technique to get at the available references.

 

An older case 11909355 [Parametric family instance placement] gave rise to the wish list item CF-1271 [API wish: need a way to relate view specific geometry in project with particular ref plane in family] which has now been closed as fixed.

 

I hope this helps.

 

It would be very kind of you if you would like to put together and share a minimal example showing how you make use of this for future reference.

 

Thank you!

 

Best regards,

 

Jeremy



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

0 Likes
Message 3 of 4

jeremytammik
Autodesk
Autodesk

Dear Stephen,

Since this appears to be a very common question, I edited and published it on The Building Coder as well:

 

http://thebuildingcoder.typepad.com/blog/2017/05/api-access-to-family-instance-references.html

I hope this helps.

As said, it would be great if you would like to put together and share a minimal example showing how you make use of this for future reference.

Thank you!

Best regards,

Jeremy



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

0 Likes
Message 4 of 4

swfaust
Advocate
Advocate

ok great!  I will check out those new methods but that looks to be exactly what I need, thank you!

0 Likes