Calculate the ModelItem Bounding Box Directions using Navisworks API

Calculate the ModelItem Bounding Box Directions using Navisworks API

amitabhVA4SD
Advocate Advocate
217 Views
2 Replies
Message 1 of 3

Calculate the ModelItem Bounding Box Directions using Navisworks API

amitabhVA4SD
Advocate
Advocate

Hi,

 

I am trying to draw a Bounding Box on clicking the Model Item but this is not working properly for oriented model items.
Is there a way to transform the bounding box to correctly display it?

 

Thanks,

Amitabh

//boundingbox of the current selection
                BoundingBox3D boundingBox = clickedModel.BoundingBox();
                //Returns the Transform attached to this item in the original source design file 
                Transform3D modelTransform = clickedModel.Transform;
                Point3D origin = boundingBox.Min;
                Vector3D xVector = new Vector3D((boundingBox.Max.X - boundingBox.Min.X), 0, 0);
                Vector3D yVector = new Vector3D(0, (boundingBox.Max.Y - boundingBox.Min.Y), 0);
                Vector3D zVector = new Vector3D(0, 0, (boundingBox.Max.Z - boundingBox.Min.Z));
                double X = boundingBox.Max.X - boundingBox.Min.X;
                double Y = boundingBox.Max.Y - boundingBox.Min.Y;
                double Z = boundingBox.Max.Z - boundingBox.Min.Z;

                //draw a cuboid
                graphics.Cuboid(origin, xVector, yVector, zVector, false);

 

218 Views
2 Replies
Replies (2)
Message 2 of 3

ahmedsalahtester01
Observer
Observer

good morning @amitabhVA4SD 

it's not clear what you want to achieve, what do you mean by oriented model?

if the bounding box you need is not aligned with the model can you share a screenshots for what you want to achieve, sharing at least two pictures is necessary in order to understand the difference between the two cubes (the one you want to achive and the wrong wone)

 

 

 

Message 3 of 3

essam-salah
Collaborator
Collaborator

hi @amitabhVA4SD 

have your problem solved? or can you provide us with some screen shots demonstrate your problem and solution

0 Likes