Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Member
crashcup99
Posts: 3
Registered: ‎10-27-2009
Message 11 of 21 (1,661 Views)

Re: Open, Purge All, Zoom Extents, then Save, Lisp routine.

10-31-2009 12:15 PM in reply to: Ak_homegrown
Could I trouble you to provide the script that EZScript-Pro creates (Ezscript.scr) and a sample drawing (.DWF is fine) so I can try to recreate what you have seen? This is a first.

Ezscriptpro@yahoo.com
Member
Ak_homegrown
Posts: 5
Registered: ‎10-13-2009
Message 12 of 21 (1,661 Views)

Re: Open, Purge All, Zoom Extents, then Save, Lisp routine.

11-10-2009 03:02 PM in reply to: Ak_homegrown
Scott,

Thank you very much for your post, it worked great and is exactly what I needed! (And not above my comprehension!)
Member
crashcup99
Posts: 3
Registered: ‎10-27-2009
Message 13 of 21 (1,659 Views)

Re: Open, Purge All, Zoom Extents, then Save, Lisp routine.

07-15-2010 07:24 PM in reply to: Ak_homegrown



If you use EZScript-PRO on AutoCAD 2010, simply put the command RIBBON at the beginning of your scripts.

You can also put this ion the ACAD.lsp file.

 

This will always make sure that the ribbon does not 'dissapear' when a script is run from the command line.

New Member
e2luc
Posts: 2
Registered: ‎01-03-2012
Message 14 of 21 (1,270 Views)

Re: Open, Purge All, Zoom Extents, then Save, Lisp routine.

01-03-2012 08:32 AM in reply to: Ak_homegrown

Read this Lisp Routine Topic and thought if we could add Bind Xrefs and Explode to the mix that this could be powerful.  But do we even have to open the drawing?

 

Have it run the lisp Routine; Bind Insert Xrefs, Explode, Purge All, Zoom Extents, then Save

 

Any Help on this topic

Contributor
mn08jhh
Posts: 13
Registered: ‎03-21-2013
Message 15 of 21 (892 Views)

Re: Open, Purge All, Zoom Extents, then Save, Lisp routine.

07-25-2013 02:37 AM in reply to: scottbolton
Hi,

This is a sever thread revival, but this script is superb, thank you very much.

I am not very experienced with LSP and am wondering whether it's possible to modify the routine slightly to add a function that not only zooms to extents, but changes the view to SE, zooms extents, and sets home. Further to that, it would be great if it could do select all and set to Layer 0.

The reason why I ask is that all our models, which are blocks, tend to be saved on the outlines layer, which is causing problems. I need to move them en mass to Layer 0, and they are all blocks already so the save all function won't cause a problem.

Thanks in advance,

Jonathon
Contributor
mn08jhh
Posts: 13
Registered: ‎03-21-2013
Message 16 of 21 (887 Views)

Re: Open, Purge All, Zoom Extents, then Save, Lisp routine.

07-25-2013 03:05 AM in reply to: mn08jhh

Also, perhaps, setting the display to shaded...

Mentor
aqdam1978
Posts: 265
Registered: ‎11-05-2008
Message 17 of 21 (875 Views)

Re: Open, Purge All, Zoom Extents, then Save, Lisp routine.

07-25-2013 07:50 AM in reply to: Ak_homegrown
;; purge, zoom and saves all drawings in a folder
;; By Abbas Aqdam
(defun C:PZT ( / path files dwg sf )
(if (or (= (getvar "SDI") 0) (> (getvar "DBMOD") 0))
   (alert "Please: \n\n1-SAVE and close all open drawing!\n\n2-Set SDI to 0")
   (progn
      (setq path "C:\\TEST\\")
      (setq files (vl-directory-files path "*.dwg" 1))
      (if (> (length files) 0)
         (progn
            (setq sf (open (strcat path "T.SCR") "w"))
            (write-line "Filedia" sf)
            (write-line "0" sf)
            (foreach dwg files
               (write-line "open" sf)
               (write-line (strcat "\"" path dwg "\"") sf)
               (write-line "(command \"purge\" \"a\" \"*\" \"N\")" sf)
               (write-line "(command \"zoom\" \"e\" \"zoom\" \"s\" \"0.95x\")" sf)
               (write-line "qsave" sf)
            );foreach
            (write-line "Filedia" sf)
            (write-line "1" sf)
            (close sf)
            (command "script" (strcat path "t.scr"))
         );progn
         (Alert (strcat "There is no dwg files in " path "!"))
      );if
   );progn
);if
);defun

 

New Member
j.shell
Posts: 1
Registered: ‎03-21-2014
Message 18 of 21 (551 Views)

Re: Open, Purge All, Zoom Extents, then Save, Lisp routine.

03-21-2014 09:02 AM in reply to: scottbolton

Refering to scottboltonThis is a great tool. However I think if we could add 1 more function it would make it a super tool. Currently running this only opens and zooms to extents either the model or layout space the dwg was last saved in. I have dwgs that have multiple layouts that are saved wherever the last person who saved it was working at. If this could go to all of a dwgs layouts and model space to zoom extents it would be amazing!!!! Here is an individual dwg lsp I found for what I am describing. If there is a way we could combine the two it would be golden.

 

 

(defun C:ZEA (/ acad acdoc aclay)
(setq acad (vlax-get-acad-object)
acdoc (vla-get-ActiveDocument acad)
aclay (vla-get-ActiveLayout acdoc)
); setq
;; Modified by Bob Shaw 10-Nov-2011 for John Wagner at Davis Bews Design Group
(vlax-for layout (vla-get-Layouts acdoc)
(vla-put-ActiveLayout acdoc layout)
(if (/= "Model" (getvar "ctab"))
(progn
(command "_pspace")
(princ)
(vla-ZoomExtents acad)
); progn
); if
); vlax-for
(vla-put-ActiveLayout acdoc aclay)
(princ)
); function

*Expert Elite*
pendean
Posts: 23,364
Registered: ‎11-06-2003
Message 19 of 21 (532 Views)

Re: Open, Purge All, Zoom Extents, then Save, Lisp routine.

03-22-2014 02:29 PM in reply to: j.shell
If anyone has a current AutoCAD version (2012 or higher), grab two freeware apps from the Autodesk Exchange: REDICAL PURGE (excellent general purpose purger that's better than PURGE command alone) and DRAWING PURGE (gets rid of DGN items, a big problem for many these days).

There are other for-purchase apps that combine the functionality of both: http://apps.exchange.autodesk.com/ACD/en/Home/Index
I believe both can be run inside Lisps.
Dean Saadallah Blog | Facebook | Google+ | Twitter | PINS
Valued Contributor
mracad
Posts: 85
Registered: ‎09-22-2008
Message 20 of 21 (505 Views)

Re: Open, Purge All, Zoom Extents, then Save, Lisp routine.

03-25-2014 06:50 PM in reply to: pendean
I had a similar problem a few days ago and ended up spending a long, cold Saturday trying to figure out the AcCoreConsole. Here is a simple batch file and script file (THAT I DID NOT TEST). Be sure to change the drawing file and script file locations in Fix_Drawing.bat file. NOTE - I would copy a few files into a new folder for testing. It is amazing how fast it processes drawing, a few seconds for each drawing (depending on size).
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!