Yep, you don't understand the concept of Proxy. Back up your thought process and start here:
Assembly has a
AssemblyComponentDefinition has a list of
Occurrences which is actually a list of
ComponentOccurrence
Each ComponentOccurrence has a map to his position in the assembly space, you can get its objects relative to this map by using
CreateGeometryProxy(original object in definition, proxy version of object)
Once it succeeds the proxyObject has the transformation matrix already applied, but you don't need to think in matrixes because it also tells you about each feature based on the built in matrix of the componentoccurrence.
So an example:
dim asmDoc as AssemblyDocument = ThisDocument
dim acd as AssemblyComponentDefinition = asmDoc.ComponentDefinition
dim ocFlange1 as ComponentOccurrence = acd.Occurrences("iLogic_flange:1") 'this assumes you can find the existing item by name. Other methods would be to cycle through the list and look for an item by comparing names.
dim wpCenter as WorkPoint = ocFlange1.ComponentDefinition.WorkPoints(1)
dim pxWpCenter as WorkPointProxy = Nothing 'notice that many objects have a Proxy type parallel to it.
ocFlange1.CreateGeometryProxy(wpCenter, pxWpCenter)
If pxWpCenter IsNot Nothing Then
debug.print(wpCenter.Point.X)
debug.print(pxWpCenter.Point.X)
End If
You will see the two centerpoints are different. One is defined in the space of the original part, the other is defined in the space of the assembly. And that explains the Proxy concept.
Now back to your original question. You wan to add a component to the assembly component definition.
You first need the ComponentOccurrences object from the AssemblyDocument.ComponentDefinition.Occurrences
dim compOccs as ComponentOccurrences = acd.Occurrences
dim tg as TransientGeometry = thisApplication.TransientGeometry 'use this to create points, vectors, and matrices out of thin air
Dim pMat As Matrix = tg.CreateMatrix()
pMat.SetTranslation(tg.CreateVector(0, 0, 0))'this creates a position vector from nowhere to nowhere (insert at origin)
dim coFlange = compOccs.Add(partdocfilenameandpath, pMat)
So now you need to decide, do you need to create a simple matrix to put a part into space or get a matrix from an existing part and use. If you have an existing component occurrence and want to get the its transformation to apply (or copy and modify) to another component occurrence, the use the co.Tranformation property to get the Matrix.
Any better?
jvj