AnsweredAssumed Answered

Unable to cast COM object of type "Solidworks.Interop.sldworks.sldworksclass" to interface type "Solidworks.Interop.sldworks.Isldworksclass".

Question asked by Sarab Jot on Jul 17, 2019
Latest reply on Jul 17, 2019 by Artem Taturevych

Hi,

I am using Solidworks .net API to traverse a model's parts. But i'm getting 

"Unable to cast COM object of type "Solidworks.Interop.sldworks.sldworksclass" to interface type "Solidworks.Interop.sldworks.Isldworksclass".This operation failed because the QueryInterface call on the COM component for the interface with IID '{83A33D22-27C5-11CE-BFD4-00400513BB57}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)). at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease) at SolidWorks.Interop.sldworks.SldWorksClass.set_UserControl(Boolean Retval).

Below is the code snippet :-

 

ISldWorks^ swApp;
swApp = gcnew SldWorksClass;
if (!swApp) {
return;
}
swApp->UserControl = true;

 

Kindly suggest. Thanks in advance

Outcomes