iLogic for Modifiable Posts in Assembly

kerem.izmirli
Contributor

iLogic for Modifiable Posts in Assembly

kerem.izmirli
Contributor
Contributor

Hi, 

 

I am a complete beginner to iLogic and don't really understand the coding language, but I am trying to implement it into some of my designs for work. A brief run down on what I'm trying to achieve is create a assembly file of a guard post, which can be all different configurations (e.g., no of bolts, heights, mounting attachments, etc.) and I have managed to create this using model states (Inventor 2022) and multi-value parameters to determine what model state, and it works when I'm in the main assembly and configuring the posts, but once I place it into the top level assembly (existing structure where posts will be installed), I place it as "Place iLogic Component" and it doesn't work anymore. 

 

I am suspecting because in my rule I have put

 

 

 

 

ThisDoc.ActiveModelState = "Insert Post Type"

 

 

 

 

 and once I place it into the top level assembly it then references that assembly.

So I was wondering how I can make it reference my assembly model/file directly instead of ThisDoc.ActiveModel.

 

Here is an example of some code, it's probably not the right way, but it's self taught within a matter of two days, if anyone has anywhere I can learn iLogic coding and the language and anything else that may help, it would be much appreciated. 

Here's an example of where I started, then I would manually suppress/unsuppress in the model states.

 

If Post_Type = "A" And Post_NoBolts = "1" Then ThisDoc.ActiveModelState = "Type A-1"
If Post_Type = "A" & Post_NoBolts = "2" Then ThisDoc.ActiveModelState = "Type A-2"
If Post_Type = "B" & Post_NoBolts = "1" Then ThisDoc.ActiveModelState = "Type B-1"
If Post_Type = "B" & Post_NoBolts = "2" Then ThisDoc.ActiveModelState = "Type B-2"

 

After some tweaking, I have now done it like the following 

 

Parameter("Master", "Post_NoBolts") = Post_NoBolts

If Type = "A1" Then ThisDoc.ActiveModelState = "Type A-1"

If ThisDoc.ActiveModelState = "Type A-1" Then
	MultiValue.SetList("Post_Type", "A", "B")
Post_Type = "A"
MultiValue.SetList("Post_NoBolts", 1, 2)
Post_NoBolts = 1 ul
Post_BoltCrs  = 0 mm
Component.IsActive("LH Bolt") = True
Constraint.IsActive("LH Insert") = True
Component.IsActive("RH Bolt") = False
Constraint.IsActive("RH Insert") = False

End If

If Type = "A2" Then ThisDoc.ActiveModelState = "Type A-2"

If ThisDoc.ActiveModelState = "Type A-2" Then
	MultiValue.SetList("Post_Type", "A", "B")
Post_Type = "A"
MultiValue.SetList("Post_NoBolts", 1, 2)
Post_NoBolts = 2 ul
Post_BoltCrs  = 60 mm
Component.IsActive("LH Bolt") = True
Constraint.IsActive("LH Insert") = True
Component.IsActive("RH Bolt") = True
Constraint.IsActive("RH Insert") = True

End If

If Type = "B1" Then ThisDoc.ActiveModelState = "Type B-1"

If ThisDoc.ActiveModelState = "Type B-1" Then
	MultiValue.SetList("Post_Type", "A", "B")
Post_Type = "B"
MultiValue.SetList("Post_NoBolts", 1, 2)
Post_NoBolts = 1 ul
Post_BoltCrs  = 0 mm
Component.IsActive("LH Bolt") = True
Constraint.IsActive("LH Insert") = True
Component.IsActive("RH Bolt") = False
Constraint.IsActive("RH Insert") = False
Component.IsActive("Mount") = False


End If

If Type = "B2" Then ThisDoc.ActiveModelState = "Type B-2"

If ThisDoc.ActiveModelState = "Type B-2" Then
	MultiValue.SetList("Post_Type", "A", "B")
Post_Type = "B"
MultiValue.SetList("Post_NoBolts", 1, 2)
Post_NoBolts = 2 ul
Post_BoltCrs  = 60 mm
Component.IsActive("LH Bolt") = True
Constraint.IsActive("LH Insert") = True
Component.IsActive("RH Bolt") = True
Constraint.IsActive("RH Insert") = True
Component.IsActive("Mount") = False

End If

InventorVb.DocumentUpdate()

 

 

Anny help with this is greatly appreciated, thanks in advance for all the help.

 

Regards, Kerem

 

P.S. Please let me know if there is any more information required to assist me with this.

0 Likes
Reply
190 Views
0 Replies
Replies (0)