Ilogic rule to be copied into the assemblies iam's and ipt's

Ilogic rule to be copied into the assemblies iam's and ipt's

Liam.ArmstrongHTE6T
Enthusiast Enthusiast
615 Views
3 Replies
Message 1 of 4

Ilogic rule to be copied into the assemblies iam's and ipt's

Liam.ArmstrongHTE6T
Enthusiast
Enthusiast

I currently have a Ilogic rule in my top level assembly file which adds in custom iproperties into the file. I need the Ilogic rule to be copied into all of the iam and ipt files in the top level assembly. I know i am able to open up every file and copy and paste the rule into the files however due to the amount of iam and ipt files this will take a long time. Is there any way of speeding this process up using an ilogic rule or an external tool to copy Ilogic rule into all of the iam and ipts in my top level assembly file?

0 Likes
Accepted solutions (1)
616 Views
3 Replies
Replies (3)
Message 2 of 4

Sergio.D.Suárez
Mentor
Mentor

hi, can you share your rule so you can create the code with it? Grettings!


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

0 Likes
Message 3 of 4

Sergio.D.Suárez
Mentor
Mentor
Accepted solution

Hi, in a master assembly file execute the following ilogic rule.
This rule will write in each component an internal ilogic rule called "RuleTest", highlighted in red.

 

Auto = iLogicVb.Automation
Dim iLogicAuto As Object
iLogicAuto = Auto

Dim RuleName As String = "RuleTest"
Dim RuleText As String = "Dim oDoc As Document" & vbCrLf & _				 
						 "oDoc = ThisDoc.Document" & vbCrLf & vbCrLf & _
						"'define list of custom properties" & vbCrLf & vbCrLf & _
						"Dim MyArrayList As New ArrayList"
Dim iLogicAddIn As ApplicationAddIn = ThisApplication.ApplicationAddIns.ItemById("{3bdd8d79-2179-4b11-8a5a-257b1c0263ac}")
Dim iLogic As Object = iLogicAddIn.Automation

Dim AssyDoc As AssemblyDocument = ThisDoc.Document
Dim oCD As AssemblyComponentDefinition = AssyDoc.ComponentDefinition

For Each oCc As ComponentOccurrence In oCD.Occurrences
	On Error Resume Next
	Dim oDoc As Document = oCc.Definition.Document
	iLogic.DeleteRule(oDoc, RuleName)
	iLogic.AddRule(oDoc, RuleName, RuleText)
Next

 It is an extensive rule you should check for errors.
I hope this helps with your problem. Cheers


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 4 of 4

Sergio.D.Suárez
Mentor
Mentor

I just edited the code to make it more understandable, and not compromise information. I apologize for that. Grettings!


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

0 Likes