AreElementsValidForMultiReferenceAnnotation?

AreElementsValidForMultiReferenceAnnotation?

MiguelGT17
Advocate Advocate
491 Views
3 Replies
Message 1 of 4

AreElementsValidForMultiReferenceAnnotation?

MiguelGT17
Advocate
Advocate

Greetings from South America, My colleagues wish to label a variety of set of rebar so my first concern is if there is an API function from the Multi-reference annotation class that can filter whether a rebar can be tagged or not. 

For example, I have this set of rebar

MiguelGT17_0-1651718368596.png and when I hit the multi-rebar tool from Revit interface:

MiguelGT17_1-1651718694163.pngthe rebar is not highlighted nor the annotation tag is enabled as it has a wear distribution path with respect to the current view direction.

 

I thought this next function will do the work for me but it returns true no matter the orthogonal criteria between the dimension line direction and the dimension plane normal (view Direction):

 AreElementsValidForMultiReferenceAnnotation()

this is a test code:

 

			foreach (Element element in rebars) {
				if (element is RebarContainer) {
					
				}
				else if (element is Rebar) {
					options.SetElementsToDimension(new List<ElementId>{element.Id});
					
					BoundingBoxXYZ rebBB=element.get_BoundingBox(view);
					if (rebBB == null) {
						continue;
					}
					XYZ midPoint=(rebBB.Max + rebBB.Min)/2;//Standard Revit coordinates
					
					options.DimensionLineOrigin=midPoint;
					options.DimensionPlaneNormal=view.ViewDirection;
					options.DimensionLineDirection=view.ViewDirection;

					TaskDialog.Show("REBAR",MultiReferenceAnnotation.AreElementsValidForMultiReferenceAnnotation(doc,options).ToString());
				}
			}
			
		}

 

I have set intentionally both the DimensionPlaneNormal and DImensionLineDirection as the ViewDirection, and that function returns True anyway, which in turns must be false as those vector have to be orthogonal to each other.

 

In summary, If the user interface recognize on which rebar enable the multi-rebar annotation tool, which method from the API reproduce that action. This feature is important to me so I can know when to go for an independent tag to annotate rebars, among other utilities.

 

Cheers, best regard

0 Likes
492 Views
3 Replies
Replies (3)
Message 2 of 4

jeremy_tammik
Alumni
Alumni

This sounds like a request for some in-depth rebar API expertise beyond my limited ken, so I asked the devteam for you.

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 3 of 4

MiguelGT17
Advocate
Advocate

Really glad you are willing to help us with this matter. Those previous post come together and will provide us good tools to automatize a tedious task. Thanks Captain!

0 Likes
Message 4 of 4

MiguelGT17
Advocate
Advocate

Any insights on how to appropriately query whether I can place multi-rebar annotations on rebars regarding its distribution path with respect to current view, Since 

 AreElementsValidForMultiReferenceAnnotation()

it's analyzing a different stuff I believe.

 

And Indeed, Revit is capable of knowing when to enable the multi-rebar annotation 

MiguelGT17_0-1652197789147.pngMiguelGT17_3-1652198031287.png

 

But I cant because the database do not house the distribution path of this straight free form rebar 

MiguelGT17_2-1652197897546.pngMiguelGT17_1-1652197816295.png

So what might be the command that enables the usage of multi-rebar annotation on the active view?

 

Best Regards

0 Likes