Hi @arnold.ogalo. What you are asking can be complicated to just provide a solution for, without having your exact CAD model files to test it on. There are a lot of variables involved, and questions that need to be answered.
However, below is a fairly basic example of creating an angular constraint between a components work plane proxy, and one of the main assembly's work planes. I don't know which component you want to target, or how you plan on identifying it, so I just specified a generic part type component name, as the one to target. I also do not know which plane of the component you want to create the constraint to, so I just specified the 'first' work plane found within the component, which will be one of its 'origin' planes. I did that same for the main assembly, since I did not know which one you wanted, I just specified the first one. Then, since I did not know what angle you wanted, I just specified 45 degrees.
If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kAssemblyDocumentObject Then
MsgBox("An Assembly Document must be active for this rule to work. Exiting.", vbCritical, "")
Exit Sub
End If
Dim oADoc As AssemblyDocument = ThisDoc.Document
Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition
Dim oOccs As ComponentOccurrences = oADef.Occurrences
Dim oConsts As AssemblyConstraints = oADef.Constraints
'specify which component you want to constrain (one way or another)
Dim oOcc As ComponentOccurrence = oOccs.ItemByName("Part1:1")
'specify which plane of the component you want to constrain
Dim oWP1 As WorkPlane = oOcc.Definition.WorkPlanes.Item(1)
'get its 'Proxy' (the copy of it that exists within the 3D space of the assembly)
Dim oWP1Proxy As WorkPlaneProxy = Nothing
'this sets the value of that last variable
oOcc.CreateGeometryProxy(oWP1, oWP1Proxy)
'now specify which Plane of the Assembly to constrain it to
Dim oAsmWP1 As WorkPlane = oADef.WorkPlanes.Item(1)
'now create the constraint between these two planes
'when specifying angle, if you specify a raw number, it will be understood as radians
'or you can specify angle with a String (expression), which contains the number followed by units specifier
Dim oAngleConst As AngleConstraint = oConsts.AddAngleConstraint(oWP1Proxy, oAsmWP1, "45 deg")
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Edit: Oops. This example is in iLogic, not VBA. In VBA you need to set variable's values on another line, using the 'Set' keyword, and you can't use the 'ThisDoc.Document' term (could use ThisApplication.ActiveDocument instead), but the rest should be fairly simple to translate.
Wesley Crihfield

(Not an Autodesk Employee)