Calculate tag width and height in 3D view

nasirodin
Participant
Participant

Calculate tag width and height in 3D view

nasirodin
Participant
Participant

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

0 Likes
Reply
180 Views
1 Reply
Reply (1)

jeremy_tammik
Autodesk
Autodesk

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