Hi.
I deleted my question because I thought that i misunderstand too big.
I am get customproperty using GetCustomProperty on ISwDMApplication.
---source
CComPtr<ISwDMClassFactory> swClassFact;
CComPtr<ISwDMApplication> swDocMgr;
CComPtr<ISwDMDocument> swDoc;
~~~~
CComBSTR vrRetA;
SwDmCustomInfoType type;
CString name = propName;
VARIANT_BOOL ret;
hr = swDoc->GetCustomProperty(name.AllocSysString(), &type, &vrRetA);
So i can get property value in vrRetA.
But. this value is Value / Text expression's of solidworks file property. I want to get evaluate value.
for ex) i am getting SW-Mass@103.SLDPRT. But i want to get "139.0"
I think i have to use CustomPropertyManager. i found using this by vb. but it is difficult that write c++ to me.
waitting your help.
thank you.
I am trying this source. reference these.
2012 SOLIDWORKS API Help - Add Component and Mate Example (C++ COM)
2015 SOLIDWORKS API Help - Get Custom Properties of Referenced Part (VB.NET)
2015 SOLIDWORKS API Help - Traverse Bodies (C++/CLI)
2015 SOLIDWORKS API Help - Get Object's Persistent Reference ID Example (C++)
CComPtr<ISldWorks> swApp;
CComPtr<IModelDoc2> swModel;
CComPtr<IModelDocExtension> swDocExt;
CComPtr<ICustomPropertyManager> cusmgr;
long lErrors;
long lWarnings;
long lMateError;
CComBSTR sAssemblyName(L"c:\\Program Files\\test.sldasm");
CComBSTR sDefaultConfiguration(L"Default");
hres = swApp.CoCreateInstance(__uuidof(SldWorks), NULL, CLSCTX_LOCAL_SERVER);
CString con = "";
//swApp->IActivateDoc3((_bstr_t)con,VARIANT_FALSE,&lErrors, &swModel);
swApp->get_IActiveDoc2(&swModel);
swModel->get_Extension(&swDocExt);
swDocExt->get_CustomPropertyManager((_bstr_t)con, &cusmgr);
I expect to success to write like that.
But it can't get swModel both get_IActiveDoc2 and IActiveDoc2.
According to 2015 SOLIDWORKS API Help - Get Object's Persistent Reference ID Example (C++)
CComPtr<ISldWorks> swApp;
if(swApp.CoCreateInstance(L"SldWorks.Application", NULL, CLSCTX_LOCAL_SERVER) != S_OK){
return(0);
}
CComPtr<IModelDoc2> swDoc;
swApp->get_IActiveDoc2(&swDoc);
It is just create instance swApp next call get_IactiveDoc2.
I think that i doing same thing.But my source don't insert any thing to swModel.
swModel is null after swApp->get_IActiveDoc2 or swApp->IActivateDoc3 steady.
And happen error swModel->get_Extension(&swDocExt) becuase swModel is null.
I am really confusing.