shakuhachi Posted December 14, 2010 Posted December 14, 2010 I'm new here and to autocad lisp as well so be patient with me. Here is my problem. I have a mechanical drawing which is being xref by the electrical department. My file is too big and when they open their files it takes a full minute and they always complain about it (I guess you already know if your on the mechanical side). So we decided to wblock only the the equipment that they need to see and save it on the same directory on where my mechanical drawing is and save it Mech-Elec.dwg. Its a pain doing this every time that I close my drawing. (defun c:ewblock (/) (command "clayer" "M-Floor") (command "-layer" "freeze" "~*|*" "") (COMMAND "-LAYER" "THAW" "M-Floor" "") (COMMAND "-LAYER" "THAW" "M-Ceiling" "") (COMMAND "-LAYER" "THAW" "M-Wall" "") (COMMAND "-LAYER" "THAW" "M-ROOF" "") (COMMAND "-LAYER" "THAW" "M-Tags" "") (COMMAND "-LAYER" "THAW" "M-Thermostat" "") (COMMAND "-LAYER" "THAW""M-Panel" "") (COMMAND "-LAYER" "THAW" "M-Ex-Floor" "") (COMMAND "-LAYER" "THAW" "M-Ex-Ceiling" "") (COMMAND "-LAYER" "THAW" "M-EX-Wall" "") (COMMAND "-LAYER" "THAW" "M-EX-ROOF" "") (COMMAND "-LAYER" "THAW" "M-EX-Thermostat" "") (COMMAND "-LAYER" "THAW""M-EX-Panel" "") (COMMAND "-WBLOCK") -- this is where I'm stuck. I want to automatically save it as Mech-Elec.dwg and on the same folder as my working drawing and use 0,0 as my base point. Please need help.... Quote
BIGAL Posted December 14, 2010 Posted December 14, 2010 Just watch the command line and put the answers in your program you can retrieve current directory etc and add a dwg name as a lisp variable also run it with filedia = 0 I think if you answer the dwg name with no path it will save it into the current directory Quote
shakuhachi Posted December 14, 2010 Author Posted December 14, 2010 the "-" in the -wblock already suppresses the dialog box. The output file is always saved on the last folder which I open and not on my working drawing directory. If I open my working drawing then open a plumbing drawing on the plumbing folder. Then run the code, it will save it under the Plumbing directory. My files were all over the file server. Quote
Grant Posted December 14, 2010 Posted December 14, 2010 You can get the file name by (SETQ DWG (GETVAR "DWGNAME")) (SETQ PRE (GETVAR "DWGPREFIX")) You can get what you want by an SSGET call (setq stuff (ssget)) Then you will need to WBLOCK Hope this helps Quote
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.