Share

Best Practices: Codeblocks

Codeblocks empower users to create code through an intuitive drag-and-drop interface, eliminating the need for traditional text-based programming.

Autodesk Informed Design utilizes Google Blockly, a Google library renowned for crafting user-friendly, block-based programming languages to deliver the Codeblocks functionality included that is used to define Product input and interface logic without the need to write text based code.

Where to Start

Start with simple tasks. Familiarize yourself with the Codeblocks interface and understand the dynamics of block interaction. The Informed Design Help page for the Rules Workspace provides excellent resources to comprehend the toolbox, canvas, contextual menus, form previews, etc. As you become more comfortable, gradually undertake more complex projects.

alt

Begin by using the sample datasets provided for download HERE, or create your own basic product model datasets to work with while learning the basics.



Planning Ahead

Before embarking on this journey, clarity of purpose is crucial. Plan out your input rules and sketch the logical flow. Always start simple. For instance, consider whether your rules need to control the maximum and/or minimum value, or control the value increments allowed for an input. This approach simplifies block selection and rule organization.

alt

As you progress, adding complexity can be as simple as integrating an If/do block. Here, you can include a conditional statement filled with variables and parameter blocks. The 'do' section of the block in the example below sets the value a specified parameter and defines what value options are available for that parameter's Input control (drop down list) when the condition is met that is specified in the 'if' section of the block.

alt



Test, test, test

Don’t learn the hard way by creating all your rules and then testing them when your done, only to find that things (perhaps many) are not working properly. Instead, as you are building the blocks, test them as you go. Run tests (Click on "Update Form" in the Rules workspace) frequently to check for errors and make sure your rules are behaving as expected. Also consider breaking your rules down into smaller parts (groups of blocks) and test each part individually before combining them into a larger program.

alt

To help with this we recommend watching the following tutorials on our Informed Design Online Help site:



Reuse Codeblocks

Don’t just keep creating the same sequences of codeblocks over and over again. Consider creating a reusable function to encapsulate your code and drop  into the backpack for quick access when you need it elsewhere in your codeblocks construct. This will help streamline the creation of your rules and make it easier to maintain.  For functions you define that can be used across product definitions, you can Export the Function to a file and import it into any other product definition.  Isolate the codeblocks you want to Export in their own workspace before exporting because currently, the Export function only Exports all Codeblocks in the canvas.

alt



Tutorials and Help Documentation

Take advantage of the Learning Tutorials and Help Site to learn how to use the tool effectively. Taking advantage of these resources can deepen your understanding of the solution and learn various techniques typically employed to accomplish common tasks.

alt



Stay Connected

Informed Design is continually being improved and updated with new features and enhancements. Sign up for our Newsletter to stay informed about these updates so you can take full advantage of the benefits as soon as they are made available.  

Connect with Us

Join the Informed Design Community to engage with other users, our team, and share your tips and tricks or get your questions answered.

Share your Ideas

Do you have ideas about how we could be improve Informed Design?  Are there new functions or capabilities you would like to see added?  If so, please let us know let us know by posting your ideas on the Informed Design IdeaStation.

Was this information helpful?