<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=445056146107513&amp;ev=PageView&amp;noscript=1">

Hagerman Blog

Automate Step File Creation with 10 minutes of iLogic

Posted by Bonn Rhee on Mar 9, 2021 4:30:43 PM

If you have 10 minutes to spare, you can automate exporting step files with Autodesk® Inventor® ilogic.

Out of the box, Inventor ilogic includes some custom snippets. These snippets are “small” re-usable codes. These can be used "as is" with no edits. The snippet we are discussing today is the "Save As STEP file." All I've done is customized the original snippet so that the step is exported to a folder of my choice.

2021-news-mar-ilogic-1

Let’s get started! This snippet can be added to any Inventor file. However, it will probably be best served if added to your .ipt and/or .iam templates. This way, any new part or assembly will always contain the snippet. In my example, I will be using an .iam template, but the steps will be the same for an .ipt template.

Open your template and add the ilogic browser:

2021-news-mar-ilogic-2

Your Inventor browser should now look like this:

2021-news-mar-ilogic-3

From the RULES tab, right-click below "Assembly1" and ADD RULE. I've named my rule "StepExport”. Click OK.

2021-news-mar-ilogic-4

Copy the snippet from this txt file and paste it into the bottom right side of the window…then SAVE.

Your ilogic Edit Rule window should now look like:

2021-news-mar-ilogic-8

I've made three changes to the original "Save as STEP file" snippet. I've added the following two lines:

trigger = iTrigger0  
SavePath = "C:\StepFiles\"

 

…and changed the line that contains oData.FileName to

oData.FileName = SavePath & ThisDoc.FileName(False) & ".stp"
 

You can now change the SavePath to the folder where you would like to save your step files. It should look similar to:

SavePath = "D:\Engineering\StepFiles\"

Do not forget the trailing slash (\)!

(If you want the step file to be saved in the same folder as your original cad model, you only need to make 1 change to the original “Save as STEP file” snippet. Just add trigger = iTrigger0 to the first line.)

The snippet is ready to be tested. CLOSE the Edit Rule window. In Inventor, go to the MANAGE TAB – iLogic Panel and click iTrigger. Doing this will execute the StepExport rule and export the step file to the SavePath folder.

2021-news-mar-ilogic-6

Check your SavePath folder. Although there is no CAD model in our template, a step file should have been created. You can now save and close your template file. Start a new model with your template and select iTrigger to create your step files!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Topics: iLogic

Back to home