Interactive Script-defined Tools Change the Game in Modeling

If you turn on the TV or browse the internet these days, automation is a familiar topic. From smart homes to learning thermostats, the drive to save time and effort by automating repeated tasks is everywhere. We use words like ‘smart’ to indicate that our devices are no longer one-size-fits-all but instead adapt and can be programmed to better suit our needs and behaviors. So, too, should be the case with our engineering software! That is why we have spent over a year to add scripting, a broadly applicable interface for automation and customization of modeling, to the ANSYS SpaceClaim geometry modeling environment.

In a previous blog post, we introduced SpaceClaim scripting and how it can automate repetitive or tedious tasks. With ANSYS 18.1, we’ve taken it a step further and made it easier to share and use SpaceClaim scripts outside of the editing environment. By publishing scripts to dedicated buttons in the user interface or calling them from within a Workbench script, you can now use the power of scripting in more places than ever before. Furthermore, we have extended the interaction with scripts to allow for user input of selections and values during execution. Let’s take a closer look at these improvements.

Here we have the geometry for a vehicle braking system. One thing I am often looking to automate is the preparation of geometry models for simulation. In this case I would like to replace the bolts, colored in teal, with ANSYS beam and shell elements to accurately capture the connection between parts during simulation. Thanks to the “Record” feature, I can generate a script by simply using SpaceClaim modeling tools the way I normally would, and then generalizing the actions to apply them to a repeated set of objects. My completed script automates my modeling work.

Create simulation-related elements such as beams and shells using scripting

Once you have recorded a script, you are going to want to replay it. Thanks to the new “Publish” button in the editor, you can easily promote your script to a dedicated button in the SpaceClaim ribbon for easy use on other models. Better yet, you can share published scripts with others in your organization allowing them to benefit from the created automation. Given that authoring scripts is not for everyone, sharing is an important method for improving the productivity of entire teams.

When publishing a script, you can select a name, tool tip, and icon to be used

Critical to almost every script is control over the inputs. These can be geometric inputs, such as target faces or bodies to execute against, or they can be numeric, such as parameters or desired feature sizes. With ANSYS 18.1, scripts can now define an interactive tool that accepts selections and parameters during execution. Not only does this make it easier to provide input to scripts, but it allows for interacting with scripts in novel and unique ways. Script-defined tools look and behave the same as other modeling tools, meaning that you can now customize and extend SpaceClaim in an interactive way that feels very different and significantly more approachable than the traditional ‘running a script’. With SpaceClaim we strive to make automation as smart and easy to use as possible so that every engineer can customize and accelerate their work.

script-defined tools exampleThe Create Bolt script can be turned into an interactive tool that
accepts parameters and selections during execution

Scripting also lets you connect applications together and facilitate workflows. ANSYS Workbench is the leading tool for coordinating materials, boundary conditions, meshing, and results between all ANSYS applications. It supports scripting for customizing and automating these simulation processes. With ANSYS 18.1, you can now call SpaceClaim scripting from within a Workbench script to extend this automation through geometry creation and editing. From reading custom 3-D data formats to parametric creation of complex geometries, ANSYS scripting tools are now more capable and cohesive than ever. For more information, please visit our website.