Reply

problem about EdgePtr

[ Edited ]

 

Hello all,

I'working with VC2003 and SEV17, now i have a problem about EdgePtr.

At first I can get the EdgePtr pEdge, and i can know, that this edge a circle is, then

LPDISPATCH edgeGeo = pEdge->GetGeometry();

CirclePtr pCircle = pEdge;//hier is the pCircle not NULL!

but

double radius = pCircle->GetRadius();//hier get the exception:Access violation reading location 0x00000000

 

any ideas?

thanks

Julia

 

Posted by: Julia Schneider
Post date: 11/14/2007 2:54:20 AM

7 REPLIES

RE: problem about EdgePtr

[ Edited ]

 

Hello everyone,

please help me!!

I want to get the circleData from a EdgePtr, how can I do that?

thanks in advance

Julia

 

Posted by: Julia Schneider
Post date: 11/14/2007 9:47:28 PM

RE: problem about EdgePtr

[ Edited ]

Julia,

 

Upload some simple example source code and an example Solid Edge file and I will take a look at it.

 

Posted by: Jason Newell
Post date: 11/18/2007 8:03:06 PM

RE: problem about EdgePtr

[ Edited ]

 

Hello Jason,

here is a simple example source code.

I working with vc2003 and SE17 and SE20

thanks in advance

Julia

 

Posted by: Julia Schneider
Post date: 11/18/2007 9:30:13 PM

RE: problem about EdgePtr

[ Edited ]

 

and an example Solid Edge file

 

Posted by: Julia Schneider
Post date: 11/18/2007 9:32:14 PM

RE: problem about EdgePtr

[ Edited ]

 

Julia,

No error checking in my example as it's for demonstration only.// JuliaDemo.cpp : Defines the entry point for the console application.//#include "stdafx.h"int _tmain(int argc, _TCHAR* argv[]){ HRESULT hr = S_OK; CoInitialize(NULL); SolidEdgeFramework::ApplicationPtr pApplication = NULL; SolidEdgePart:Smiley TongueartDocumentPtr pPartDoc = NULL; SolidEdgePart::ModelPtr pModel = NULL; SolidEdgeGeometry::BodyPtr pBody = NULL; SolidEdgeGeometry::EdgesPtr pEdges = NULL; SolidEdgeGeometry::EdgePtr pEdge = NULL; SolidEdgeGeometry::CirclePtr pCircle = NULL; pApplication.GetActiveObject(_T("SolidEdge.Application")); pPartDoc = pApplication->ActiveDocument; pModel = pPartDoc->Models->Item((LONG)1); pBody = pModel->Body; pEdges = pBody->GetEdges(SolidEdgeGeometry::igQueryAll); for (LONG i = 1; i Count; i++) { pEdge = pEdges->Item(i); SolidEdgeGeometry::GNTTypePropertyConstants gntType = pEdge->Type; SAFEARRAY *pCenterPoint = SafeArrayCreateVector(VT_R8, 0, 0); SAFEARRAY *pAxisVector = SafeArrayCreateVector(VT_R8, 0, 0); double Radius = 0; switch (pEdge->Type) { case SolidEdgeGeometry::igBody: break; case SolidEdgeGeometry::igBSplineCurve: break; case SolidEdgeGeometry::igBSplineSurface: break; case SolidEdgeGeometry::igCircle: break; case SolidEdgeGeometry::igCone: break; case SolidEdgeGeometry::igCurve: break; case SolidEdgeGeometry::igCurveBody: break; case SolidEdgeGeometry::igCurvePath: break; case SolidEdgeGeometry::igCylinder: break; case SolidEdgeGeometry::igEdge: pCircle = pEdge->GetGeometry(); /* Put breakpoint here and look at the results of GetCircleData() */ /* Add pCenterPoint, pAxisVector & Radius to your watch window */ pCircle->GetCircleData(&pCenterPoint, &pAxisVector, &Radius); /* Clear Radius to make sure GetRadius() changes the value */ Radius = 0; /* This also works */ Radius = pCircle->GetRadius(); /* This is here so that you can see the results of GetRadius() */ Radius = 0; break; case SolidEdgeGeometry::igEdgeUse: break; case SolidEdgeGeometry::igEllipse: break; case SolidEdgeGeometry::igFace: break; case SolidEdgeGeometry::igLine: break; case SolidEdgeGeometry::igLoop: break; case SolidEdgeGeometry::igParamBSplineCurve: break; case SolidEdgeGeometry::igPlane: break; case SolidEdgeGeometry::igShell: break; case SolidEdgeGeometry::igSphere: break; case SolidEdgeGeometry::igTorus: break; case SolidEdgeGeometry::igVertex: break; } } pCircle = NULL; pEdge = NULL; pEdges = NULL; pBody = NULL; pModel = NULL; pPartDoc = NULL; pApplication = NULL; CoUninitialize(); return 0;}

 

Posted by: Jason Newell
Post date: 11/19/2007 1:03:05 PM

RE: problem about EdgePtr

[ Edited ]

Hello Jason,

 

thank you very much!!

 

but if I don't know wether an Edge is a circle or cone, how can I get the Type of the Edge?

 

(from pEdge->Type get only "igEdge" not "igCircle" or "igCone")

 

thanks a lot

Julia

 

Posted by: Julia Schneider
Post date: 11/20/2007 12:18:27 AM

RE: problem about EdgePtr

[ Edited ]

Julia,

 

I also found it odd that pEdge->Type always return type igEdge. Not quite sure why and I didn't have time to look into it. I was focusing on getting you a working example of GetRadius().

 

Posted by: Jason Newell
Post date: 11/25/2007 5:06:25 PM