Using iLogic to Copy a Design and Purge iLogic after creation?

Using iLogic to Copy a Design and Purge iLogic after creation?

W_Barnett
Enthusiast Enthusiast
250 Views
2 Replies
Message 1 of 3

Using iLogic to Copy a Design and Purge iLogic after creation?

W_Barnett
Enthusiast
Enthusiast

I've got a code that currently copies my design over and gives it a specific file name and I'm trying to run an iLogic Purge Rule after it has been created.  See below:

Sub main
	Dim oDoc As Inventor.Document = ThisApplication.ActiveDocument
	Dim oPath As String = "C:\Custom Path\"                               'Save Path
	Dim oNewName As String = Custom_PN                                    'Pre-Configured Part Number
	Dim oType As String = ".iam"
	
	Dim newDocPath As String = oPath & oNewName & oType
	oDoc.SaveAs(newDocPath, True)

	iLogicAuto.RunExternalRule(newDocPath, "iLogicPurge")


End Sub

 

Both codes work by themselves already, however I don't know how to run an iLogic Rule that exists in an external component.  I will likely never open this external assembly as it simply exists to drive design configurations within drawings.

 

Is there a way to do this?  Or would I need to set up some sort of trigger in the new assembly?  Not exactly sure what the best avenue to go down is...Any advice would be great.

Thanks!

0 Likes
251 Views
2 Replies
Replies (2)
Message 2 of 3

JelteDeJong
Mentor
Mentor

I'm not sure if I understand correctly. Are you trying to purge iLogic rules from a document? If so then why are those rules in that document in the first place? If you run those rules as external rules then you don't need to purge them from the document.

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 3 of 3

W_Barnett
Enthusiast
Enthusiast

Hey, sorry for the delayed response.

 

So, I built a configurator that uses a lot of iLogic to modify the assembly, and then generates drawings from the resultant assembly.  This is a design that we use fairly regularly with different components and sizes, so a configurator is an ideal move forward, HOWEVER...there's a lot of back end stuff that needs to be done that can be automated as well, and this is one small step in that process.

 

Essentially, once I use the configurator and build out the assembly/drawing, I need to save that specific assembly into our server.  That model can't change, and I'm afraid that if I leave the iLogic in there someone could accidentally change the design if they go to open the part in the future.  The iLogic is designed to build out the part and generate the resultant and save that, it's not built to make modifications to existing designs, so I'm trying to force users to go back to the original configurator file/template (the correct method) and generate a new model.  Basically, I'm trying to dummy-proof the design as much as possible.

 

In typing this up, I think I've found my answer on how to proceed in this particular scenario.  I need to save the configurator as a template and then make sure to run the Purge rule, prior to exporting out my configured assembly (i.e. purge everything except my Export Rule).  However, I think I should still follow through and ask whether or not it's possible to run an iLogic Rule in a totally separate file:

 

Assuming that my configurator is "Assembly A" and the resulting design is "Assembly B" that's saved/exported out to a known location, am I able to run an iLogic Rule in "Assembly B" from "Assembly A"?

 

 

0 Likes