Informed Design Knowledge Center
Share and learn how-to tips, workflows, and general knowledge articles about Informed Design and the future of the Industrialized Construction industry.

Informed Design Codeblocks: Dynamically updating minimum and maximum values

Contributed by:

Dynamically updating minimum and maximum value Thumbnail.png

Autodesk Informed Design allows publishers to define a form that can be used in Revit to configure and place Revit families derived from manufacturing models.

 

The form is created in Autodesk Inventor and includes input logic to control allowable values. This prevents configurations that don’t meet manufacturing requirements.

 

Input logic is defined using Codeblocks. In this article, we’ll learn how to set a minimum and maximum input value, and then dynamically update those values to suit our model.

 

Learn more about Informed Design for Inventor

 

Input logic goal

 

Our example is the Basic Wall Panel with Window Opening from the Informed Design Sample Datasets.

Goals:

 

  • The wall has a minimum and a maximum length.
  • The window has a minimum and a maximum width.
  • The maximum width of the window is always 9 inches less than the current length of the wall.

Video tutorials: Informed Design Codeblocks

 

Autodesk Informed Design Sample DatasetAutodesk Informed Design Sample Dataset

 

 

Opening width input, Minimum, Increment, and Message values

 

To set a minimum for an input with Codeblocks, we take a Parameter block, change the option to ‘min’, and add a number block to contain the minimum value.

 

Setting a minimum value with an Informed Design Parameter CodeblockSetting a minimum value with an Informed Design Parameter Codeblock

 

We can then copy this, change the option to ‘increment’, and change the value. The opening now has a minimum value of 18 inches.

 

Only values that are increments of 3 inches will be accepted. Informed Design will automatically adjust and correct any non-compliant inputs.

 

Setting an increment value with an Informed Design Parameter CodeblockSetting an increment value with an Informed Design Parameter Codeblock

 

Informed Design automatically adds information to the input, to communicate this requirement to the user.

 

Information is automatically added to the input on the user formInformation is automatically added to the input on the user form

 

The Codeblock added in the image below is used to add a custom message. Adding a message is optional. Informed Design will automatically add a message to any input that has limits defined. This custom message overrides the automated message.

 

Adding a custom message with an Informed Design Parameter CodeblockAdding a custom message with an Informed Design Parameter Codeblock

 

The image below shows a preview of the message that the user will see when they hover over the ‘i’ icon.

Tip: Remember to click ‘Update form’ to see the results.

 

 

A user inpt shows the custom messageA user inpt shows the custom message

 

Opening width input: Maximum value

 

The maximum is a little trickier.

 

In this example, the Wall Length is set by a list. The listed values are in Feet. Our opening is defined in Inches.

So, we need to convert the Wall Length value from Feet to inches, then adjust it for our border, which is 9 inches.

 

Parameter Codeblocks containing lists of valuesParameter Codeblocks containing lists of values

 

First, we convert the current Wall Length from Feet to Inches, using math blocks to multiply by 12.

 

A math Codeblock is used to calculate a resultA math Codeblock is used to calculate a result

 

Then take away 9 (note the use of Codeblock inline, and external inputs!)

 

A math Codeblock used to subtract a numberA math Codeblock used to subtract a number

 

And finally, set this number as the maximum opening width. The maximum opening width will now be the Wall Length, in inches, minus 9.

 

A Parameter Codeblock with a calculated valueA Parameter Codeblock with a calculated value

 

Snap, copy, and repeat

 

We can apply the same logic to the opening height by copying and adjusting the Codeblocks.

We snap the blocks together, and then use ’Duplicate connected’ on the context menu.

 

Copy a group of connected Codeblocks using the context menuCopy a group of connected Codeblocks using the context menu

 

The image below shows the completed Codeblock input logic.

 

If you want to try this yourself, download the dataset from the Informed Design sample datasets and create a new product definition to follow this tutorial.

Autodesk informed Design, Completed exercise in the Codeblock editorAutodesk informed Design, Completed exercise in the Codeblock editor

 

Download Autodesk Informed Design for Inventor