Is there a way to do with C# the same that the Plane Through Shape component does?
The Plane Through Shape component is C#, so yes, it’s possible.
Do you want to create a plane that extends beyond the boundingbox of the shape as a whole, or do you want to create the smallest possible plane which is still bigger than the specific section?
I would like to do exactly the same: a function that receives the shape, the plane and the boundary inflation and returns the rectangle. Is there already a function to do that?
I think it is
- Get bounding box of object
- Inflate bounding box (parameter t)
- Move plane to center of bbox
- Intersect plane with bbox
- Move that intersection curve back to original plane
The quick way is to get the bounding-box of the shape, project all 8 corners onto the plane (s,t) space, find the lowest and highest s and t values, then use those to create a
Rectangle3d based on your plane. This will give you a rectangle which is guaranteed not smaller than your shape. It could however still be much larger than it needs to be. If you want to shrink it, you’ll have to perform an intersection between your plane and your shape and find the boundingbox of only the intersection points/curves. That will give you the smallest possible rectangle.
Thanks a lot. I’ll try that.