hikerVancouver Posted April 26, 2011 Share Posted April 26, 2011 When I open a dxf file using a script file, DWGPREFIX is a directory where script was executed from, and DWGNAME is a default "drawing.dwg" in opened file. Is it possible to change these variables without saving the file? I am using R14. Thank You. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted April 26, 2011 Share Posted April 26, 2011 Welcome to CADTutor! Unfortunately, the DWGNAME, and DWGPREFIX System Variables are Read-Only. Without seeing your code, it will be hard to suggest alternative / corrective action(s). Quote Link to comment Share on other sites More sharing options...
hikerVancouver Posted April 26, 2011 Author Share Posted April 26, 2011 My code is really basic. I just say: _open\n"full path to a file"\n in a src file which is passed to autocad with /b option when starting it. My goal is to open dxf file in autocad, and if user changes it and type "dxfout" on a command prompt, h(s)e doesn't have to remember original file path/name and retype it or search for it. Saving file after opening it is not an option in this case. Thank for quick reply. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted April 26, 2011 Share Posted April 26, 2011 (edited) My code is really basic. I just say: _open\n"full path to a file"\n in a src file which is passed to autocad with /b option when starting it. My goal is to open dxf file in autocad, and if user changes it and type "dxfout" on a command prompt, h(s)e doesn't have to remember original file path/name and retype it or search for it. Saving file after opening it is not an option in this case. Thank for quick reply. Why not instead try using the /t switch? Sample application icon target: [size=2]"C:\AutoCAD 20[color=red]xx[/color]\acad.exe" /nologo /p "C:\profiles\[color=red]MyProfile[/color]" [color=blue]/t [/color]"C:\[color=black]MyTemplates[/color]\[color=red]MyTemplate[/color]"[/size] Edit - AutoCAD Startup Switches Edited April 26, 2011 by BlackBox Added link Quote Link to comment Share on other sites More sharing options...
hikerVancouver Posted April 26, 2011 Author Share Posted April 26, 2011 I have never created templates. Would you be able to show an example of a file which I could use/modify for this purpose? Files will never come from exact same directory. My guess is that in a template I would have to specify name or? Thank You once again for looking into this. Quote Link to comment Share on other sites More sharing options...
hikerVancouver Posted April 26, 2011 Author Share Posted April 26, 2011 I have figured out DWGPREFIX part. Because I start a script from within another application by calling WIN API CreateProcess(), I specified "startIn" to be a directory where dxf file was read from. Is it possible to "overload" autocad commands? What I am having in mind is to create a lisp routine so if user types "dxfout", in the place of DWGNAME, dxfout would use USERS1 variable which I could set as dxf file is being open. If this is possible, what file should I be looking into modifying? Does anybody have any examples of this? Quote Link to comment Share on other sites More sharing options...
Grant Posted April 27, 2011 Share Posted April 27, 2011 Lisp routines will not work past an open command where a script file will. To automate lisp and scripts - it is a little difficult but here is the process. Run a lisp to write a script of the file you want to open use the script to open the file use the same script to run another lisp routine (once the file is open) Once the file is open you should be able to get the DWGPREFIX and DWGNAME variables and sort from there. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted April 27, 2011 Share Posted April 27, 2011 One minor correction... AutoLisp routines will not work past an open command where a script file will. To automate lisp and scripts - it is a little difficult but here is the process. Run a lisp to write a script of the file you want to open use the script to open the file use the same script to run another lisp routine (once the file is open) Once the file is open you should be able to get the DWGPREFIX and DWGNAME variables and sort from there. I'll offer ObjectDBX as one example of Visual LISP being able to carry out tasks (not commands) after opening a drawing. Another way is to open a drawing by invoking the Add Method upon the Documents Collection... this option would permit the use of Selection Sets, and Commands. In any event, drawing templates (.DWT) are incredibly valuable to any production team. Aptly named - the 'template' - what all of your drawings are based upon (i.e., System Variables, potentially including layer sets, named views, etc.). It is common to have a template for each client, and / or for separate disciplines. Instead of redefining (not overloading) the dxfout command, could you not simply write a custom routine to provide a command line, menu item, toolbar macro, and / or ribbon option for your users? Simply hard-code the desired seed file(s) into the routine's options (if applicable). *IF* you must use the dxfout command, perhaps a Command Reactor would be useful? ( I say the KISS principle should prevail; setup your templates, and write a custom routine... simple. Quote Link to comment Share on other sites More sharing options...
alanjt Posted April 27, 2011 Share Posted April 27, 2011 One minor correction... I'll offer ObjectDBX as one example of Visual LISP being able to carry out tasks (not commands) after opening a drawing. Another way is to open a drawing by invoking the Add Method upon the Documents Collection... this option would permit the use of Selection Sets, and Commands. In any event, drawing templates (.DWT) are incredibly valuable to any production team. Aptly named - the 'template' - what all of your drawings are based upon (i.e., System Variables, potentially including layer sets, named views, etc.). It is common to have a template for each client, and / or for separate disciplines. Instead of redefining (not overloading) the dxfout command, could you not simply write a custom routine to provide a command line, menu item, toolbar macro, and / or ribbon option for your users? Simply hard-code the desired seed file(s) into the routine's options (if applicable). *IF* you must use the dxfout command, perhaps a Command Reactor would be useful? ( I say the KISS principle should prevail; setup your templates, and write a custom routine... simple. *cough*he's running r14*cough* Quote Link to comment Share on other sites More sharing options...
BlackBox Posted April 27, 2011 Share Posted April 27, 2011 *cough*he's running r14*cough* I completely overlooked that. R14 was before my time... I take it that means scrap all the ActiveX COM fodder? Does it (R14) not support the use of DWT / AutoLSP / Macros? Quote Link to comment Share on other sites More sharing options...
alanjt Posted April 27, 2011 Share Posted April 27, 2011 I completely overlooked that. R14 was before my time... I take it that means scrap all the ActiveX COM fodder? Does it (R14) not support the use of DWT / AutoLSP / Macros? VLISP wasn't officially released until 2000, but it's supposed to have been an addon package for r14. As far as I remember, r14 allowed for templates. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted April 27, 2011 Share Posted April 27, 2011 VLISP wasn't officially released until 2000, but it's supposed to have been an addon package for r14. As far as I remember, r14 allowed for templates. At least my entire post wasn't irrelevant. LoL Hazzah! Quote Link to comment Share on other sites More sharing options...
Grant Posted April 27, 2011 Share Posted April 27, 2011 R14 will offer Lisp and scripts and Template files but not Visual lisp Thanks for your comments though as I have always done the Lisp/ Scripts way of opening drawings and never really looked at a Visual Lisp way. Probably because when I did this it was in R14!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.