Running an API from within a Rulestream session is a powerful capability. Although Rulestream strives to provide a UI to the most common APIs of the supported CAD integrations, there will always be hundreds more that are available but not included with our integrations.
The setup required to run an API from Rulestream has always been a mystery to me. I know it could be done, but finding a good example that was documented in a way I could follow (I.e., step-by-step) just never happened.
I recently had the opportunity to help get a Solid Edge API to run from within a Rulestream session when Solid Edge has a regeneration event -- This is anytime the Solid Edge model rebuilds itself, such as the first time into a RS process step that displays geometry or when a geometric property is changed within a CAD process.
So I documented what I did.
What I learned is that there are many things to consider when doing this. And at the end of the day you need to be careful, as calling the wrong API at the right time can make a mess out of your model. Use with caution and after careful consideration and planning.
Here’s the background on this example:
Prior to opening a process step to view a drawing, two configurations needed to be setup with different parts being displayed in each so that the drawing could use them in two separate views.
Rulestream does not have any built-in controls to manipulate the configurations, but there are APIs to do this.
As this was a one-time test to show how this might work, assumptions were made as to the names of the parts and a simple test application was created.
Therefore the API to create the correct configurations had to somehow be run after the geometry was created but before the drawing was viewed.
The application consisted of three process steps:
Dimensional data entry (ex. length, diameter)
CAD model display
An executable was created to run the API
Rulestream was updated to run this executable
After opening the CAD model the user may then proceed to the drawing and see the two views with the two different configurations
What I’ve included in this article:
WORD: Step-by-step instructions on how to setup Rulestream to run the executable
ZIP: Example custom.txt and the code used to create the executable that uses the API of this example