Showing results for 
Search instead for 
Did you mean: 

How to run an API from within a Rulestream session

Community Manager Community Manager
Community Manager

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:

  1. Dimensional data entry (ex. length, diameter)
  2. CAD model display
  3. Drawing display

The solution:

  • 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:

  1. WORD: Step-by-step instructions on how to setup Rulestream to run the executable
  2. ZIP: Example custom.txt and the code used to create the executable that uses the API of this example

Where can I find the custom.txt mentioned in the .docx file?


PS I work for Wartsila...

Community Manager Community Manager
Community Manager

I've updated the .docx as requested via an earlier email and added the custom.txt to the .zip