Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Calculate tag width and height in 3D view

1 REPLY 1
Reply
Message 1 of 2
nasirodin
138 Views, 1 Reply

Calculate tag width and height in 3D view

I want to calculate the width and height of tags in a 3D view( the orientation of the view is locked for tagging)
My approach is to get the tag bounding box and calculate the transformed Min and Max point using "ViewTransform.Inverse" and use the new Min, and Max values to calculate the height and width of the tag. but it's not working and apparently, I'm missing something

For example, I have the following values :
original tag bounding box (have different values for Z, which make sense because the owner view is a 3d view) :
{
min:{(-47.074143208, -15.850938760, -40.609650058)} ,
max:{(-41.774670872, -10.914666422, -37.766495175)}
}
using _viewTransform.Inverse.OfPoint() function I calculate the new Min, and Max points :
{
min:{(-47.156694713, -18.400440257, -39.421324664)} ,
max:{(-39.954705195, -15.824059362, -37.997130226)}
}
but the transformed points still have different values on "Z" which does not make sense to me, because I expect that using _viewTransform.Inverse these points transformed into a 2D plane instead of a 3D plane

1 REPLY 1
Message 2 of 2
jeremy_tammik
in reply to: nasirodin

Here is an example showing how to successfully transform a 3D polygon into a 2D space to calculate its area:

  

  

You can apply the same approach to the appropriate ("front") face of your bounding box to determine the width and height of your tag.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Rail Community