Solidworks api (IAddBodies)

Hi, I am coding to implement to extract mass property from given part file using C++ I want to add bodies using MassProperty.IAddBodies() However, whenever nBodyCount is bigger than 1, IAddBodies function does not work. in fact, program downs. I have tried several things and to find related reference but I could not. Thus can you help me? Code is following .. hres = comp->GetBodies2(swSolidBody, &vBodyArr); SAFEARRAY *pSafeArrBody = V_ARRAY(&vBodyArr); LPDISPATCH *pDispArrBody = NULL; long nBodyCount = -1; long nBodyHighIndex = -1; hres = SafeArrayAccessData(pSafeArrBody, (void **) &pDispArrBody); (*pDispArrBody)->QueryInterface(__uuidof(IBody2), reinterpret_cast(&pBodyArr)); hres = SafeArrayGetUBound(pSafeArrBody, 1, &nBodyHighIndex); nBodyCount = nBodyHighIndex + 1; (*massProperty)->IAddBodies(nBodyCount, &pb, &isAdded); ..

Thanks

-- Message posted using

formatting link
information at
formatting link

Reply to
kurtinpunk
Loading thread data ...

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.