Jump to content

Redefine a block within current drawing


rcb007

Recommended Posts

I have the following code, I am trying to replace / update a block definition that is already in the current drawing. I get stuck at redefining part within the command line. Anyway around that?

 

(defun c:test (/ ss basept blockname blkDef blkUsed)
  (setq blockname "test")
  (if (setq blkDef (tblobjname "block" blockname))
    (if (setq blkUsed (ssget "x" (list (cons 0 "INSERT") (cons 2 blockname))))
      (progn
        (princ (strcat "\nBlock " blockname " already exists. Purging and redefining..."))
        (entdel blkDef)
      )
    )
  )
  (princ "\nSelect object for the block: ")
  (if (setq ss (ssget))
    (progn
      (setq basept (getpoint "\nSpecify base point for the block: "))
      (command "_.-block" blockname basept ss "")
      (command "_.-insert" blockname basept "" "" "")
    )
  )
(princ))

 

 

Yes or No, please.
; error: Function cancelled
Redefine it? [Yes/No] <N>: y Specify insertion base point or [Annotative/mOde]: *Cancel*

 

Thanks a bunch!

Link to comment
Share on other sites

start your code with (setvar "expert" 5) should suppress yes / no question , just put original value back at end of your program

Link to comment
Share on other sites

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