Jump to content

Recommended Posts

Posted

I am looking for a way to remove a specific block from a layout tab on a drawing and put another block in it's place. They will all have the same insertion point. I have been trying to look for ways to select the block. Do i use ssget or what??

Posted

Does BLOCKREPLACE do what you want or are you looking for something else?

 

Glen

Posted

Thanks Glen,

 

I never knew about BLOCKREPLACE but i'm looking to do it within a lisp. How do I filter out the block. The name is fixed and the position is fixed on each layout. The block forms part of the title on our sheet.

Posted

WHat about this?

 

 

 
(defun c:ins2ins (/ lb bn ss i en ed)
;;;GET NEW BLOCK INFO
 (setq lb (getvar "INSNAME"))
 (while (not bn)
        (setq bn (getstring (strcat "\nNew blocks name (has to be in drawing or in support file path) <" lb ">:   ")))
        (cond ((= bn "")
               (setq bn lb))
              ((and (snvalid bn)
                    (tblsearch "BLOCK" bn)))
              ((and (snvalid bn)
                    (findfile (strcat bn ".DWG")))
               (command "_.INSERT" bn)
               (command))
              (T (setq bn nil lb ""))))
 (while (not ss)
        (princ "\nSelect block(s) to exchange...")
        (setq ss (ssget (list (cons 0 "INSERT")
                              (if (getvar "CTAB")
                                  (cons 410 (getvar "CTAB"))
                                  (cons 67 (- 1 (getvar "TILEMODE"))))))))
 (setq i (sslength ss))
 (while (not (minusp (setq i (1- i))))
        (setq en (ssname ss i)
              ed (entget en))
        (entmod (subst (cons 2 bn) (assoc 2 ed) ed)))
 (command "attsync" "S" "L" "y")
 (prin1))

 

Credit to the original author, it is not me :).

I only added the attsync line...

 

Maybe there is a way to keep the attribute values intact, if for a title block it is mostly required.

Posted

MarcoW, it would be great to just update the attribute of the block but the problem I have is that it is for project names and they can range in length from one liners to being spread over 3 lines. Can this be done by updating the attirbute?

 

At the moment I use a dynamic block which is cumbersome.

Posted
Credit to the original author, it is not me :).

 

Looking at the style, I'd say it was one of David's :)

Posted

LeeMac, can i use something similar to the "\\X" that you gave me for the dimreact to make the attirubute of a block update with more than one line?

Posted
Looking at the style, I'd say it was one of David's :)

 

 

Yeah, I'd say that was one of mine. -David

Posted
LeeMac, can i use something similar to the "\\X" that you gave me for the dimreact to make the attirubute of a block update with more than one line?

 

Don't think so - you would have to use Multiline Attributes.

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