Let's break down your code to see what's happening.
These two lines create two new Matrix3D objects. When you create a new matrix it is initialized with an identity matrix. As far as creating a new occurrence, if you use an identity matrix it will place it at the origin and without any rotation.
Ptr<Matrix3D> insertMatrix = Matrix3D::create();
Ptr<Matrix3D> oTransMatrix = Matrix3D::create();
This next line is calling a function of yours so I don't know what it's doing and is likely the reason for the difference in behavior. You're somehow getting a point from a component but I don't know what that point is.
// Function return origin when is inserted part
Ptr<Point3D> originComponent = GetOriginComponent(body);
This redefines one of the matrices so that it defines a rotation that defined at the point you got from the component and around the Y axis. It then transforms the other matrix using this one. Because the other matrix is an identity the matrix, the result after these two lines is that both matrices are exactly the same.
// Settings rotations
oTransMatrix->setToRotation(angle, Vector3D::create(0, 1, 0), originComponent);
insertMatrix->transformBy(oTransMatrix);
The resets this matrix back to an identity matrix. You would be the same result by creating a new matrix and assigning it that variable.
oTransMatrix->setToIdentity();
The first line is creating a vector and the second line is using this point to set the portion of the matrix that defines the position
Ptr<Vector3D> vector = Vector3D::create(insertPoint->x(), insertPoint->y(), insertPoint->z());
oTransMatrix->translation(vector);
This line essentially combines the position just defined with the position that already exists in the insertMatrix.
insertMatrix->transformBy(oTransMatrix);
And then you use the matrix to create a new occurrence. My code should position the occurrence at the location defined by the insertPoint argument and rotated around the Y-axis by the defined angle.
---------------------------------------------------------------
Brian EkinsInventor and Fusion 360 API Expert
Website/Blog:
https://EkinsSolutions.com