• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

Update blocks lisp vs. adcenter

  • Thread starter Thread starter 77marco77
  • Start date Start date

77marco77

Guest
Good morning.

I have to update the blocks present in a hundred drawings with the new blocks present in the library. adcenter does his duty egregiamente, the blocks have the same name then to the insert asks if to redefine the block and clicking you the game is done: the contents of the attributes of the blocks are inherited and contain in their definition the new default values (which among others affected).
the problem lies in the fact that in each of those 108 drawings there are more than 80 different blocks and adcenter allows me to insert only one block at a time (which would like to click and insert over 8000 times).
Is there any way with a lisp to speed this up?
 
for posters and those looking for a solution to a similar problem I found a solution that works with this add-on (for now) free:update block definition in one drawing to match another drawing (last post) and then here the add-on I tried it on my pc and it works: allows you to select all the blocks present in the design and indicate the source design of the new definitions and does exactly what should and in a blow updates all the definitions present in the design.
Unfortunately, however, on the company pc does not make me install it. . .
 
update for posters (and for me if I forget... ):
here is the ultimate solution without add-in, adc or external software:and here the code (where ever the link stops working):
Code:
(defun browseforfolder ( text rootfolder / ret y )
  (setq y (vlax-get-or-create-object "shell.application"))
  (if (setq ret (vlax-invoke y "browseforfolder" 0 text 1 rootfolder))
      (setq ret (vlax-get (vlax-get ret "self") "path")))
  (vlax-release-object y)
  ret
)

(defun get_table (table / tb tb_ls)
  (setq tb (tblnext table t)
        tb_ls nil
  )
  (while tb
    (cond
      ((= (strcase table) "style")
        (if (= (boole 1 (cdr (assoc 70 tb)) 1) 0);bit 1 bedeutet symboleintrag, keine schrift!
          (setq tb_ls (append tb_ls (list (cdr (assoc 2 tb)))))
        )
      )
      ((= (strcase table) "block")
        (if (/= (substr (cdr (assoc 2 tb)) 1 1) "*")
          (setq tb_ls (append tb_ls (list (cdr (assoc 2 tb)))))
        )
      )
      (t
        (setq tb_ls (append tb_ls (list (cdr (assoc 2 tb)))))
      )
    )
    (setq tb (tblnext table))
  )
  (setq tb_ls (vl-sort tb_ls '<))
)


(defun c:all-block-upd ( / bl_liste ant n bl_ex)
  (setvar "cmdecho" 0)
  (command "_undo" "_be")
  (setq bl_liste (get_table "block"))
  (if bl_pfad
    (progn
      (initget "ja nein")
      (setq ant (getkword (strcat "pfad " bl_pfad " verwenden? <ja>/nein:")))
      (if (= ant "nein") (setq bl-pfad (browseforfolder "blockpfad wählen:" "")))
    )
    (setq bl_pfad (browseforfolder "blockpfad wählen:" ""))
  )
  (foreach n bl_liste
    (progn
      (setq bl_ex (strcat bl_pfad "\\" n ".dwg"))
      (if (findfile bl_ex) (command "_insert" (strcat n "=" bl_ex) nil))
    )
  )
  (command "_undo" "_end")
  (setvar "cmdecho" 1)
  (prin1)
)

(defun c:block-upd ( / bl_liste ant n bl_ex)
  (setvar "cmdecho" 0)
  (command "_undo" "_be")
  (setq bl_liste (get_table "block"))
  (if bl_pfad
    (progn
      (initget "ja nein")
      (setq ant (getkword (strcat "pfad " bl_pfad " verwenden? <ja>/nein:")))
      (if (= ant "nein") (setq bl-pfad (browseforfolder "blockpfad wählen:" "")))
    )
    (setq bl_pfad (browseforfolder "blockpfad wählen:" ""))
  )
  (foreach n bl_liste
    (progn
      (setq bl_ex (strcat bl_pfad "\\" n ".dwg"))
      (if (findfile bl_ex)
        (progn
          (initget "ja nein")
          (setq ant (getkword (strcat "block " n " aktualisieren? <ja>/nein:")))
          (if (/= ant "nein") (command "_insert" (strcat n "=" bl_ex) nil))
        )
      )  
    )
  )
  (command "_undo" "_end")
  (setvar "cmdecho" 1)
  (prin1)
)

(prompt "funktionen all-block-upd und block-upd geladen. (c) h. jesse 2006")</ja></ja></ja>
works egregiamente requires only a general sincatt at the end.
keeps the data inserted in the design "old" to update, inserts the new tags, imports the default values in the definitions and renames the tags that have a new name, it is perfect!
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top