ComputePhysicalProperties Example

[ Edited ]



HRESULT ComputePhysicalProperties(PartDocumentPtr document);





HRESULT ComputePhysicalProperties(PartDocumentPtr document)



VariablesPtr pVariables;

variablePtr pDensity;

variablePtr pAccuracy;


_bstr_t sDensity("PhysicalProperties_Density");

_bstr_t sAccuracy("PhysicalProperties_Accuracy");

double dVolume = 0;

double dArea = 0;

double dMass = 0;

SAFEARRAY* saCenterOfGravity = NULL;

SAFEARRAY* saCenterOfVolume = NULL;

SAFEARRAY* saGlobalMomentsOfInteria = NULL;

SAFEARRAY* saPrincipalMomentsOfInteria = NULL;

SAFEARRAY* saPrincipalAxes = NULL;

SAFEARRAY* saRadiiOfGyration = NULL;

double dRelativeAccuracyAchieved;

int iStatus;


if (document != NULL)


if (document->Models->Count > 0)


pVariables = document->Variables;

pDensity = pVariables->Item(sDensity);

pAccuracy = pVariables->Item(sAccuracy);


















/* No Geometry */

hr = E_FAIL;





/* No document */




return hr;




Posted by: Jason Newell
Post date: 8/10/2006 5:48:02 AM


RE: ComputePhysicalProperties Example

[ Edited ]

I am having a problem understanding how to access Solid Edge from the AddIn code. I can manipulate the canned dialog window that were generated by the wizard, but it seems that when I try to use calls into Solid Edge, I come up with zip. I keep looking for documentation on the api calls, but I am not able to find or make sense of it. Is there any documentation out there for beginners?




Posted by: Brian Hemmerlein
Post date: 8/10/2006 9:22:16 AM

RE: ComputePhysicalProperties Example

[ Edited ]



There are a few examples in the \SDK folder of Solid Edge, but very dated. Your question really falls into a bigger issue in that the Solid Edge API does not have many good examples and the examples that are available are dated. This is what really motivated me to try and fill that gap by starting this website. I feel that the SE development community is for the most part on their own.


My best advice is to post your specific questions either on the SE newsgroups or here on my site. Usually either I or someone else can help.


I would also suggest that you download my C++ addin example and use that as a base for learning. The C++ wizard from SE is old and has a lot of functionality in it so it takes a bit more time to figure everything out. Plus my addin is built in VS.NET 2005 which, in my opinion, is much more user friendly than VC++ 6.0. If you're new to VC++, you can't expect to "get it" quickly. It takes time and effort on your part to bring yourself up to speed with the language. I can also supplement your learning by providing useful relevant examples.


Posted by: Jason Newell
Post date: 8/11/2006 5:49:17 AM