Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Creating geometry with expressions?

1 REPLY 1
Reply
Message 1 of 2
matthewaudio
74 Views, 1 Reply

Creating geometry with expressions?

I'm creating a sketch in an add-in.   I've got a dialog where I ask for either a value or a parameter name. 

 

Example:

1) I create a parameter in fusion called myDiameter.

 

2) I run my Add-in,

3) display a menu of parameter names and select myDiameter. 

4) I want to create a circle whose radius is always myDiameter/2.   That is, after I run the add-in, I want the size of the circle to update when I change the value of myDiameter.

 

How do I do this in python?

 

Ideally I'd just like the same sort of field in my dialog box that native fusion 360 dialogs have where I could type or use units etc etc.   but this is what I've got at the moment.

1 REPLY 1
Message 2 of 2
BrianEkins
in reply to: matthewaudio

The ValueCommandInput object is intended for precisely what you've described. In practice, you'll have one of these in your dialog, and the user can enter whatever they want as the expression to control the circle's diameter. You don't need to care what they enter because the command input will validate it and make sure it's a valid expression. You'll get the string representing the expression, create the circle, and add a diameter dimension to control it. Once the diameter dimension is created, you can get the parameter it's dependent on and set its expression to be what was entered in the value command input.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report