Created
March 20, 2018 18:02
-
-
Save eak24/d3e1b67db03cad4ab8e139fee60633f0 to your computer and use it in GitHub Desktop.
Change a 'child component' expression in Fusion 360
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Author- | |
#Description- | |
import adsk.core, adsk.fusion, adsk.cam, traceback | |
def run(context): | |
ui = None | |
try: | |
app = adsk.core.Application.get() | |
ui = app.userInterface | |
fd = adsk.fusion.FusionDocument.cast(app.activeDocument) | |
data_file = fd.documentReferences.item(0).dataFile | |
child = app.documents.open(data_file) | |
param = adsk.fusion.FusionDocument.cast(child).design.userParameters.itemByName("side_lengths") | |
param.expression = "5 m" | |
child.save("this is different!") | |
except: | |
if ui: | |
ui.messageBox('Failed:\n{}'.format(traceback.format_exc())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment