import FreeCADGui view = FreeCADGui.activeView() cam_loc = view.getCameraNode().position.getValue()
import FreeCADGui view = FreeCADGui.activeView() selection = FreeCADGui.Selection.getSelection()[0] bbox = selection.Shape.BoundingBox center = bbox.Center view.setCameraOrientation(center, (-10, 0, 0)) view.setCameraPosition(center, 1000)This code uses the `setCameraOrientation()` and `setCameraPosition()` methods of the active view to adjust the camera orientation and distance, respectively, to center on the selected object. Package library: FreeCAD.