Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.
I tried listening for the render settings dialog creation event and calling the doExecute() method to trigger the render with the already existing presets, but this unfortunately doesn't work.
How can I access the render button and the other controls?
Hi Leon.Vladimirov.
I don't know how to access the controls.
But there is a way to execute the command.
I tried and it was possible to start rendering.
#Fusion360API Python script #Author-kantoku #Description-sample start rendering import adsk.core, adsk.fusion, traceback def run(context): ui = None try: app :adsk.core.Application = adsk.core.Application.get() ui :adsk.core.UserInterface = app.userInterface # new document desType = adsk.core.DocumentTypes.FusionDesignDocumentType app.documents.add(desType) des :adsk.fusion.Design = app.activeProduct root :adsk.fusion.Component = des.rootComponent # create body createBody(root) # change workspace des.workspaces.itemById('FusionRenderEnvironment').activate() # start rendering cmdDefs :adsk.core.CommandDefinitions = ui.commandDefinitions cmdDef :adsk.core.CommandDefinition = cmdDefs.itemById('InCanvasRenderCommand') cmdDef.execute() except: if ui: ui.messageBox('Failed:\n{}'.format(traceback.format_exc())) def createBody( comp :adsk.fusion.Component): skts = comp.sketches skt = skts.add(comp.xZConstructionPlane) ctr = adsk.core.Point3D.create(0, 0, 0) skt.sketchCurves.sketchCircles.addByCenterRadius(ctr, 5.0) prof = skt.profiles.item(0) exts = comp.features.extrudeFeatures newBodyOpe = adsk.fusion.FeatureOperations.NewBodyFeatureOperation ext = exts.createInput(prof, newBodyOpe) dist = adsk.core.ValueInput.createByReal(5) ext.setDistanceExtent(True, dist) exts.add(ext)
Hi!
Thank you for your answer.
But unfortunately this is not what I’m looking for. I’m trying to automate cloud rendering. From my understanding this script will render in canvas - which can be done with one press of a button, instead of pressing a button in the cloud render dialog.
Is there a way to automatically start cloud rendering?
I'm sorry, I misunderstood.
I don't know how to operate dialog buttons.
Sorry for not being able to help.
May be you can try with the below script. You need to save the design before executing this command.
cmdDefs = ui.commandDefinitions
cmdDef = cmdDefs.itemById('A360RenderCommand')
cmdDef.execute()
Thank you for your answer!
But unfortunately I still can't get my design to render. The command your suggested opens the rending tab, but I still haven't found a way to click the render button inside the tab via code.
Do you know how I can achieve this?
Looks like It is not possible. You can get the render button control in the dialog using below script but there is no 'click 'method available on button control
controlDef = cmdDef.controlDefinition
buttonCtrlDef = adsk.core.ButtonControlDefinition.cast(controlDef)
buttonCtrlDef.name
Can't find what you're looking for? Ask the community or share your knowledge.