CATIA Sketch 2D "Bounding Rectangle"
CATIA Sketch 2D "Bounding Rectangle"
(OP)
I'm now at the point I often run into with CATIA VBA. I know what I want to do. I've spent hours looking for the tools in forums and in the help files, that I need to get it done. And I end up getting nowhere.
I want to make a Macro that creates a Bounding Rectangle with the default axis system of all geometry that exists in a sketch within a CATPart. I think my strategy should be to go through every geometry, find its X and Y extrema (largest and smallest) and keep cycling until I know the largest and smallest X and Y of all geometry and make a box using that data.
I found HybridShapeExtremum, but that seems to only apply to geometry from the GSD workbench, and I want sketch geometry. Would anyone know how to go about solving this?
I want to make a Macro that creates a Bounding Rectangle with the default axis system of all geometry that exists in a sketch within a CATPart. I think my strategy should be to go through every geometry, find its X and Y extrema (largest and smallest) and keep cycling until I know the largest and smallest X and Y of all geometry and make a box using that data.
I found HybridShapeExtremum, but that seems to only apply to geometry from the GSD workbench, and I want sketch geometry. Would anyone know how to go about solving this?





RE: CATIA Sketch 2D "Bounding Rectangle"
I attached a bounding box script that would need a little modification to produce what you are looking for.
Regards,
Derek
Win 7
23SP5/24SP3, 3DVIA Composer 2015
RE: CATIA Sketch 2D "Bounding Rectangle"
It seems like I wouldn't be doing all of this in the most efficient way. Surely there has to be a more efficient approach. Maybe?
RE: CATIA Sketch 2D "Bounding Rectangle"
Maybe is better to create a UDF based on something similar like here . The idea is to create a rectangle around the sketch and rotate that rectangle (or the sketch) in order to obtain the minimum area for rectangle. In this way you will obtain the minimum x and y dimensions. Anyway, I don't think there is a quick solution for this.
I suppose you want this especially for unfolded SMD parts (I know this is a problem for brackets with complex shape).
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: CATIA Sketch 2D "Bounding Rectangle"
My box can be slightly large if needed without causing me any issue. So I will create equally spaced construction points on all curves of maybe 0.05" spacing, then take the max/min X and max/min Y of each point. Then create a box around those dimensions and oversize it by 0.025" on each side. That will guarantee that all curves are within the bounding box.
Perfect!
RE: CATIA Sketch 2D "Bounding Rectangle"