Reference to annotation familyinstance

Reference to annotation familyinstance

Anonymous
Not applicable
2,240 Views
16 Replies
Message 1 of 17

Reference to annotation familyinstance

Anonymous
Not applicable

Hi,

 

sorry for repeating the same subject again, but none of the solution in the forum or other place gave me a solution so far. I want to align an annotation symbol with a reference plane in a family document. Getting the reference of the reference plane is easy. But so far I couldn't find a way to get a reference of any valid object or geometry of the annotation family.

 

Found solutions so far:

Options options = new Options();
options.IncludeNonVisibleObjects = true;
options.ComputeReferences = true;
options.DetailLevel = ViewDetailLevel.Undefined;

GeometryElement geoElem = fi.get_Geometry(options);

 

geoElem returns me null.

 

If I do:

 

Options options = new Options();
options.IncludeNonVisibleObjects = true;
//options.ComputeReferences = true;     <--- is not allowed and throws error.
//options.View = v;

GeometryElement geoElem = fi.GetOriginalGeometry(options);

 

I get geometry and I can loop through all the lines and solids, but the geometry object have no reference (reference is null).

 

What does give me a reference is:

 

Reference r = Reference.ParseFromStableRepresentation(famdoc, fi.UniqueId);

 

but I can't use it, as it is not a valid reference for:

 

Dimension d1 = famdoc.FamilyCreate.NewAlignment(v, r, p.GetReference());

 

Maybe someone has an idea and could help me out, or the API team could get a method included to make that a bit easier as requested in this post:

 

http://forums.autodesk.com/t5/revit-api/create-dimension-get-references-to-familyinstances/td-p/4990...

 

2 years ago.

 

regards

Christian

 

PS:

 

If I change the code to:

 

Options geomOptions = f.Document.Application.Create.NewGeometryOptions();
geomOptions.IncludeNonVisibleObjects = true;
geomOptions.ComputeReferences = true;
//options.View = v;
geomOptions.DetailLevel = ViewDetailLevel.Undefined;

GeometryElement geoElem = f.Symbol.get_Geometry(geomOptions);

 

geoElem still returns null. (just thought this might work as found here: http://forums.autodesk.com/t5/revit-api/how-to-get-the-reference-of-a-planarface/m-p/6489839#M17855)

 

0 Likes
2,241 Views
16 Replies
Replies (16)
Message 2 of 17

jeremytammik
Autodesk
Autodesk

Dear Christian,

 

Did you notice that Scott Wilson described a workaround in the original post?

 

I recently published some of Scott Wilson's Reference Stable Representation Magic Voodoo and have since heard confirmation from other developers that it solves issue for them in this realm:

 

http://thebuildingcoder.typepad.com/blog/2016/04/stable-reference-string-magic-voodoo.html

 

Would you like to take a look at that too, both in the original discussion forum thread and The Building Coder post?

 

Please let us know how it works out for you and whether and how you can make use of it to address your task.

 

Thank you!

 

Cheers,

 

Jeremy



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

0 Likes
Message 3 of 17

Anonymous
Not applicable

Jeremy,

 

thanks for the quick respond. I have seen this code and it doesn't work for me. The issue is that:

 

GeometryElement geomElem = elem.get_Geometry(gOptions);

 

returns null. So I can't loop through the geometry and get a reference to one of the planarfaces.

 

Attached my annotation family. If you place this annotation in an family document and look at the object with revit lookup, it has no geometry, only original geometry, which can't be used as the geometry objects inside have no reference for some reason.

 

I hope the attached png explains a bit more.

 

regards

Christian

 

PS: Maybe there is something wrong with the annotation family.

0 Likes
Message 4 of 17

Anonymous
Not applicable

Jeremy,

 

can you please reach out to the development team and get this issue in front of them. I (we) need a solution for that. I have the whole family creation process automated, but this one alignment. Pretty annoying.

 

Would be great.

Thanks

Christian

0 Likes
Message 5 of 17

jeremytammik
Autodesk
Autodesk

Dear Christian,

 

Sure thing, no problem.

 

One quick further clarification before I raise a development issue for this:

 

Can you achieve your goal manually through the user interface?

 

If so, we still have a chance to find a workaround that you can use right away.

 

If not, it will probably require deeper investigation by the development team, and a wait.

 

Thank you!

 

Cheers,

 

Jeremy



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

0 Likes
Message 6 of 17

Anonymous
Not applicable

Yes I can. And I see the annotation listed in the Revit lookup tool. Just can't get the right reference in the API.

 

Thanks

Christian

0 Likes
Message 7 of 17

jeremytammik
Autodesk
Autodesk

Tadaa!

 

You have the solution right there.

 

RevitLookup is written using the official Revit API and nothing else.

 

If you see what you need in RevitLookup, it is API accessible, and you can debug through the steps perfomed by RevitLookup to see exactly how to navigate to it in your own code.

 

If you find that the hard-coded user interface navigation functionality provided by RevitLookup is not flexible enough for the powerful exploration you need, please use one of the other more intimate interactive database exploration tools available such as the Revit Python or Ruby shell:

 

http://thebuildingcoder.typepad.com/blog/2013/11/intimate-revit-database-exploration-with-the-python...

 

Cheers,

 

Jeremy

 

 



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

0 Likes
Message 8 of 17

Anonymous
Not applicable

Jeremy,

 

I can see the dimension (alignment) in the revit lookup, but that doesn't mean that I can set it thought the API. When I set the alignment in the UI the dimension is shown up, but I cant click the entry (revit lookup crashes).

 

Some more ideas to solve this?

 

Thanks

Christian

0 Likes
Message 9 of 17

jeremytammik
Autodesk
Autodesk

The very first thing I would suggest is to debug RevitLookup to see what exactly is causing the crash.

 

Normally, it is a simple matter of adding a one-line exception handler around the offending statement.

 

Here is a diff showing a typical example of such a minimal enhancement:

 

https://github.com/jeremytammik/RevitLookup/compare/2017.0.0.4...2017.0.0.5

 

Please determine what exception is being thrown and create a pull request on RevitLookup to handle it.

 

Maybe a specific property that you need to access is null.

 

On the other hand, you say that you see the required data in RevitLookup, so whatever it is you are after is in fact API accessible... or you would not see it at all.

 

Thank you!

 

Cheers,

 

Jeremy



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

0 Likes
Message 10 of 17

Anonymous
Not applicable

Jeremy,

 

the alignment is accessible (once create in the UI manually), but I still cant get a reference to the FamilySymbol to create the alignment.

 

I attached 3 images:

 

FamilySymbol_NoAlignment.pgn: The alignment is still not set and doesn't show up in the DB.

FamilySymbol_WithAlignment.pgn: The alignment is set and shows up in the DB.

ClickAlignmentinRevitLookup.pgn: RevitLookUp crashes and Revit comes with this error message.

 

Maybe some more ideas how to resolve this issue.

 

What I would like from the API team is:

 

FamilyInstance fi = famdoc.GetElement(f.Id) as FamilyInstance;
Reference r = fi.GetReference();

Is that possible?

 

Thanks

Christian

 

 

 

 

 

0 Likes
Message 11 of 17

jeremytammik
Autodesk
Autodesk

Dear Christian,

 

Thank you for your update and clarification.

 

I logged the issue REVIT-98103 [API unable to create reference to annotation family instance -- 12125288] with our development team for this on your behalf as it requires further exploration and possibly a modification to our software. Please make a note of this number for future reference.

 

You are welcome to request an update on the status of this issue or to provide additional information on it at any time quoting this change request number.

 

This issue is important to me. What can I do to help?

 

This issue needs to be assessed by our engineering team, and prioritised against all of the other outstanding change requests. Any information that you can provide to influence this assessment will help. Please provide the following where possible:

 

  • Impact on your application and/or your development.
  • The number of users affected.
  • The potential revenue impact to you.
  • The potential revenue impact to Autodesk.
  • Realistic timescale over which a fix would help you.
  • In the case of a request for a new feature or a feature enhancement, please also provide detailed Use cases for the workflows that this change would address.

 

This information is extremely important. Our engineering team have limited resources, and so must focus their efforts on the highest impact items. We do understand that this will cause you delays and affect your development planning, and we appreciate your cooperation and patience.

 

Cheers,

 

Jeremy



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

0 Likes
Message 12 of 17

Anonymous
Not applicable

Jeremy,

 

where do I have to go to provide this additional information? I really want to get this resolved as its the last missing piece in the puzzle.

 

Thanks

Christian

0 Likes
Message 13 of 17

jeremytammik
Autodesk
Autodesk

Dear Christian,

I escalated this thread to an ADN case 12125288 [Reference to annotation familyinstance] for you.

 

You can either submit the information here in this public forum thread, or answer the official ADN reply that I sent you from that case.

Thank you for your feedback!

 

Cheers,

Jeremy



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

0 Likes
Message 14 of 17

Anonymous
Not applicable

How can I check the status of the ADN case? I want to get references to an AnnotationSymbol so I could create linear dimensions to the AnnotationSymbol so it could be placed differently for each family type.

0 Likes
Message 15 of 17

jeremytammik
Autodesk
Autodesk

Dear Kevin,

 

You cannot check it yourself.

 

You are welcome to request an update on its status or to provide us with additional information at any time quoting the issue number REVIT-98103 [API unable to create reference to annotation family instance -- 12125288].

 

However, I can tell you the status right away:

 

REVIT-98103 was closed as a duplicate of REVIT-102253 in November 2016, because the latter covers everything in it.

 

REVIT-102253 [API access to family instance references corresponding to ref planes and lines in family] was also closed as 'Fixed' in December 2016.

 

As far as I can tell from that, you can solve your problem by adding all the required reference planes and lines to the family definition.

 

Cheers,

 

Jeremy



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

0 Likes
Message 16 of 17

Anonymous
Not applicable

Hey Jeremy,

 

Thanks for the response.

 

How do bug fixes work with Revit API releases? Since REVIT-102253 was fixed in December 2016, is the fix in the most recent Revit build after December 2016? I'm assuming Revit API releases correspond with the Revit release builds.

https://knowledge.autodesk.com/support/revit-products/downloads/caas/downloads/content/autodesk-revi...

In this case, that would be 2016.1.8 released on April 17, 2017.

Or would the bug fix be in later releases or revit - 2017 or 2018?

 

Unfortunately, I am developing for Revit Architecture 2016 Build 16.0.428.0 - 20150220_1215(x64), so I think it doesn't have the bug fix because it's too old.

 

If I did have the fix, how would I get the reference to the Line that corresponds to the "Defines Origin" ReferencePlanes in the AnnotationSymbol?

 

AnnotationSymbol is a subclass of FamilyInstance so I can use get_Geometry() or GetOriginalGeometry(). However, get_Geometry() returns null for AnnotationSymbol as described in the documentation under "Remarks":

"a null reference ( Nothing in Visual Basic) will be returned for symbols, annotations or details"

The latest 2018.1 API says the same thing.

 

So that eliminates the use of get_Geometry(), so I try to use GetOriginalGeometry(). However, the documentation says "Note that ComputeReferences may not be set to true" under "Parameters". The latest 2018.1 API says the same thing.

 

So the following is the current code I have. Notice that I set ComputeReferences to false, because I am using GetOriginalGeometry() and will get an error if I set it to true. I am able to find the Lines that correspond to the "Defines Origin" ReferencePlanes but unable to get the References because they aren't computed.

 

ViewPlan viewPlan = RevitUtilities.GetFloorPlan(document, "Ref. Level");
Options options = new Options(); options.IncludeNonVisibleObjects = true;
options.ComputeReferences = false; // true will error options.View = viewPlan; IEnumerable<Line> enumerableLines = familyInstance.GetOriginalGeometry(options) .Where(geometryObject => geometryObject is Line) .Cast<Line>(); Line refPlaneLineLeftRight = enumerableLines.First ( line => line.Direction.IsAlmostEqualTo(new XYZ(1.0, 0.0, 0.0)) || line.Direction.IsAlmostEqualTo(new XYZ(-1.0, 0.0, 0.0)) ); Line refPlaneLineFrontBack = enumerableLines.First ( line => line.Direction.IsAlmostEqualTo(new XYZ(0.0, 1.0, 0.0)) || line.Direction.IsAlmostEqualTo(new XYZ(0.0, -1.0, 0.0)) );
Reference refPlaneLineLeftRightReference = refPlaneLineLeftRight.Reference; // null
Reference refPlaneLineFrontBackReference = refPlaneLineFrontBack.Reference; // null

 

Here are some RevitLookup images showing the same problem:

I am using a family with an imported Generic Annotation Family. I will be creating a LinearDimension. I want to be able to create the LinearDimension programmatically but am unable to because I can't get the Line References. However, I can see the References after creating the LinearDimension.

The family is attached.

UI can see ReferencePlane Line ReferenceUI can see ReferencePlane Line Reference

Create a LinearDimensionCreate a LinearDimensionAnnotationSymbol has null Geometry but has OriginalGeometryAnnotationSymbol has null Geometry but has OriginalGeometryOriginalGeometry has null Reference for LineOriginalGeometry has null Reference for LineThe LinearDimension has the Line Reference in its ReferenceArrayThe LinearDimension has the Line Reference in its ReferenceArray

 

 

How would the bug fix allow me to get the Reference to the Line? I know Revit 2018 API has an improved way to get References instead of finding them through the geometry such as GetReferences() and GetReferencesByName() but I don't know if this is supposed to be the fix of REVIT-102253.

0 Likes
Message 17 of 17

jeremytammik
Autodesk
Autodesk

Dear Kevin,

 

Thank you for your update and explanation.

 

It is not possible to determine what versions of Revit include a specific fix without reading and understanding the detailed release notes. I would have to ask the development tam specifically. This fix certainly did not make it into any Revit 2016 versions.

 

I think the new functionality enables you to retrieve references on the family instance to any and all reference planes and lines specified in the family definition.

 

Cheers,

 

Jeremy



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