Jump to content

Recommended Posts

Posted (edited)

I am a beginner with Autolisp.

I have asked ChatGPT to write me some code in AutoLisp. I have many drawings that contain numerous blocks, I want to write out each block to a common folder.

I have been doing this manually using W block, block, select block, then ok. But with several hundred blocks to process I am thinking a lisp routine will be very useful.

Chat GPT has returned:-

(defun c:WBlockAllBlocks ( / blkList blkName blkPath folderName)
  ;; Prompt user to select a folder to save the blocks
  (setq folderName (vl-file-dialog "Select Folder to Save WBLOCKs" nil 1))
  (if (not folderName)
    (progn
      (princ "\nNo folder selected. Command canceled.")
      (exit)
    )
  )

;;;  ;; Get list of all blocks in the drawing, excluding layout/paper space blocks
;;;  (setq blkList (vl-remove-if
;;;                  '(lambda (b)
;;;                     (or
;;;                       (vl-string-search "*" (vla-get-name b)) ; exclude block names starting with *
;;;                       (= (vla-get-isxref b) :vlax-true)       ; exclude xrefs
;;;                     ))
;;;                  (vl-remove-if 'listp
;;;                    (mapcar
;;;                      '(lambda (tbl)
;;;                         (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) tbl)
;;;                      )
;;;                      (vl-remove-if-not
;;;                        '(lambda (name) (= name "Model"))
;;;                        (list "Model")
;;;                      )
;;;                    )
;;;                  )
;;;                )
;;;  )
;;;
;;;  ;; Actually the above is complicated, let's do a simpler approach:
;;;  ;; We'll get the block table from the current document and list all blocks except those with "*" or xrefs
;;;
;;;  (setq blkList (vl-remove-if
;;;                   '(lambda (bname)
;;;                      (or
;;;                        (vl-string-search "*" bname)
;;;                        (equal bname "Model")
;;;                        (equal bname "Paper_Space")
;;;                        (equal bname "Paper_Space0")
;;;                      )
;;;                   )
;;;                   (mapcar
;;;                     '(lambda (b) (vla-get-name b))
;;;                     (vlax-invoke (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) 'item)
;;;                   )
;;;                )
;;;  )

  ;; Actually, vlax-invoke with 'item' requires index or name. Let's get block count and iterate:

  (setq acadDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
  (setq blocks (vla-get-Blocks acadDoc))
  (setq blkCount (vla-get-Count blocks))
  (setq blkList '())
  (repeat blkCount
    (setq blkCount (1- blkCount))
    (setq blkObj (vla-item blocks blkCount))
    (setq blkName (vla-get-Name blkObj))
    (if (and
          (not (vl-string-search "*" blkName))  ; Exclude names with "*"
          (not (vla-get-IsXRef blkObj))         ; Exclude xrefs
        )
      (setq blkList (cons blkName blkList))
    )
  )

  ;; Now wblock each block to a separate file
  (foreach blkName blkList
    (setq blkPath (strcat folderName "\\" blkName ".dwg"))
    (vl-cmdf "._-WBLOCK" blkPath blkName "")
    (princ (strcat "\nWblocked: " blkName))
  )

  (princ "\nAll blocks have been wblocked.")
  (princ)
)

 

 

Big problem is this doesnt work. vl-file-dialog is not prompting for a folder selection.  I therefore tried hardcoding the folderName in   (setq blkPath (strcat folderName "\\" blkName ".dwg")), this has not worked either.  I get the message all blocs have been wblocked but there are no blocks anywhere to be found.

 

I have tried sing the visual lisp editor hoping i could step into the code and try to figure things out but Step in in greyed out, do i need to do something to in order to step in?

 

 

 

 

 

Edited by SLW210
Added Code Tags!!
  • Replies 21
  • Created
  • Last Reply

Top Posters In This Topic

  • jamami

    11

  • rlx

    7

  • BIGAL

    3

  • SLW210

    1

Top Posters In This Topic

Posted

Please use Code Tags for your Code! (<> in the editor toolbar). (I Believe I have mentioned this to you before)

 

Are you writing ALL of the blocks in a drawing to a separate .dwg?

 

If not, how would you want to select the blocks you want?

 

AutoWblock | AutoCAD | Autodesk App Store it shows for AutoCAD 2019-2024 (and verticals) he might have an older version on his website.

 

AutoCAD Free Tools

Posted

I have a couple routines collecting dust , maybe they help (not recently used / tested)  :

 

(defun c:wball ( / symbolpath adoc item oldfiledia name blk blist)
  (setq symbolpath "c:/temp/mysymbols/")
  (setq adoc (vla-get-ActiveDocument (vlax-get-acad-object)))
  (vlax-For item (vla-get-Blocks adoc)
    (if (not (or (eq :vlax-true (vla-get-isXRef item))
			(eq :vlax-true (vla-get-isLayout item))))
      (progn
	(setq name (vla-get-Name item))
	(if (/= (substr name 1 1) "*")(setq blist (cons name blist))))))
  (setq oldfiledia (getvar "FILEDIA"))
  (setvar "FILEDIA" 0)
  (foreach item blist
    (setq blk (strcat symbolpath item))
    (command "-wblock" blk "="))
  (setvar "FILEDIA" oldfiledia))

 

and this one :

 

(defun c:wbf ( / symbolpath adoc item oldfiledia name blk blist oldexpert)
  (setq symbolpath "c:/temp/mysymbols/")
  (setq adoc (vla-get-ActiveDocument (vlax-get-acad-object)))
  (vlax-For item (vla-get-Blocks adoc)
    (if (not (or (eq :vlax-true (vla-get-isXRef item))
			(eq :vlax-true (vla-get-isLayout item))))
      (progn
	(setq name (vla-get-Name item))
	(if (/= (substr name 1 1) "*")(setq blist (cons name blist))))))
  (setq oldfiledia (getvar "FILEDIA"))
  (setq oldexpert (getvar "FILEDIA"))
  (setvar "FILEDIA" 0)
  (foreach item blist
    (setq blk (strcat symbolpath item))
    (command "-wblock" blk "="))
  (setvar "FILEDIA" oldfiledia)
)

(defun allfolders ( d / sf so fo l)
  (defun sf (f / s)(if (< 0 (vlax-get (setq s (vlax-get f 'subfolders)) 'count))
    (vlax-for x s (setq l (cons (vlax-get x 'path) l))(sf x))))
  (setq so (vla-getinterfaceobject (vlax-get-acad-object) "Scripting.FileSystemObject"))
  (setq fo (vlax-invoke so 'getfolder (vl-string-trim "\\/" d)))
  (sf fo) (vl-catch-all-apply 'vlax-release-object (list so))
  (acad_strlsort (mapcar 'dos_path (cons d l)))
)

;;; (length (allfiles "c:/temp/lisp"))
(defun allfiles ( dir / l f r rl ) (setq l (allfolders dir)) (foreach f l (if (vl-consp (setq r
  (mapcar '(lambda (x) (strcat f x))(vl-directory-files f "*.*" 1)))) (setq rl (append rl r)))) rl)

; generic getfolder routine with possibility to create a new subfolder (GetShellFolder "select path")
(defun GetShellFolder ( m / f s) (if (and (setq s (vlax-create-object "Shell.Application"))
  (setq f (vlax-invoke s 'browseforfolder 0 m 65536 "")))(setq f (vlax-get-property (vlax-get-property f 'self) 'path))
     (setq f nil))(vl-catch-all-apply 'vlax-release-object (list s))
  (if f (strcat (vl-string-right-trim "\\" (vl-string-translate "/" "\\" f)) "\\")))

 

🐉

Posted

Excellent, thank you.

Initially they didn't produce any results, after a lot of head scratching I worked out the \ need to be / in the file path that I had cut paste from the address bar.

Seems both routines do the same job but go around it in different ways, thanks once again.

 

Posted
1 hour ago, rlx said:

I have a couple routines collecting dust , maybe they help (not recently used / tested)  :

 

(defun c:wball ( / symbolpath adoc item oldfiledia name blk blist)
  (setq symbolpath "c:/temp/mysymbols/")
  (setq adoc (vla-get-ActiveDocument (vlax-get-acad-object)))
  (vlax-For item (vla-get-Blocks adoc)
    (if (not (or (eq :vlax-true (vla-get-isXRef item))
			(eq :vlax-true (vla-get-isLayout item))))
      (progn
	(setq name (vla-get-Name item))
	(if (/= (substr name 1 1) "*")(setq blist (cons name blist))))))
  (setq oldfiledia (getvar "FILEDIA"))
  (setvar "FILEDIA" 0)
  (foreach item blist
    (setq blk (strcat symbolpath item))
    (command "-wblock" blk "="))
  (setvar "FILEDIA" oldfiledia))

 

and this one :

 

(defun c:wbf ( / symbolpath adoc item oldfiledia name blk blist oldexpert)
  (setq symbolpath "c:/temp/mysymbols/")
  (setq adoc (vla-get-ActiveDocument (vlax-get-acad-object)))
  (vlax-For item (vla-get-Blocks adoc)
    (if (not (or (eq :vlax-true (vla-get-isXRef item))
			(eq :vlax-true (vla-get-isLayout item))))
      (progn
	(setq name (vla-get-Name item))
	(if (/= (substr name 1 1) "*")(setq blist (cons name blist))))))
  (setq oldfiledia (getvar "FILEDIA"))
  (setq oldexpert (getvar "FILEDIA"))
  (setvar "FILEDIA" 0)
  (foreach item blist
    (setq blk (strcat symbolpath item))
    (command "-wblock" blk "="))
  (setvar "FILEDIA" oldfiledia)
)

(defun allfolders ( d / sf so fo l)
  (defun sf (f / s)(if (< 0 (vlax-get (setq s (vlax-get f 'subfolders)) 'count))
    (vlax-for x s (setq l (cons (vlax-get x 'path) l))(sf x))))
  (setq so (vla-getinterfaceobject (vlax-get-acad-object) "Scripting.FileSystemObject"))
  (setq fo (vlax-invoke so 'getfolder (vl-string-trim "\\/" d)))
  (sf fo) (vl-catch-all-apply 'vlax-release-object (list so))
  (acad_strlsort (mapcar 'dos_path (cons d l)))
)

;;; (length (allfiles "c:/temp/lisp"))
(defun allfiles ( dir / l f r rl ) (setq l (allfolders dir)) (foreach f l (if (vl-consp (setq r
  (mapcar '(lambda (x) (strcat f x))(vl-directory-files f "*.*" 1)))) (setq rl (append rl r)))) rl)

; generic getfolder routine with possibility to create a new subfolder (GetShellFolder "select path")
(defun GetShellFolder ( m / f s) (if (and (setq s (vlax-create-object "Shell.Application"))
  (setq f (vlax-invoke s 'browseforfolder 0 m 65536 "")))(setq f (vlax-get-property (vlax-get-property f 'self) 'path))
     (setq f nil))(vl-catch-all-apply 'vlax-release-object (list s))
  (if f (strcat (vl-string-right-trim "\\" (vl-string-translate "/" "\\" f)) "\\")))

 

🐉

in the above defun allfonders, defun allfiles and defun getshell folder dont appear to be referenced in the main code, do these do anything?

Posted

Nope the functions are not used in the first defun because this is meant for current drawing only.

But they are used in the second defun because that one is for use on a complete folder.

But like I said , its been a while I last used them so my memory may be in quantum flux.

 

🐉

Posted

@rlx has given you a great answer if doing file paths its best to use the double backslash method, any path that has spaces in the name or some other characters can stop at that point in the path name causing an error. In scripts must enclose a path with dbl quotes where spaces are in path name.

 

(setq symbolpath "c:\\temp\\mysymbols\\")

(setq symbolpath "c:\\temp\\my cad blocks\\")

 

Posted
On 6/6/2025 at 7:35 PM, rlx said:

Nope the functions are not used in the first defun because this is meant for current drawing only.

But they are used in the second defun because that one is for use on a complete folder.

But like I said , its been a while I last used them so my memory may be in quantum flux.

 

🐉

 

On 6/6/2025 at 7:35 PM, rlx said:

Nope the functions are not used in the first defun because this is meant for current drawing only.

But they are used in the second defun because that one is for use on a complete folder.

But like I said , its been a while I last used them so my memory may be in quantum flux.

 

🐉

 

On 6/6/2025 at 7:35 PM, rlx said:

Nope the functions are not used in the first defun because this is meant for current drawing only.

But they are used in the second defun because that one is for use on a complete folder.

But like I said , its been a while I last used them so my memory may be in quantum flux.

 

🐉

 

Posted
On 6/6/2025 at 7:35 PM, rlx said:

Nope the functions are not used in the first defun because this is meant for current drawing only.

But they are used in the second defun because that one is for use on a complete folder.

But like I said , its been a while I last used them so my memory may be in quantum flux.

 

🐉

 

1 hour ago, jamami said:

 

 

 

 

1 hour ago, jamami said:

rlx

may eyes arent as good as they used to be, but , i cannot see where they are used in the wbf function either, am i missing something obvious?

 

 

 

Posted (edited)

No , your eyes are probably just fine. I work on my files both on the couch at home as on my work computer so its possible this was not the latest version.

Looks like it misses a wrapper  something like '(foreach drawing (allfiles (getfolder ...' As I said , long time ago I last used this.

 

Have another lisp on my couch pc which looks like it works on entire folder but I've written that in odbx and I'm not sure that would be a little too complex for you and I don't want to overload your braincell or scare you away , plus same story , not sure its the latest version / when I last used it. 

Edited by rlx
Posted

Are you looking for a way to pick blocks visually as end product ? Just ask it can be added to the Wblock function to make the images needed for a pop menu.

Posted
6 hours ago, BIGAL said:

Are you looking for a way to pick blocks visually as end product ? Just ask it can be added to the Wblock function to make the images needed for a pop menu.

I am trying to establish a routine that will open drawings in a given folder , once open  

wbkock out all blocks within that drawing to another specified folder. Before looping onto the next drawing .

 

the routine from Rlx works great on an open folder , I am trying to enhance this as to get it work the drawing needs to be open  and I have to use appload each time I open a new drawing. I have a large number of drawings  to work on , having to open each one load the app via appload, run the app is time consuming , I have got through 24 drawings so far but have over 800 to go .

 

 

 

 

Posted

you can try this one :

 

;;; RLX - 17 jun 2021
;;; written this to scan all drawings in a folder and wblock all blocks containing certain attribute(s)
;;; company has hundreds if not more different titleblocks.
;;; So far it seems all titleblocks have attribute Y1 in common
;;; app works by selecting source folder for drawings + target folder for wblocks

; generic getfolder routine with possibility to create a new subfolder (Select-a-Folder "select path")
(defun Select-a-Folder ( m / f s) (if (and (setq s (vlax-create-object "Shell.Application"))
  (setq f (vlax-invoke s 'browseforfolder 0 m 0 "")))(setq f (vlax-get-property (vlax-get-property f 'self) 'path))
     (setq f nil))(vl-catch-all-apply 'vlax-release-object (list s)) (if f (vl-string-translate "\\" "/" f)))

(defun string-p (s)(if (= (type s) 'str) t nil))

; just a wrapper for getfiled command to make main routine more readable
; (Select-a-File "give it to me" (strcat (getvar 'MYDOCUMENTSPREFIX) "\\lisp\\") "txt" 8)
(defun Select-a-File (s p e f) (if (not (string-p s))(setq s "Select a file"))(if (not (string-p e))(setq e ""))
  (if (not (numberp f))(setq f 0))(if (or (not (string-p p))(not (vl-file-directory-p p)))(setq p ""))(getfiled s p e f))

; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vl-directory-files-for-subdirectories/td-p/7815558 (Gile)
; (setq lst (allfiles "c:/temp/lisp" "*.dwg"))
(defun allfiles	(f p)
  (apply 'append (cons (if (vl-directory-files f p)(mapcar '(lambda (x) (strcat f "/" x)) (vl-directory-files f p)))
    (mapcar '(lambda (x) (allfiles (strcat f "/" x) p))(vl-remove ".." (vl-remove "." (vl-directory-files f nil -1)))))))


;;; d = directory , e = extension like "*.dwg" , f = flag include subfolders (any value or nil)
;;; test : (length (alf "d:/temp/lisp" "*.dwg" t))  (length (alf "d:/temp/lisp" "*.dwg" nil))
(defun alf (d e f) (setq d (vl-string-right-trim "/" (vl-string-translate "\\" "/" d)))
  (if f (apply 'append (cons (if (vl-directory-files d e)(mapcar '(lambda (x) (strcat d "/" x)) (vl-directory-files d e)))
    (mapcar '(lambda (x) (alf (strcat d "/" x) e f))(vl-remove ".." (vl-remove "." (vl-directory-files d nil -1))))))
      (mapcar '(lambda (x) (strcat d "/" x))(vl-directory-files d e 1))))

(defun Dos_Path ($p)
  (if (= (type $p) 'STR) (strcase (strcat (vl-string-right-trim "\\" (vl-string-translate "/" "\\" $p)) "\\")) ""))

; (c:RlxDbxBlockUtil)
(defun c:RlxDbxBlockUtil ( / source-folder wblock-folder file-list dbx)
  (if (and (setq source-folder (Select-a-Folder "Select folder with source drawings"))
	   (setq wblock-folder (Dos_Path (Select-a-Folder "Select folder to save your (w)blocks")))
	   ;(vl-consp (setq file-list (allfiles source-folder "*.dwg")))
	   (vl-consp (setq file-list (alf source-folder "*.dwg" T)))
       )
    (progn
      (dbx_init)
      (foreach dwg file-list
	(if (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-open (list dbx dwg))))
	  (RlxDbxWblock dbx wblock-folder)
          (princ (strcat "\n*** error openening " (vl-princ-to-string dwg)))
	)
      )
    )
  )
  (dbx_exit)
  (if (vl-file-directory-p wblock-folder) (startapp "explorer" wblock-folder))
  (princ)
)

;;; added filter for only blocks that have attribute tag names Z9 or Y1
;;; only write blocks that have TAG name Z9 or Y1
;;; once saved wblock will NOT be overwritten so if 2 different block definitions with the same name exist...tough
(defun RlxDbxWblock ( this-doc wblock-folder /  block-name wblock-dbx-name wblock-dbx-container object-list object-safe-array)
  ; (setq wblock-folder "d:\\temp\\wblock-folder\\")
  (vlax-for block (vla-get-blocks this-doc)
    (if	(and (equal (vla-get-islayout block) :vlax-false) (equal (vla-get-isxref block) :vlax-false)
	     (setq block-name
	       (if (vlax-property-available-p block 'effectivename)(vla-get-effectivename block)(vla-get-name block)))
	     (not (findfile (setq wblock-dbx-name (strcat wblock-folder block-name ".dwg"))))
             ;;; only pass blocks with attribute tag Z9 or Y1
             ;;; (vl-some '(lambda (x)(member x '("Z9" "Y1"))) (dbx-get-atl block))
        )
      (progn
	; create empty drawing to contain block object
        (setq wblock-dbx-container (vl-catch-all-apply 'vla-getinterfaceobject (list (vlax-get-acad-object) (dbx_ver))))
	; (vl-catch-all-apply 'vla-saveas (list wblock-dbx-container wblock-dbx-name))
	; put all block objects in a list
	(vlax-for object block (setq object-list (cons object object-list)))
	; put list with block object in a safe array
	(if (vl-consp object-list)
	  (progn
	    (setq object-safe-array (vlax-make-safearray vlax-vbobject (cons 0 (1- (length object-list)))))
	    (vl-catch-all-apply 'vlax-safearray-fill (list object-safe-array object-list))
	    ; copy objects to wblock-dbx-container
	    (vla-CopyObjects this-doc object-safe-array (vla-get-ModelSpace wblock-dbx-container))
	  )
	)
	(vl-catch-all-apply 'vla-saveas (list wblock-dbx-container wblock-dbx-name))
	(vl-catch-all-apply 'vlax-release-object (list wblock-dbx-container))
	; reset buckets else next block will ref objects not owned.
	(setq object-list nil object-safe-array nil)
      ) ;_ end of progn
    ) ;_ end of if
  )
)

;get attribute values (("attname 1" . "val 1") . . ("attname x" . "val x"))
; (setq lst (get-atv (vlax-ename->vla-object (car (entsel)))))
(defun get-atv (b) (if (eq :vlax-true (vla-get-HasAttributes b))
  (mapcar '(lambda (x)(cons (vla-get-TagString x)(vla-get-TextString x)))(vlax-invoke b 'GetAttributes))))

;;; get attribute tag list from block object (not from block definition in collection)
;;; (setq lst (get-atl (vlax-ename->vla-object (car (entsel)))))
(defun get-atl (b)
  (if (= (vla-get-hasattributes b) :vlax-true)(mapcar 'vla-get-TagString (vlax-invoke b 'GetAttributes))))

;;; this one WILL get attribute tag list from block definition
(defun dbx-get-atl ( b / l ) (if (= "AcDbBlockTableRecord" (vla-get-objectname b)) (vlax-for x b
  (if (= "AcDbAttributeDefinition" (vla-get-objectname x)) (setq l (cons (vla-get-tagstring x) l))))) l)

;;; ---- test section -----------


;;; also test nested
(defun has_attributes (b / f) (if (= "AcDbBlockTableRecord" (vla-get-objectname b)) (vlax-for x b
  (cond ((= "AcDbAttributeDefinition" (vla-get-objectname x)) (setq f T))
        ((= "AcDbBlockTableRecord" (vla-get-objectname x))(has_attributes x))))) f)

;;; ---- test section -----------


(defun dbx_ver ( / v)
  (strcat "objectdbx.axdbdocument" (if (< (setq v (atoi (getvar 'acadver))) 16) "" (strcat "." (itoa v)))))

(defun dbx_init ()
  (setq dbx (vl-catch-all-apply 'vla-getinterfaceobject (list (vlax-get-acad-object) (dbx_ver)))))

(defun dbx_exit ()
  (vl-catch-all-apply 'vlax-release-object (list dbx)))

(vl-load-com)
;(c:RlxDbxBlockUtil)

 

Written 'on the fly' five years ago so have no active memory of it anymore.

Attribute filter should be disabled and command is (c:RlxDbxBlockUtil)

As we say on this side of this planet : 'garantie tot aan de deur'

 

🐉

Posted

I am getting a few issues with duplicate block names, is there a parameter I can pass to the -wblock command to answer say "Y" if a duplicate exists, running through this manually it will need to be between the blk and "=", however this causes an error when inserted as a duplicate doesn't always exist.

 

< (foreach item blist
    (setq blk (strcat symbolpath item))
    (command "-wblock" blk "="))
  (setvar "FILEDIA" oldfiledia))>

Posted

you could try setvar expert 5

Posted

wow! that works

thank you very much, i would never have guessed that, expert =5 only mentions dimstyles, that is a great suggestion.

To process all the files I have setup a script  

<open filename1 -purge all * n wball

open filename2 -purge all * n wball

open filename3 -purge all * n wball

 

etc x 800

I am going to try re running it now as was tripping over all the time before when the bock already exists, so things like arrows, ticks etc causing an issue.  Answering yes to teh 'over write' prompt had the affect of stopping the script execution, so I was managing to proces 1 or 2 files only each time.

 

 

Posted

all done, thanks everyone for the support.

 

PS

Is there a difference between lisp and visual lisp? I tried using the VL editor from acad but none of the debugging etc seem to work, also it created another file in my script folder?

 

Posted
8 hours ago, rlx said:

you could try setvar expert 5

genius .

Posted

most of the time when talking about lisp people also reference to this as vanilla lisp, the original command set built in AutoCad.

Visual lisp commands where added later and most of them have commands that start with VL-

Some of the visual command are easier to read and often easier to use. 

The original commands for example work with group codes , like 8 for layer , while the visual command reads like vl-get-layer / vl-put-layer.

While visual command can be esier to use , they are not always the fastest. 

But you have to find that out by yourself with practice (steal / copy / borrow / tweak)

Lisp can be confusing in the beginning but when you put in some effort you can really boost your AutoCad.

Posted
15 minutes ago, rlx said:

most of the time when talking about lisp people also reference to this as vanilla lisp, the original command set built in AutoCad.

Visual lisp commands where added later and most of them have commands that start with VL-

Some of the visual command are easier to read and often easier to use. 

The original commands for example work with group codes , like 8 for layer , while the visual command reads like vl-get-layer / vl-put-layer.

While visual command can be esier to use , they are not always the fastest. 

But you have to find that out by yourself with practice (steal / copy / borrow / tweak)

Lisp can be confusing in the beginning but when you put in some effort you can really boost your AutoCad.

thanks again , have been practising , but as you say it is confusing at first as it differs greatly from my previous coding experiences .  Is the VL editor shipped with autocad the only option ? I was hoping to use debug and parentheses matching but everything is greyed out when I open the various scripts posted to me . I have added several lines of code but the routines trip over . I was hoping I could ‘step into’ the routine to find my errors . 

On 6/9/2025 at 5:06 PM, rlx said:

No , your eyes are probably just fine. I work on my files both on the couch at home as on my work computer so its possible this was not the latest version.

Looks like it misses a wrapper  something like '(foreach drawing (allfiles (getfolder ...' As I said , long time ago I last used this.

 

Have another lisp on my couch pc that which looks like it work on entire folder but I've written that in odbx and I'm not sure that would be a little too complex for you and I don't want to overload your braincell or scare you away , plus same story , not sure its the latest version / when I last used it. 

 

Probably correct the odbx, the lisp you sent is great thanks once again 

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...