Hi @maurizio_manzi -San.
BoundingBox3D relies on the orientation of the global coordinate system.
The size in any vector direction can be obtained with the MeasureManager.getOrientedBoundingBox method, but it will be OrientedBoundingBox3D, not BoundingBox3D.
https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-DF2F5C84-57C7-4F61-BA05-D2978FFF2724
The following sample outputs the size of the first face of the first body of the root component in the screen direction.
# Fusion360API Python script
import traceback
import adsk.core as core
import adsk.fusion as fusion
def run(context):
ui: core.UserInterface = None
try:
app: core.Application = core.Application.get()
ui = app.userInterface
des: fusion.Design = app.activeProduct
root: fusion.Component = des.rootComponent
body: fusion.BRepBody = root.bRepBodies[0]
face: fusion.BRepFace = body.faces[0]
bBox: core.BoundingBox3D = face.boundingBox
#*****
# Vector acquisition from eye direction.
camera: core.Camera = app.activeViewport.camera
vecLength: core.Vector3D = camera.eye.vectorTo(
camera.target
)
vecWidth: core.Vector3D = vecLength.crossProduct(
camera.upVector
)
# OrientedBoundingBox
measMgr: core.MeasureManager = app.measureManager
orientedBBox: core.OrientedBoundingBox3D = measMgr.getOrientedBoundingBox(
face,
vecLength,
vecWidth,
)
# dump
app.log("*********")
app.log(f"CenterPoint:{orientedBBox.centerPoint.asArray()}")
app.log(f"LengthDirection:{orientedBBox.lengthDirection.asArray()}")
app.log(f"Length:{orientedBBox.length}")
app.log(f"WidthDirection:{orientedBBox.widthDirection.asArray()}")
app.log(f"Width:{orientedBBox.width}")
app.log(f"HeightDirection:{orientedBBox.heightDirection.asArray()}")
app.log(f"Height:{orientedBBox.height}")
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))