How do I get the rotated object's outer dimensions when it's not a standard cube?

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
Karton
Posts: 36
Joined: Thu Aug 11, 2016 8:16 pm
Location: Germany
Contact:

How do I get the rotated object's outer dimensions when it's not a standard cube?

Post by Karton »

I used to get the Bounding box of shapes using

Code: Select all

o.Shape.BoundBox.XLength
where

Code: Select all

o
is the result of

Code: Select all

findObjects()
.
That worked well unless the objects were rotated.
How do I get the rotated object's outer dimensions when it's not a standard cube?
Last edited by Karton on Tue Nov 29, 2022 9:17 am, edited 1 time in total.
Die Schwierigkeiten des Verstandes zu studieren mag dich zu einem guten Psychologen machen, es wird dich aber nicht über den Verstand hinausbringen, genau wie das Erforschen von Verrücktheit nicht genug ist, um geistige Gesundheit herzustellen.
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: How do I get the rotated object's outer dimensions when it's not a standard cube?

Post by chrisb »

It works well, even if the object is rotated, but it's always the bounding box with faces parallel to the main plane. What you are looking for seems to be the smallest enclosing box that can be found independent of its orientation in space. A mere guess is, that it may be difficult to calculate, because a) it may not be unique and b) the function describing the volume depending on the placement may have multiple local minima.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply