|Top Previous Next|
The transient geometry object is a "motor" which lets you create COM points, matrices, vectors, and so on. Think of it like this:
// Set a reference to the transient geometry object.
CComPtr<TransientGeometry> pTrGeom = GetTransGeomPtr();
// Draw a 4cm x 3cm rectangle with the corner at (0,0)
CComPtr<Point2d> pPt1; // Create a 2d point
hr = pTrGeom->CreatePoint2d(0.0,0.0,&pPt1);
return ReturnAndShowCOMError (hr,L" create 2d point failed") ;
CComPtr<Point> pPt; // Create a 3d point
hr = pTrGeom->CreatePoint(0.5,0.5,0.0,&pPt);
return ReturnAndShowCOMError (hr,L" CreatePoint failed") ;
Note that above you've created a 2D point (CComPtr<Point2d>) and a 3D point (CComPtr<Point>) using the TransientGeometry object. Here's how to create a matrix:
hr = pTransGeom->CreateMatrix(&pMatrix);
And to create a Vector:
hr = pTransGeom->CreateVector(20,2,2,&pVector);
Note that these are "abstract geometrical" objects, not "concrete" CAD objects.
Note also that CComPtr will be initialised to nullptr automatically.
Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)