You are probably getting that error because you are not using SolidWorks 2014, and IPartDoc::ExportToDWG2 was first added in 2014. So you need to use IPartDoc::ExportToDWG. This will not affect any of the arguments. So simply remove the “2”.
Ready to start learning the SolidWorks API? Sign up for FREE membership here.Keep up with new videos, macros, and training events by joining our mailing list:
Getting run time error 438 in line ” retVal = swPart.ExportToDWG2(strPath, swModel.GetPathName, swExportToDWG_ExportAnnotationViews, _
True, varAlignment, False, False, Empty, varViews) “
You are probably getting that error because you are not using SolidWorks 2014, and IPartDoc::ExportToDWG2 was first added in 2014. So you need to use IPartDoc::ExportToDWG. This will not affect any of the arguments. So simply remove the “2”.
I was able to get the macros to run in Solidworks 2013, but it says, “Failed to save DXF.” What could be causing this?
If trying the suggestion I mentioned to the gentleman above didn’t work, please send me your part so I can debug on my end.