- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Is there a way to control the following through the API?
Instagram:
@sonsofsormaz
@sonsofsormaz
Solved! Go to Solution.
Is there a way to control the following through the API?
Solved! Go to Solution.
Hello,
unfortunately, there is no direct object in the API that you could use to edit these settings. However you can simulate navigating through the user interface and set the checkboxes to your liking. I used this workaround technique for effects of the camera.
This is a sample script that turns off sketches (unchecks the checkbox):
import adsk.core, adsk.fusion, adsk.cam, traceback
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
command_definitions = ui.commandDefinitions
objectVisibilityCmdDef = command_definitions.itemById("VisibilityOverrideCommand")
objectVisibilityControl = objectVisibilityCmdDef.controlDefinition
objectVisibilityList = adsk.core.ListControlDefinition.cast(objectVisibilityControl)
sketchesCheckBox = objectVisibilityList.listItems.item(8) # turn off sketches
if sketchesCheckBox.isSelected:
was_turned_off = sketchesCheckBox.isSelected = False
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
good enough for me, thanks!