Thanks for your reply HermJan, I had to do it in C++ and got an solution close to yours...
// Get the proxy of the axis
CComPtr<WorkAxisProxy> pNodeWAZProxy ;
ZAxisArray[1]->get_Item(2,(IDispatch**)&pNodeWAZProxy);
CComPtr<TransientGeometry> pTransGeom = theApp.GetTransGeomPtr () ;
LinePtr pLine = pNodeWAZProxy->GetLine();
PointPtr pLineRoot = pLine->GetRootPoint();
UnitVectorPtr pLineDir = pLine->GetDirection();
CComPtr <Vector> pvecDir ;
hRes = pLineDir->AsVector(&pvecDir);
if (FAILED(hRes)) {
gLogger.Printf(ekErrMsg, "Could not get AsVector");
return;
}
CComPtr <Line> pZAxis;
hRes = pTransGeom->CreateLine (pLineRoot,pvecDir,&pZAxis);
if (FAILED(hRes)) {
gLogger.Printf(ekErrMsg, "Could not CreateLine");
return;
}
CComPtr<Point> pOrigin;
CComPtr<Point> p1;
CComPtr<Point> p2;
pTransGeom->CreatePoint(0, 0, 0, &pOrigin);
pTransGeom->CreatePoint(1, 0, 0, &p1);
pTransGeom->CreatePoint(0, 1, 0, &p2);
CComPtr<Plane> pGeomXYPlane;
hRes = pTransGeom->CreatePlaneByThreePoints(pOrigin, p1, p2, &pGeomXYPlane);
if (FAILED(hRes)) {
gLogger.Printf(ekErrMsg, "Could not CreatePlane");
return;
}
CComPtr <ObjectsEnumerator> pObjEnum;
hRes = pTransGeom->CurveSurfaceIntersection(pZAxis, pGeomXYPlane, 0.1, &pObjEnum);
if (FAILED(hRes)) {
gLogger.Printf(ekErrMsg, "Could not surface intersection");
return;
}
TRACE ("There are %d intersections...\n",pObjEnum->Count);
if (pObjEnum->Count < 1) {
gLogger.Printf(ekErrMsg, "No intersections found...");
return;
}
CComPtr <Point> pIntersectionPoint;
hRes = pObjEnum->get_Item(1,(IDispatch**)&pIntersectionPoint);
if (FAILED(hRes)) {
gLogger.Printf(ekErrMsg, "Could not get intersection point");
return;
}
TRACE("Intersection at %.2f %.2f %.2f \n",
pIntersectionPoint->GetX(),
pIntersectionPoint->GetY(),
pIntersectionPoint->GetZ());
CComPtr<WorkPoints> pWorkPoints;
hRes =pAssemblyCompDef->get_WorkPoints(&pWorkPoints);
if (FAILED(hRes)) {
gLogger.Printf(ekErrMsg, "Could not get work points");
return;
}
CComPtr <WorkPoint> pInterWorkPoint;
pWorkPoints->AddFixed (pIntersectionPoint,FALSE,&pInterWorkPoint);
if (FAILED(hRes)) {
gLogger.Printf(ekErrMsg, "AddFixed point failed");
return;
}
CComBSTR bstrPointName("ZeroPoint");
hRes = pInterWorkPoint->put_Name(bstrPointName);
if (FAILED(hRes)) {
gLogger.Printf(ekErrMsg, "AddFixed point failed");
return;
}
Lots of error checking and C++ is more verbose than VB, but it is like your solution...