Hi @berry.lejeune. Based solely on your response in Message 5 above, here is an iLogic rule example that should do all of those things you were asking about there.
It first makes sure you are working with an assembly, then allows you to manually 'Pick' an assembly component. You will notice that there are two possible filters for that action. One will allow you to pick all top level components, and sub assemblies, but may not allow you to pick individual part type components that are down within sub assemblies. The other filter will only allow you to pick part type components, and at any level of the assembly. I left that second one commented out for now, but you can choose which will work better for you, then either change which line is commented out, or delete one of those lines, then make sure the other line is uncommented. Next it will 'activate' the component (enter into Edit Mode for that component). Next it will show the global iLogic form, in Modal mode. I left some comments in the code about what that means, but will mention it here too, because it is important. When a Form is shown in Modal mode, that means it commands focus while it is showing, and you can not interact with other things in Inventor while it is showing. However it also means that the iLogic rule that launched that form modally, will remain 'paused' while it is showing, then resume when it is closed, which is needed here, if this rule is the one showing the form. If this rule shows the form NonModal, then the rule's code will immediately continue running, before you even have a chance to interact stuff in the Form. Then, depending on how the Form was closed, it will react accordingly. For instance, if you Canceled, Closed, or clicked the 'X' on the Form, it will exit edit mode of this component, then exit the rule. But if you clicked Done, OK, or clicked a 'run rule' type button which closed the form, then things in the code will proceed to update the document that the component is referencing, then 'deactivate' (exit out of edit mode) the component, then update the assembly. Then it will repeat those steps at the point where it asks you to pick a component.
Sub Main
Dim oADoc As AssemblyDocument = TryCast(ThisDoc.Document, Inventor.AssemblyDocument)
If oADoc Is Nothing Then Return
Dim oCM As Inventor.CommandManager = ThisApplication.CommandManager
Dim oPickedOcc As ComponentOccurrence
Dim sPrompt As String = "Pick Component (Press ESC key to exit selection mode)"
'this next line is just a place marker for the 'GoTo' line at the end, for repeating
'to exit this loop, simply do not select anything (use escape keyboard key)
GoAgain :
oPickedOcc = Nothing
oPickedOcc = oCM.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, sPrompt)
'use the one below to pick only part type components at any level of the assembly
'oPickedOcc = oCM.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, sPrompt)
If oPickedOcc Is Nothing Then Return 'exit the rule
'activate this component for in-place editing within the assembly
oPickedOcc.Edit
'Modal means you can not interact with other things while the form is showing
'Modal also means this code will be paused while it is showing, then resume when it is closed
'if shown non-modal, this code will continue before your interactions within the form
Dim oRFV As FormReturnValue = iLogicForm.ShowGlobal("Afmetingen rug", FormMode.Modal)
'if the form was shown Modal, then the form is closed again at this point
Select Case oRFV.Result
Case FormResult.Cancel, FormResult.Close, FormResult.None
oPickedOcc.ExitEdit(ExitTypeEnum.kExitToPrevious)
Return 'exit the rule
Case FormResult.Done, FormResult.OK, FormResult.RuleButtonApplyAndClose, FormResult.RuleButtonClose
Dim oOccDoc As Inventor.Document = ThisApplication.ActiveEditDocument
If oOccDoc.RequiresUpdate Then oOccDoc.Update2(True)
'If oOccDoc.Dirty Then oOccDoc.Save
End Select
oPickedOcc.ExitEdit(ExitTypeEnum.kExitToPrevious)
If oADoc.RequiresUpdate Then oADoc.Update2(True)
GoTo GoAgain
End Sub
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield

(Not an Autodesk Employee)