Unique products at scale with AI-infused CAD

Connecting Fusion 360 with Python

Sarunas Simaitis


Photo by Ulises Baga on Unsplash


The creation of new products and updating of the existing ones is key for continuous business success. Until very recently that process was very slow: designers had to hand draw sketches, prototypes were manually machined and once the prototype was finished and approved, manufacturing lines had to be adjusted to make it at scale.

The introduction of Computer-Aided Design (CAD) and Computer Numerical Control (CNC) revolutionized such processes and significantly reduced time to market. Together with inexpensive offshore labour, that resulted in standard products made very cheap once the scale is big enough.

The best example is IKEA which has a very limited product range at a very aggressive price point. Even for relatively large businesses competing with such a giant is hard. Therefore, one has to find other ways to stay competitive rather than rely on economies of scale.

Inspiration can be taken from smaller businesses which find their competitive advantage by producing niche products — ie. companies who fit the needs better of a smaller user group. For a larger company built around economies of scale the latter is hard to achieve because having a, possibly magnitude, larger product catalogue could break their processes.

In this series of blog posts, we address how recent advances in Artificial Intelligence (AI) methods can be employed in the design stage to scale the process. We start by connecting all the tools to increase our range of dining tables by offering unique designs of their legs.

Artificial Intelligence and CAD

Artificial intelligence and machine learning are being successful at a wide variety of tasks starting with object detection in images, autonomous driving, X-ray analysis to beating humans in Go, Poker and Starcraft II. On the creative side, AI methods can help to source music for our games and movies, generate abstract images.

Recently, Autodesk has released their generative design solutions which allow making use of machine learning algorithms to optimise the design to specifications and costs. Although the efficient product is tremendously important, that is only part of the problem. In this series, we will look into how AI can be used to design unique products in terms of style at scale.

Regarding our tools, on the AI side, we will use Python programming language for its flexibility and vast array of libraries available. Regarding CAD, our tool of choice is Fusion 360 because of its simple integration with Python, high availability and ease of use.

The goal of this post is to connect all the pieces and explore randomly generating dining table legs and then shortlisting the interesting ones. The leg design is restricted to one which could be turned with a CNC lathe from a square block.

Creating parametric CAD

Before starting the design it is useful to split parameters into 3 groups:

  1. Fixed parameters which constrain the design and are not negotiable;
  2. Floating parameters will be driven and optimized by the AI algorithm. To make the design work with multiple algorithms, it is useful to set them to be unitless and assume they will between 0 and 1. Also, naming them consistently such as “x_{group_id}_{parameter_id}” ( eg. “x_part1_1, x_part1_2, x_part2_1,…” ) will allow Python script to easily identify which parameters are to be manipulated;
  3. Meta-parameters are used to convert the floating parameters into real measurements. For example, suppose we want to float some length a in the design which is given in millimetres. Now say x is a dimensionless floating parameter with possible values between 0 and 1. Then one could introduce meta parameters a_min and a_max and then get:
Figure 1. CAD model parameters

The Fusion 360 project that is used in this post has 3 sketches:

  1. Fixed sketch — the geometry that is driven by fixed parameters and is not dependent on the floating geometry;
  2. Floating sketch anchors off the fixed geometry and defines how the floating parameters drive the design;
  3. Derivative sketch anchors off the fixed and floating geometry and defines the remaining geometry.
Figure 2. From top to bottom — fixed, floating and derivative sketches

In real life designs, the structure is much more complicated and enforcing this split is prohibitive, but keeping AI-driven parameters split away from the fixed parameters makes the design more maintainable in the long run.

Important! The way the floating parameters are incorporated into the design have a tremendous impact on the quality of the result. Not only the 3D model can become unreal, impossible to manufacture or result in a crash altogether, but also the AI algorithm might work better with one parametrisation and worse with another.

After some extrusion and rotation our table leg model is complete ( see Figure 3 ) and full model is available at the Autodesk HUB

Figure 3. 3D CAD model

Python in Fusion 360

Fusion 360 has two programming APIs: C++ and Python. In this series, we will focus on Python, because of its simplicity, speedy development and wide library support. Autodesk provides extensive documentation online and many tips can be found in their community.

Fusion 360 comes with its Python which is independent of the system’s Python which initially can be confusing. It is also noteworthy to mention that Fusion 360 update might update Python which possibly will your scripts and, thus, occasionally the scripts and add-ins need to be reviewed to be compatible with the current Fusion 360 version.

Generally, it is useful to locate the Python binary. On our tested MacOS machine the path is

/Users/<username>/Library/Application Support/Autodesk/webdeploy/production/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/bin

Quick install of modules into Fusion 360 Python

Although Autodesk provides documentation on adding 3rd party Python modules, for quick prototyping it is easier to install pip and then install modules with it. To get pip:

  1. Navigate to the directory with Fusion 360 Python executable
  2. Download the get-pip.py to the directory. On MacOS terminal simply
    curl -O https://bootstrap.pypa.io/get-pip.py
  3. Using Fusion 360 Python execute the script. On macOS terminal
    ./python get-pip.py

Once this is done simply navigate to where the Fusion 360 Python executable is and use the pip executable there to install the script. eg. on macOS:
./pip install numpy

Connect Python script to the design

To create a new script, navigate Tools -> Add-ins, select Scripts and click Create. In the pop-up window select Script, then click Python under Programming language, enter the name, OS. If you are planning to use an external editor make note of the folder where the script will be created.

At the time of writing the default Python editor for Fusion 360 is Visual Studio Code. For simple scripts the latter might be overwhelming or, like in the case of the author, one prefers lightweight text editors like Notepad++ or Sublime-text one just needs to edit the file “ScriptName.py” in the script folder. The only caveat is that in case you have a syntax error the script will not be run and no crash will happen, thus having some Python linter in your editor helps to spot and avoid that.

The freshly created script will contain a single function run which is called once the script is invoked and in this case, it will create a pop-up welcoming the user.

During the first step, the script needs to extract the floating parameters from the design which can be done by filtering and grouping parameters by name as follows

Now it is important to note that we grouped the parameters to differentiate the parameter generation process.

Figure 4. Parametrization of the floating sketch

The distance of the spline points from the turning axis are unrelated and are fine as long as the values fit in the range [0,1]. Thus, the widths are generated using continuous Uniform distribution on [0,1] as given by module numpy function numpy.random.random()

On the other hand, the heights are defined as the distance from the bottom of the leg to the spline point and every point should be subsequently further away from the previous one. Otherwise, the design cannot be turned on a simple CNC lathe. Moreover, the max should not be higher than one so that the topmost point does not go over the bounds of the turned profile. This situation is similar to cutting string at random points with specific averages which can be modelled using Dirichlet distribution as given by numpy.random.dirichlet . Dirichlet distribution takes parameter α which we will set to a vector of 1 with length equal to the number of points.

Putting this all together results in the following script:


Figure 5. Generation results

Figure 5 presents samples from our generation. We’ve added a static table model to get a complete look at the impact of the generation to the general product look. As we can see many of the designs are to be disqualified because they either are unattractive or simply impossible manufacturable. However, a few of them are pretty good product candidates and shortlisting them is a very fast process.

Conclusions and future work

We have connected Python with Fusion 360 to drive our design. In short, we’ve observed the following:

  1. This approach is scalable and is limited only by the number of machines you can run Fusion 360 on. Process-wise the most beneficial scheme would entail running the design generation overnight and capturing design images, quickly reviewing and shortlisting the best designs;
  2. Because of the wide choice of libraries for Python, this script can be easily tweaked to a more sophisticated generation scheme;
  3. Such generation in Fusion 360 is slow. Fusion 360 recomputes the model after every parameter change and it could be greatly sped up if one found a way how to recompute only after all the parameters have been set;
  4. Design parametrisation is crucial to getting worthwhile designs. It might be impossible to define an unbreakable parametrisation, but one should focus on making it as generic as possible.

Now that we have all the pieces put together it is time to sophisticate the generation and start on the AI. In the next post, the focus will be on incorporating user feedback to the generation process using some evolutionary algorithms. Stay tuned and leave your comments below!


At 1D.works we help our clients to bridge the gap between their business needs and AI tools using our decade long experience. Reach out to us if you want to grow your value by making AI work for you and with you.

Tip! Override print

Simplify your debugging using by overriding the print function the output of which by default is not visible during run-time. Fusion 360 can be controlled using text commands which have a separate window using which we can display output from the script. Add the following function to the beginning of your script and then use print as you would normally use in your Python scripts to get the output in the Text Command Window.



Sarunas Simaitis
Editor for

Don't beg for it, work at it and it will be granted.