- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Update an assembly rule from a part file
So I found a way to run a rule from the part level and that would be to open a new instance of the assembly and open the rule that way. There has to be some other way to get the rule to trigger.
Simply put, there is a rule to change the placement of a brace in the sub-assembly. When the part updates, it blows the brace out to the wrong spot. To update it, I have to run the rule in the assembly again so that it can update the parameters it receives from the part.
So my question: Is there a way to trigger a rule when a part in the assembly is updated? The part is named the same as the assembly if that helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi briandaley,
I am not 100% sure to have understood you question properly, but if you are in the assembly you could run the rule in the component using:
SyntaxEditor Code Snippet
iLogicVb.RunRule("PartA:1", "ruleName")
Then you should be able to update the assembly.
Is that what you were trying to do?
Best regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
i also do not understand what he is trying to do @RodrigoEiras ![]()
if you change parameters in a part, which updates the part model the part which is shown in the assembly will update accordingly, Without ilogic.
if you will change parameters in the assembly which should also change the parameters in your part. you have to link you parameters in the asm with the parameters in the part.
SyntaxEditor Code Snippet
'First ist the Parameter in you Part, second is the Parameter in the Assembly which should be the equal name
'You have to create the Parameter by your own in the assembly
Parameter("PartModel:1", "Parametername") = Parametername
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
To clarify, I'm in the part environment to change the part. In the assembly, I'm using that code to drive the parameters in the assembly but it doesn't update immediately.
Dim model As String = ThisDoc.Document.DisplayName & ".ipt"
Try
radius = Parameter(model, "radius")
ReverseInt = Parameter(model, "ReverseInt")
Catch
MessageBox.Show("Model name does not match the assembly name","Z-Rib Placement Error")
Return
End TryThis code won't update the parameters when I change the part file unless I return to the assembly and run the rule again. I'm looking for a way to update this when the part updates.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
When I do this, I access the part through the ComponentOcurrence in the assembly. Something like this.
SyntaxEditor Code Snippet
Parameter("Head:1", "d1")
When the parameters have been updated, if the assembly is not updated automatically, you can add a line to update it.
SyntaxEditor Code Snippet
'Update the assembly InventorVb.DocumentUpdate()
When you save the assembly it will save the assembly and the modified parts.
This combination works fine for me.
I hope it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Unfortunately I already had that in my assembly rule but it didn't work. I added the rule to the Event Trigger to update before save and that seemed to help. It's not a perfect solution but it works better than what it was before...