import FreeCAD as App # Access the active document doc = App.activeDocument() # Find the subtractive sphere by its name (assuming it's named 'SubtractiveSphere') subtractive_sphere = doc.getObject('SubtractiveSphere') # Boolean value to check chk = True # Set this to False to set the radius to 0 mm # Set the radius based on the boolean value if subtractive_sphere: subtractive_sphere.Radius = 2.5 if chk else 0 # Recompute the document to apply changes doc.recompute()