Hello guys,
I currently have the following in my code:
SldWorks swApp;
ModelDoc2 swModel;
Modeler swModeler;
Body2 swBody;
Feature swFeat;
PartDoc swPart= default(PartDoc);
swModel = (ModelDoc2)swApp.ActiveDoc;
swModeler = (Modeler)swApp.GetModeler();
swBody = swModeler.CreateBodyFromBox3(dblData); // dblData is an array[9] of double
swPart = (PartDoc)swModel; // <-- where the problem* occurs
swFeat = swPart.CreateFeatureFromBody3(swBody, false , 0);
[quote]
InvalidCastException was unhandled by user code
Unable to cast COM object of type 'System.__ComObject' to interface type 'SolidWorks.Interop.sldworks.PartDoc'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{83A33D32-27C5-11CE-BFD4-00400513BB57}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
[/quote]
I've been looking at some "examples" on the net and they do it exactly like this. What could possibly be the issue here?
Thanks in advance for any help,
Rumen