Hi All, hope everyone is well.
I've posted previously but didn't get any response, I will try to explain better what I'm doing and what I'm trying to achieve. I am very new and basic to iLogic rules and programming/writing code and have only done bare basics just by trial and error and watching/reading tutorials and forums. I don't have any previous programming/coding experience.
Firstly, I have created an assembly of a post which is used to fix FRP guard panels to along conveyors. The assembly has an iLogic rule and form to configure the assembly using different dimensions and model states, linked to a master part that drives all the dimensions. I have multiple defect locations where I need to use different sizes/configurations of posts, and sometimes different alterations of a post in the same assembly, which is why "Place iLogic Component" would be excellent if I can make it work, because I will be able to have separate posts for separate defects.
Now when I open the assembly and configure it in it's own assembly window, it's fine. But as soon as I go to "Place iLogic Component", the rule doesn't work because it is now referencing the top-level assembly to run the rule which doesn't have the model states listed in the rule.
So basically I'm asking, how can I make the iLogic rule be referring to the assembly/sub-assembly rather than the top level assembly, to allow placing and configuring the posts within the top-level assembly. Is this achievable, or is there another way I can do this that you would recommend. If you need any further information, or files, rules etc. to understand what is happening better, please let me know. I hope someone can help with this, and thank you in advance.
Kind regards,
Kerem
Using place ilogic component should only be used to manage the configuration documents effectively the file naming and partial parameter changes. Any ilogic rules used to create the configuration need to be activated after the configurations have been placed. Because ilogic place component is a stand alone tool it can't be customized while it is being used except for basic parameter changes of pre-existing files.
If you need further help then some images of the files, changes needed etc will help find a solution .
Hi @A.Acheson,
So I have an assembly of the configurable post, inside that assembly I have my components, sub-assemblies and a Master.ipt which drives post sizes and configurations. I also have Model States for different configurations of the posts.
Once I place that post assembly into another assembly using "Place iLogic Component" it brings up the configuration window, but when I try to press OK it says it cannot find the Model State inside the top level assembly, which is a assembly of all existing structure.
So I was just wondering how to the rule to reference the post assembly as the active assembly as opposed to the top-level assembly, does this make some more sense?
Here's the link to my previous post with some pictures of the posts and configurations: https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-for-modifiable-posts-in-assembly/m...
This is the current iLogic rule that is in the post assembly file, after watching more videos and reading writing rules, I think maybe it requires Inventor API which I don't really understand.
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()
Parameter("Master", "Pipe_Diameter")=Pipe_Diameter
Parameter("Master", "Pipe_Wall_Thk")=Pipe_Wall_Thk
Parameter("Master", "BtmPost_to_StringerCrs")=BtmPost_to_StringerCrs
Parameter("Master", "Post_Length")=Post_Length
Parameter("Master", "Post_BoltCrs")=Post_BoltCrs
Parameter("Master", "Post_BoltGauge")=Post_BoltGauge
Parameter("Master", "Cradle_Inside")=Cradle_Inside
Parameter("Master", "Pipe_Len")=Pipe_Len
Thank you for your response Alan, hopefully this is a little more informative, any help is appreciated 🙂
P.S. If you need me to, I can Pack & Go the assembly file and attach it if you would like a better understanding and first hand view.
Kerem
You can probably avoid the Inventor API by just using capture snippet tool after first placing the bolts manually. If you are continuously using the same bolt then simply deleting the constraint /remaking the constraint would be enough to make it work. Maybe you can attach any portion of the code your having difficulty with along with some images.
Hi Alan, @A.Acheson
I have attached a Pack & Go of the post for your reference, including master part file, all individual component files, and post assembly with the rule.
Below is a basic explanation of my work flow with some screenshots attached to help clarify things a little further.
I start off with an existing structure assembly like this:
The finished product looks like this, after I've create a new general assembly with new components (posts and guard panels), like this:
Sometimes my posts are different sizes and bolt configurations i.e. (double bolt, single (centre), single (left), single (right).
I place my assembly using "Place iLogic Component" into the new GA (general assembly) and I get my form pop up to configure the post assembly:
Once I configure it and try to press done, I get this error message, but different code error lines for different post types/model states:
Is there a way to make sure that the rule in the assembly file is referring to the post assembly and not the top level assembly.
If this is not possible, is it possible to create a rule to add as a button in my form to save a copy of my configuration and export to a new assembly file with a prompt to enter a new name. I've seen it done on YouTube, but I haven't seen tutorials for how it's done.
1. Open stand alone post assembly
2. Configure it as required
3. Press a button on the form to save that certain configuration as a new assembly with a new name to insert into my top level assembly.
4. Repeat if more that one type of post is needed.
Hope this helps clear things up a little more, and if its easier to do what I mentioned as a "Save copy as" rule/form button, any help with that would be greatly appreciated.
Thanks for your responses so far, it is greatly appreciated. Looking forward to hearing from you soon.
Kind regards,
Kerem
I haven't used model states in general and in this manner so my only thoughts are to read the error message and try and carry out the change your trying to do manually then work through the code to do it by code.
It looks like on row 18 your using ilogic API line to get active model state from ThisDoc. Can you check that ThisDoc.Fullfilename is the document your expecting to change? Run it through a message box.
" Is there a way to make sure that the rule in the assembly file is referring to the post assembly and not the top level assembly."
Yes you can do this by correctly targeting the occurrence.
Can't find what you're looking for? Ask the community or share your knowledge.