Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Reply
Message 1 of 17
abel_henok
735 Views, 16 Replies

AutoLisp

I have two lisp files.

 

1) layfrzdwgdir

- This Lisp freezes specified layers throughout an entire set of drawings.

 

Can someone please take a look at the layfrzdwgdir lisp file and create a separate lisp file that can UNfreeze specified layers throughout an entire set of drawings?

 

2) zoome

- This Lisp performs zoom extent within multiple viewports on a single drawing.

 

Can someone please take a look at the zoome lisp and create a separate lisp that can perform the function throughout an entire set of drawings?

 

I hope you someone is able to help me reach a resolution.

 

Thank you!

16 REPLIES 16
Message 2 of 17
becca_chesmore
in reply to: abel_henok

(defun zoomedwgdir ()
(foreach dwgname (dir "*.dwg") ; Loop through drawing files
(command "open" dwgname) ; Open the current drawing
(c:zeavp) ; Call the existing zoom extents function
(command "save" "yes") ; Save the drawing
(command "quit")) ; Close the drawing
(princ "\nZoom extents completed for all drawings."))

(defun c:zeavp ( / c) ; Existing function from zoome.lsp (unchanged)
(setq c (getvar "CTAB"))
(foreach l (layoutlist)
(setvar "CTAB" l)
(c:zoome))
(setvar "CTAB" c)
(princ))

(princ "\nType zoomedwgdir or (zoomedwgdir) to run")

Message 3 of 17
paullimapa
in reply to: abel_henok

for your layfrzdwgdir.lsp to change to unfreeze then change this line:

:vlax-true ;; the value you want each listed layer to be set to

to this line:

:vlax-false ;; the value you want each listed layer to be set to

Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 4 of 17
abel_henok
in reply to: paullimapa

This solution did not work. Please view the attached code per your recommendations and let me know if we can come up with a different solution. Thank you!

Message 5 of 17
paullimapa
in reply to: abel_henok

There was actually another location where :vlax-true had to be replaced with :vlax-false

Also you don't need to replace 'freeze with 'unfreeze

Use the attached revised code.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 6 of 17
abel_henok
in reply to: abel_henok

Paul, that worked! Thank you so much sir! Now, do you think we can customize the zoome lisp so that it applies to the entire set of drawings in a directory? (similar to the layunfrzdwgdir lisp) Please let me know. Thanks!

Message 7 of 17
paullimapa
in reply to: abel_henok

Does @becca_chesmore solution not work for you?


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 8 of 17
abel_henok
in reply to: abel_henok

Below is the error I received when entering "zoomedwgdir: or "(zoomedwgdir)" in the command line:

 

; error: no function definition: DIR

Message 9 of 17
abel_henok
in reply to: paullimapa

Below is the error I received when entering "zoomedwgdir: or "(zoomedwgdir)" in the command line:

; error: no function definition: DIR
Message 10 of 17
paullimapa
in reply to: abel_henok

let's see if @becca_chesmore can reply to that


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 11 of 17
becca_chesmore
in reply to: abel_henok

@paullimapa I'm pretty new to Lisp and I thought that would work. Sorry, I couldn't be more help 😞

Message 12 of 17
abel_henok
in reply to: becca_chesmore

No worries. Thank you for your effort.
Message 13 of 17
paullimapa
in reply to: abel_henok

Here's one method to run Zoome.lsp on a set of dwgs in a folder:

Script Writer | Lee Mac Programming (lee-mac.com)

Download & install and then fill out the Script Line on Lee Mac's program like this (assume your Zoome.lsp is in a AutoCAD's File Support Search Path location):

_.Open *file* (load"zoome") ZoomE _.Qsave _.Close

paullimapa_0-1727151732161.png

 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 14 of 17
paullimapa
in reply to: abel_henok

Here's another method to apply zoome.lsp to all dwgs in a selected folder.

Save attached DwgAccPikScr.lsp , Zoome.lsp & unzip Zoome.scr in a folder under one of AutoCAD> Options> Support File Search Path & Trusted Locations

paullimapa_0-1727160265788.png

Then at AutoCAD command prompt load DwgAccPikScr.lsp by typing following:

(load"DwgAccPikScr")

Then run by entering at command prompt:

DwgAccPikScr

Select the folder where the dwgs are and then select Zoome.scr

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 15 of 17
abel_henok
in reply to: paullimapa

Hey Paul, I like your thought process.

During testing, I realized there's an IT restriction on running script files in batch. Though, we have more flexibility with lisp files.

The DWGACCPIKSCR is a lisp file but only allows the user to select a script file to run in a directory. Is there a way we can modify DWGACCPIKSCR to allow the user to select a script file?

Please let me know.

Thank you!
Message 16 of 17
paullimapa
in reply to: abel_henok

I’m surprised script files in a batch file is not allowed at your office. This is a major advantage that allows for automation without a need to open drawings in AutoCAD. Since DWGACCPIKSCR lisp is purposely designed to take advantage of batch processing dwgs without opening them, then this method cannot be used in your office. 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 17 of 17
paullimapa
in reply to: abel_henok

Here's a modified version I call DwgAccPikScrA.lsp

This version does NOT create a batch file to apply the selected script file to all the dwgs in the selected folder.

But instead it runs the entire process within AutoCAD.

Let me know if this version bypasses the batch Script restrictions in your office.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report