How to draw a bounding box for a clashresult?

How to draw a bounding box for a clashresult?

preeti.kumari9TBN6
Enthusiast Enthusiast
368 Views
4 Replies
Message 1 of 5

How to draw a bounding box for a clashresult?

preeti.kumari9TBN6
Enthusiast
Enthusiast

How to draw a bounding box for a clashresult which we can see?

0 Likes
369 Views
4 Replies
Replies (4)
Message 2 of 5

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi,


I believe the following link will be helpful to you. Please note that the sample code in the link is not properly formatted and appears as a single line; however, it is functional.
Link: https://blog.autodesk.io/navisworks-2014-api-new-feature-toolplugin/ 

The code works as follows: when you select an element, it draws a cuboid around it using graphics.Cuboid().
You can use a similar approach in your workflow.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 3 of 5

alexisDVJML
Collaborator
Collaborator

Hi @naveen.kumar.t ,

A bit of a similar question.

How to draw a full plane?
I don't see methods in Graphics class to do this.
I could try to use Rectangle(Point3D origin, Vector3D xVector, Vector3D yVector, [MarshalAs(UnmanagedType.U1)] bool filled) by clipping the plane to the document space/full bounding box but this seems both inefficient and overkill (+ not even sure it will work).

And @preeti.kumari9TBN6,

If you repeatedly draw the same bounding box, you will get a bit of performance boost by storing the point and the 3 vectors for each since these are classes in Navisworks that are not performance free to create and got freed a bit randomly based on my experience 😉 
 

Main Scientist, Full Stack Developer & When Time Permits Director of IDIGO ► On your marks, Set, Go
0 Likes
Message 4 of 5

lanneauolivier
Advocate
Advocate

Hi @alexisDVJML,

 

What's the problem with your plane ? This is the way to draw planes.

Boundingbox3D box = doc.BoundingBox(true)
double x = 100;
graphics.Rectangle(new Point3D(x, box.Min.Y, box.Min.Z); new Point3D(x, box.Max.Y, box.Max.Z));

This draws a plane at X clipped on document boundingBox

Message 5 of 5

alexisDVJML
Collaborator
Collaborator

Thanks Olivier,

That was also my backup plan (pun intended 😁). except I didn't realize have this simpler method.
I didn't realize there is this slightly simpler method, so I will use it !

My plugin render literally thousands of mid-complexity stuff so any cycle is important.
And this method requires having document bounds (I can cache this one) and creating 2 points (I actually bypass this but this is another story).
But agree, this is marginal compare to the other stuff I render: pipe markers, cartouche with details of those, zones ... or I generate using nwcreate. A few screenshot attached

So I will go for it while trying to see if I can emulate a bit what the sectioning gizmo is doing aka reducing the displayed plane so it fit into the view, easier to visualize it then if it fill the whole space.

alexisDVJML_0-1766476323231.png

alexisDVJML_1-1766476336449.png

alexisDVJML_2-1766476344493.png

alexisDVJML_3-1766476361424.png

 

 

 

 




Main Scientist, Full Stack Developer & When Time Permits Director of IDIGO ► On your marks, Set, Go
0 Likes