几何尺寸与公差论坛------致力于产品几何量公差标准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)
-   -   【转帖】get filename (http://www.dimcax.com/hust/showthread.php?t=5361)

yang686526 2009-04-13 11:02 AM

【转帖】get filename
 
get filename
i'm trying to understand vb and i'm having trouble getting the current filename to default in an inputbox. i have a routine that does a saveascopy to send files to our cnc programmer. it works as is, but i would like to go one step further. as it is now, an inputbox comes up with the input field blank. i would like to set the default to the filename. i may or may not change the name before sending it to the cnc, but most of the time i would keep the same name. i tried strtitl = modeldoc2.gettitle(), but i get an error. can you help me? thanks.
mike closson - cswa
sw 2009 sp3.0 x64
intel xeon e5345 dual 2.33ghz + 4gb ram
nvidia quadro fx 1500
vista business x64 sp1
3dconnexion spacepilot
you cannot call the function gettitle from the static modeldoc2 object, it needs to be aquired using swapp.activedoc or similar.
also, that function will return the title displayed at the top of the model in solidworks, not its filename; for that you need getpathname
thanks, luke. i've got it working now. in the future, i might try to tweak it more where it calls up the standard save as dialog box instead of just an input box. i think there would be times i would like to see what's already in the cnc folder as i'm sending new files to them.
mike closson - cswa
sw 2009 sp3.0 x64
intel xeon e5345 dual 2.33ghz + 4gb ram
nvidia quadro fx 1500
vista business x64 sp1
3dconnexion spacepilot
quick


所有的时间均为北京时间。 现在的时间是 12:00 PM.