Is it possible to export .ipt files to STEP based on iPropriety check?

Is it possible to export .ipt files to STEP based on iPropriety check?

OliverTilbury
Enthusiast Enthusiast
1,176 Views
11 Replies
Message 1 of 12

Is it possible to export .ipt files to STEP based on iPropriety check?

OliverTilbury
Enthusiast
Enthusiast

Hi All,

 

Would anyone be able to suggest a solution (iLogic code? existing functionality?) to...

 

Export all .ipt files in a given folder (or Project) to STEP files BUT only those parts that have an iProperty within called 'CNC' and who's corresponding value = 'Yes'? 

 

I would then like to (for added bells and whistles) save these STEP files with a new file name based on another iProporty value in that part. That iProperty is called 'CALL-OFF NO.' and usually has values such as P1, P2, P3, S1, S2, M1, M2 etc etc..

 

So files would end up (for example)...

P1.stp

P2.stp

P3.stp

S1.stp

 

and so on.

 

Thank you very much and kind regards,

 

 

Oliver

 

 

0 Likes
1,177 Views
11 Replies
Replies (11)
Message 2 of 12

jtylerbc
Mentor
Mentor

It sounds like a job for some custom iLogic code, possibly using the Code Injector to handle the folder batch execution.  The post (and the tool) is rather old, but is still working fine for me with Inventor 2018.

http://beinginventive.typepad.com/being-inventive/2012/08/major-upgrade-to-the-ilogic-code-injector-...

 

There is a snippet in the iLogic Editor on the "Custom" tab for exporting a STEP file.  I would start from that, enclose it in an If/Then decision based on your "CNC" property, then try to rewrite the file naming portion based on your needs.

 

 

0 Likes
Message 3 of 12

OliverTilbury
Enthusiast
Enthusiast

Ok.

 

Thank you John for the quick reply.

 

I will look at this later.

 

Might have to stick with doing it manually for now as trying to get a job out! 😕

 

I've also not written ANY iLogic code before but this may be the task to use to actually learn on. 

 

Thanks very much,

 

Oliver

0 Likes
Message 4 of 12

jtylerbc
Mentor
Mentor

The majority of the work is done for you in the STEP export example snippet I mentioned.  The actual code you'll need to write shouldn't be that difficult, so I think this should be a decent exercise for you to learn with.

 

The tricky part in your case is really the batch execution, which is what the Injector will help with.  The Injector is a tool whose original purpose was to add new rules to batches of existing files.  However, since it also has the ability to run rules and even delete them, it also lends itself to batch jobs like this.  You simply set it up to run the rule and delete afterward.

 

Another way you could look at this for the future is putting the rule into your part template so the STEP files are generated automatically when the Inventor file is saved, and you don't even have to do the batch runs anymore.

Message 5 of 12

OliverTilbury
Enthusiast
Enthusiast

Ok. 

 

Thanks for the extra explanations.

 

Sounds encouraging. 

 

One question: If I use the Injector tool - is there any need to have it delete the rules after it has added and run them?

 

I like your idea of adding a rule though to my part template for future.

 

Thanks very much again,

 

Oliver

 

0 Likes
Message 6 of 12

jtylerbc
Mentor
Mentor

@OliverTilbury wrote:

 

One question: If I use the Injector tool - is there any need to have it delete the rules after it has added and run them? 


 

Maybe, maybe not.  It depends on your intent.  If it is a one-time batch process, then you probably want to clean up after yourself by having it delete it and not leave a rule laying around in your parts that may never be used again.  You're essentially just using the Code Injector as an external scripting tool in this case.

 

However, if you go the route of making this a fully-automated thing that is built into your template files, the Code Injector instead would be used to shove the code into your existing parts to make them compatible with your new process.  In that case you definitely would not want it to delete the code.

0 Likes
Message 7 of 12

OliverTilbury
Enthusiast
Enthusiast
Ok. Thank you John.

Makes sense.

So I take it from that then that the tool can be used to...

Inject - run - delete

Inject - run - not delete
Or
- and presumably just 'run' (if the code is already in the parts)?

Second question: Am I also correct to say that parts have to be open for their code to be run (Especially an export comand?!)? Sure its obvious but thought id check.

If this is the case (third question) presumably the tool has to open ALL parts in the folder / project directory to see if they have this iProperty 'CNC?' = 'Yes' check regardless of whether they do or not?

Now (4th and final question 😁) will this work with iPart member files too in said folder/project directory? I have my iParts set up so they also have this iProperty pulled through (and shows up in a bill of materials I have in my 'both of my two main assemblies together in one MASSIVE assembly.assembly' 😆 so ALL parts and their occurrences are captured in one mastee bill of materials).

Thanks very much for your time in helping steer me on this.

All best,

Oliver
0 Likes
Message 8 of 12

jtylerbc
Mentor
Mentor

@OliverTilbury wrote:
Ok. Thank you John.

Makes sense.

So I take it from that then that the tool can be used to...

Inject - run - delete

Inject - run - not delete
Or
- and presumably just 'run' (if the code is already in the parts)?

 

Technically, it can't do the third option you list.  The Code Injector looks at code in its own text window, not any code that is already in the Inventor files.  Generally, if you have the code in the parts, you would also have a trigger set on the rule so it runs automatically (and thus would have no need for batch-running it with the Injector).  However, let's say you either didn't have triggers set, or you wanted to do a batch run to make sure that they're all up to date, or some other reason.  There are two ways you can handle it with the Injector:

  • Use the Injector to run duplicate code to what is already in the part files, checking the box to "Overwrite existing rules", but not "Delete after run".
  • Write a second rule whose sole function is to run the existing rule in your part.  Run and delete this rule using the Injector.

 


@OliverTilbury wrote:
Second question: Am I also correct to say that parts have to be open for their code to be run (Especially an export comand?!)? Sure its obvious but thought id check.

 

This is correct.  However, depending on the way the code and its triggers are set up, it could be open via an assembly that contains the part, rather than explicitly having the part open in its own window.  In the case of the way Code Injector works, you would set it up to run code on all .ipt files in a certain folder.  It would cycle through each part, opening it and running the code, deleting the code if so instructed, and then move on to the next part.

 


@OliverTilbury wrote:
If this is the case (third question) presumably the tool has to open ALL parts in the folder / project directory to see if they have this iProperty 'CNC?' = 'Yes' check regardless of whether they do or not?

 

Yes, that is correct.  The code I am envisioning would open the part, then check the property value using a simple If/Then statement.  If "Yes", it would proceed with the export.  Otherwise, it would exit the code without doing anything.

 


@OliverTilbury wrote:
Now (4th and final question 😁) will this work with iPart member files too in said folder/project directory? I have my iParts set up so they also have this iProperty pulled through (and shows up in a bill of materials I have in my 'both of my two main assemblies together in one MASSIVE assembly.assembly' 😆 so ALL parts and their occurrences are captured in one mastee bill of materials).

 

iParts may potentially be an issue with the way I was looking at doing this.  It isn't possible to add iLogic code to iPart child files.  As far as I know, Code Injector doesn't do anything that gets around that limitation.  Although I use both iLogic and iParts fairly extensively, I've never really even tried to use them together, so if there is a good workaround for this, I don't know it offhand.

0 Likes
Message 9 of 12

OliverTilbury
Enthusiast
Enthusiast
Ok.
Thanks for the very informative answers.

I will try and start playing around with it in the next few days.

Guess I'll start with getting it to work with simple parts then look into the trikier issue of iParts.

That's where it sounds like it might get more complicated. I'd also want to write something so that it would only open and export the child parts but not the iPart Factories.

If iLogic cannot be used in iParts maybe one option might be to then trigger a derive and then do the export from there.

Last question though before I go off to investigate- do you think there might be any role here for using the Task Scheduler?

Thanks again.


0 Likes
Message 10 of 12

jtylerbc
Mentor
Mentor

If all you wanted to do was export STEP versions of all the parts in a certain folder, Task Scheduler would be a much easier method than code.  But with the conditions you have set (only exporting the STEP file if a certain property has a certain value, naming the STEP files differently than the Inventor files, etc.), Task Scheduler doesn't quite have the brains to get you there.

0 Likes
Message 11 of 12

w.pepping
Advocate
Advocate

Publish Tool in the app store can do exactly what you describe.
After installation you can create a workcenter with iProperty 'CNC' and value 'yes'

Then in the STEP File Naming choose Custom: 'CALL-OFF NO.'
Then open the project and select your CNC filter in the Publish Tool.

Get control of your sheet metal files.
Download the app from matprop.com
0 Likes
Message 12 of 12

OliverTilbury
Enthusiast
Enthusiast

Thanks for you last message John.

 

And Wim for your suggestion.

 

I will look into both of these as and when work demands or allows (which are not necessarily the same thing! Smiley Tongue).

 

 

Kind regards. 

 

 

0 Likes