adding chamfers using c++

 

At the moment I am simply trying to add a chamfer to a cylinder.  I can make a circle and extrude it (although part of the code must be wrong even though it seems to work) but I cannot seem to add a chamfer to one of the faces on the cylinder.  This is the mess that I have so far.

 

SolidEdgeFramework::ApplicationPtr pApplication;

SolidEdgeFramework:Smiley Very HappyocumentsPtr pDocuments;

SolidEdgePart:Smiley TongueartDocumentPtr pPartDocument;

SolidEdgePart:Smiley TonguerofileSetsPtr pProfileSets;

SolidEdgePart:Smiley TonguerofileSetPtr pProfileSet;

SolidEdgePart:Smiley TonguerofilesPtr pProfiles;

SolidEdgePart:Smiley TonguerofilePtr pProfile;

SolidEdgePart::RefPlanesPtr pRefPlanes;

 SolidEdgeFrameworkSupport::Circles2dPtr pCircles2d;

 SolidEdgeFrameworkSupport::Circle2dPtr pCircle2d;

 SolidEdgePart::ModelsPtr pModels;

 SolidEdgePart::ModelPtr pModel;

SolidEdgePart::ExtrudedProtrusionsPtr pExtrudedProtrusions;

 SolidEdgePart::ExtrudedProtrusionPtr pExtrudedProtrusion;

 SolidEdgePart::ChamferPtr pChamfer;

 

     pApplication.GetActiveObject(_T("SolidEdge.Application"));

     pDocuments = pApplication->Documents;

     pPartDocument = pDocuments->Add(_T("SolidEdge.PartDocument"));

     pProfileSets = pPartDocument->ProfileSets;

     pProfileSet = pProfileSets->Add();

     pRefPlanes = pPartDocument->RefPlanes;

     pProfiles = pProfileSet->Profiles;

     pProfile = pProfiles->Add(pRefPlanes->Item((LONG)3));

 pCircles2d = pProfile->Circles2d;

 pCircle2d = pCircles2d->AddByCenterRadius(0,0,10);

 SAFEARRAY *aProfiles;

 aProfiles = SafeArrayCreateVector(VT_UNKNOWN, 0, 1);

 long indx;

 indx = 0;

 SafeArrayPutElement(aProfiles, &indx, pProfile);

 pModels = pPartDocument->Models;

 pModel = pModels->AddFiniteExtrudedProtrusion(1, &aProfiles, igRight, 100);

 SafeArrayDestroy(aProfiles);

 

 

 pExtrudedProtrusions = pModel->ExtrudedProtrusions;

 pExtrudedProtrusion = pExtrudedProtrusions->Item(1);

 SolidEdgeGeometry::EdgesPtr pEdges;

 SolidEdgeGeometry::EdgePtr pEdge;

 SolidEdgeGeometry::FacesPtr pFaces;

 SolidEdgeGeometry::FacePtr pFace;

 SolidEdgeGeometry::EdgePtr Edge[1];

 pEdges = pExtrudedProtrusion->GetEdges(SolidEdgeGeometry::igQueryAll);

 pEdge = pEdges->Item(1);

 Edge[0] = pEdge;

 pFaces = pExtrudedProtrusion->GetFaces(SolidEdgeGeometry::igQueryAll);

 pFace = pFaces->Item(1);

 pChamfer = pModel->Chamfers->AddUnequalSetback(pFace,1,Edge,1,2);

 

Posted by: Aaron Putman
Post date: 4/2/2010 10:28:20 AM