Hi @rbertoletti. It all depends on how you plan on creating the constraint. If using the Inventor API tools, then you will not need to specify the 'ancestry' of the component, or the name of the entity within that component, just the actual entity itself. However, if using the iLogic API tools, then you must specify 'names' of objects, rather than the actual objects themselves. And in that case, when it comes to specifying which components are involved, it wants what it calls a ComponentArgument. This can either be the simple name of the component (as seen in the model browser), or it can be an Array of Strings which starts with the name of the top level component that represents a sub assembly, then each sub component below that, including the component you are dealing with directly.
Correction: In my statements above about how to specify the ComponentArgument, when using the iLogic tools, I left out one possible way. You can also specify a ManagedComponentOccurrence. To explain what this is...when using the Pick function, you will get the 'normal' Inventor API object as its value, not one of these iLogic specific variations of that type of object. You get a ManagedComponentOccurrence when using iLogic tools like Components.Item property (aka IManagedComponents.Item property), or Components.Add method (aka IManagedComponents.Add method).
Edit: If you need to create/generate that Array of Strings in a more intuitive way, the Inventor API object that represents an assembly component (ComponentOccurrence) has a property (ComponentOccurrence.OccurrencePath) that will return a ComponentOccurrencesEnumerator, which will contain each ComponentOccurrence in the path of that component, starting with the top level component, and including that original component as its last entry. That can be used to extract their names from for the Array of Strings you may need. Below is an example of a custom Function that can be used for that purpose.
Function GetComponentPath(oOcc As ComponentOccurrence) As String()
If oOcc Is Nothing Then Return Nothing
Dim oOccPathOccs As ComponentOccurrencesEnumerator = oOcc.OccurrencePath
Dim oOccPath(oOccPathOccs.Count - 1) As String
For i As Integer = 1 To oOccPathOccs.Count
oOccPath(i-1) = oOccPathOccs.Item(i).Name
Next
Return oOccPath
End Function
Wesley Crihfield

(Not an Autodesk Employee)