Jump to content

Recommended Posts

Posted (edited)

I was wondering if there's something like LeeMacs program to steal from another drawing, only redefine the blocks.

 

Currently, this code can import the blocks into the drawing but it doesn't update the definitions.

 

(if (not steal) (load "StealV1-8"))

(Steal 
  "O:\\ACAD Blocks, Templates\\2022 Sheet Templates\\CSP_Sheet Templates.dwg"
  '(("Blocks" 
      ("AN_CSP A1 Landscape 2022" "AN_CSP A2 Landscape 2022")
    )
    ("Dimension Styles" 
      ("ANNO*")
    )
   )
)

 

Edited by 3dwannab
Posted

Doesn't insert give the option to redefine a block?

Posted

@Steven P, the blocks are nested inside a drawing. I have a script to uploaded from dwg but not this. I was hoping if this steal program had this functionality. 

 

Posted (edited)

You may have do as a multi step say steal into a blank dwg wblock out, the insert into correct dwg, Maybe just open other dwg select block and use Ctrl+c, then paste into original dwg.

 

If you need to do this a lot wblock out all the blocks into separate dwg's.

Edited by BIGAL
Posted

I think that's the route I will have to go down.

 

Ctrl+C and Ctrl+V doesn't redefine a block unless I'm missing something?

  • 2 months later...
Posted

Take a look here:

https://ww3.cad.de/foren/ubb/Forum54/HTML/018068.shtml#000032

 

and here the 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")

 

Posted (edited)
1 hour ago, 77mc77 said:

 

Thanks but that only inserts drawings from a folder and updates the definition.

 

I was looking to update blocks from one drawing containing the block definitions.

Edited by 3dwannab
Posted
16 minutes ago, 3dwannab said:

 

Thanks but that only inserts drawings from a folder and updates the definition.

 

I was looking to update blocks from one drawing containing the block definitions.

I searched everywhere and found nothing so I settled for this at the time: I export the blocks as separate dwg's (I had more than 6850 blocks so more than 6850 dwgs...) and then use the code above.
I don't think you will find anything else because ADCenter already does what you ask - but you have to do it manually for each block. Maybe that's why nobody has developed code for what you're asking for...
I keep following the thread hoping that someone will develop this, i would need it too.

 

Posted

It hasn't been updated to 2025 unfortunately for me to test.

 

I was hoping Lee Macs tool could do this because there's no point in reinventing the wheel.

 

If I had the time I could get this done but I've more important lisps that need fixing atm but I'll get to this sometime 🤞

Posted

it work with autocad2025, now tested.

you can download it from website (current version 03 May 2024) or from here

AVC_BUpdate_2024_05_03.7z

 

and copy the bundle folder into the autocad plugin folder.
this does exactly what you were asking above, and it's free. As I said to verify the (free) licence it connects to a Slovak server and my company did not allow the connection otherwise it is perfect

  • Like 1
Posted

Cheers @77mc77, I'll give it a go tomorrow at work.

 

Someone in the comments for that plugin said it doesn't update attributes, but an attsync all command might work for that.

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...