Cannot retrieve geometry for an annotation symbol

Cannot retrieve geometry for an annotation symbol

Anonymous
Not applicable
1,282 Views
3 Replies
Message 1 of 4

Cannot retrieve geometry for an annotation symbol

Anonymous
Not applicable

 

I've been able to use get_geometry() to get GeometryObjects (and their references) from a FamilyInstance without to much trouble.

 

Is there a way to get the GeometryObjects from within a AnnotationSymbol?

 

Each time I bring in an AnnotationSymbol and use get_geometry() it returns null so I cannot use GetSymbolGeometry() on an GeometryInstance because none exist.

 

Below is the code used so far:

 

 

double ftMM = 1 / 304.8; // Feet to Millimetres

FamilyInstance connectedLoadInstance = doc.Create.NewFamilyInstance(new XYZ(0, 50, 0) * ftMM, connectedLoadFamily, draftView);

doc.Regenerate();

Options opt = new Options();
opt.ComputeReferences = true;
opt.IncludeNonVisibleObjects = true;
opt.View = doc.ActiveView;

connectedLoadInstance.get_geometry(opt); // This returns null

 

The purpose of wanting the geometry inside the AnnotationSymbol is to use newAlignment() on the reference planes within them with a Detail Line in the currently project drafting view.

 

 

I can move the Generic Annotation into a Detail Item and use that to be able to do what I need since geo_geometry() gets the GeometryInstance correctly and I can use the center reference plane to do a newAlignment() fine.

 

Is there a way to get the GeometryObjects in an AnnotationSymbol?

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

ollikat
Collaborator
Collaborator
Just a couple of things that came into my mind:

1. Have you tried to commit the transaction after using NewFamilyInstance(). Now you do have Regenerate, but sometimes it might not be sufficient.
2. Have you checked corresponding element with lookup tool? From there you are able to see the geometry structure, if there's one.
0 Likes
Message 3 of 4

Anonymous
Not applicable

Both these paths produced the same issue, commiting the transation and then using the get_geometry still produced a null GeometryElement.

 

I've used the revitLoopUp Add-in and it shows all the geometry is there (lines, solids, etc).

 

Weird thing is I can use the get_OriginalGeometry() and it will return the geometry, but that method won't allow references to be obtained.

0 Likes
Message 4 of 4

Anonymous
Not applicable

I have the same issue and I am trying to get a valid reference to a FamilyInstance in a family document to an annotation:

 

private static Result Align(Document famdoc, FamilyInstance f, ReferencePlane p, View v)
{
   try
   {

      Dimension d1 = famdoc.FamilyCreate.NewAlignment(v, Reference.ParseFromStableRepresentation(famdoc, f.UniqueId), p.GetReference());

      return Result.Succeeded;
   }
   catch (Exception ex)
   {
      MessageBox.Show(ex.ToString());
      return Result.Failed;
   }
}

 

Why is this so hard? The only thing I want to do is that little click (see image - AlignmentClick.pgn). 

 

regards

Christian

 

0 Likes