4 Replies Latest reply on May 10, 2018 5:31 AM by J. R.

    Finding the maximum cross-sectional area of a body along an axis (VB.NET)

    J. R.



      I'm having an advanced problem that I'm unable to solve with my current knowledge. I have a body in a model, and my goal is to find the maximum cross-sectional area of that body along the Z axis via VB.NET macro. There might be some other bodies around, so the macro must evaluate that particular body only.


      A screenshot for illustration purposes:




      I placed the Plane 1 at the location where I know the maximum cross-sectional area is, but the plane is just for illustration purposes. For a different model or a different shape, that maximum cross-section might be somewhere else along the Z axis. I need my macro to find that spot on it's own, and tell me the location and area values of that cross-section with a reasonable precision.


      I'm actually doing this with virtual bodies to speed things up. The closest solution I could think of was measuring the boundaries of the model, slicing it into, say 100 slices, and measuring area of each slice to find the one with the largest area. But this is a very crude method, I'm sure there's a more elegant one. I also thought of producing an outline (shadow) of the body on a plane, and measuring it's area, but with certain body shapes, this might produce inaccurate results. Bottom line, I want avoid using features and sketches at all costs.


      I would be grateful if you could suggest some ideas.


      Thanks in advance!

        • Re: Finding the maximum cross-sectional area of a body along an axis (VB.NET)
          Terry Raymond

          Wow that is an interesting and seemingly difficult problem to solve, especially if there are no predefined conditions on the shape of the body.


          If the bodies can have complex profiles (moon shapes, hollow, etc), your described method is probably best. You might add an iteration to zero in on the largest cross section.


          If above is too slow, and your profiles are solid and aren’t too crazy, take a look at Body2::GetExtremePoints.  You could run that in a few directions to get an idea where the largest cross section is located, and then check those and nearby cross sections for the largest.