几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   SolidWorks二次开发 (http://www.dimcax.com/hust/forumdisplay.php?f=111)
-   -   【转帖】saveas igsstep (http://www.dimcax.com/hust/showthread.php?t=4896)

yang686526 2009-04-12 10:18 PM

【转帖】saveas igsstep
 
saveas igs/step
i'm trying to create a simple function that exports the current drawing to .pdf, and exports the referenced model to .x_b, .igs and .step. the code is quite simply:
dim swexportpdfdata as sldworks.exportpdfdata = swapp.getexportfiledata(1)
swexportpdfdata.setsheets(swexportdatasheetstoexport_e.swexportdata_exportallsheets, nothing)
issaved = swdwg.extension.saveas(releasepath & aval & ".pdf", swsaveasversion_e.swsaveascurrentversion, swsaveasoptions_e.swsaveasoptions_silent, swexportpdfdata, nerrors, nwarnings)
issaved = swmodel.extension.saveas(releasepath & aval & ".x_b", swsaveasversion_e.swsaveascurrentversion, swsaveasoptions_e.swsaveasoptions_silent, nothing, nerrors, nwarnings)
issaved = swmodel.extension.saveas(releasepath & aval & ".igs", swsaveasversion_e.swsaveascurrentversion, swsaveasoptions_e.swsaveasoptions_silent, nothing, nerrors, nwarnings)
issaved = swmodel.extension.saveas(releasepath & aval & ".step", swsaveasversion_e.swsaveascurrentversion, swsaveasoptions_e.swsaveasoptions_silent, nothing, nerrors, nwarnings)
if each save fails, i record the save error and display a warning to the user. the pdf file saves fine, and the binary parasolid also saves without a problem. the igs and step files, however, do not save properly.
when saving the igs file, a .err file is created, and when saving the .step file, the following error occurs:
"attempted to read or write protected memory. this is often an indication that other memory is corrupt."
i've tried it on two different computers and receive the same message.
any thoughts would be appreciated!
thanks
one more piece of info, i'm running sw 2007 sp3.0.
answer solved!
the model document that was being saved was open, but not active when i ran the save command (since the command was initiated from the drawing).
by simply activating the model before converting to igs and step, the error messages disappeared.
quick


所有的时间均为北京时间。 现在的时间是 02:17 AM.