@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.