Jump to content

Can these commands be executed without dialog boxes?


bustr

Recommended Posts

I want to put this into a script. I need to select all instances of this block and change it's layer and linetype.

 

I can't use a lisp since don't know programming.

FILTER.JPG

QSELECT.JPG

Link to comment
Share on other sites

I did. There are. The one I found selects a block and chages it's color. But since I am not a programmer I do not know how to modify the lisp.

Link to comment
Share on other sites

Why can't you just use the BEDIT command? Open the block in question in the block editor. Change it's layer and linetype via the Properties palette. When you close the block editor you'll be asked if you want to save your changes. Do so. When you pop back into your drawing all instances of the block will have been changed.

Link to comment
Share on other sites

Try this it has no error checking as it was done quick, read the comments to understand what its doing. I did test it, it does not change stuff on various layouts as you did not mention that. It could be used with a script to do all 80 dwg's in one go, I did not want to confuse you with how to do that also. A hint though open explorer to where you have the lisp saved just drag and drop onto dwg and it will start up straight away saving a few steps.

 

(defun c:reset-blk ( / ss newlay newlt bname)
(vl-load-com)
(setq obj (vlax-ename->vla-object (car (entsel "\nPick Block")))) ;pick an object and make it a Vl object
(setq newlt (getstring "\nEnter linetype name Bylayer")) ; enter linetype name
(setq newlay (getstring "\nEnter layer name"))   ; enter new layer name
(setq bname (vla-get-name obj))                  ; get the blocks name
(setq ss (ssget "x"  (list (cons 0 "INSERT") (cons 2 bname))))   ; make a collection of the block
(repeat (setq x (sslength ss))                                   ; loop through the collection and change stuff
(setq blk (vlax-ename->vla-object (ssname ss (setq x (- x 1))))) ; get a block
; (vla-put-color blk 0)                            ; change its color 0 is Bylayer           
(vla-put-linetype blk newlt)                     ; change linetype note BYLAYER            
(vla-put-layer blk newlay)                       ; change its layer   
)
)
(c:reset-blk)

Link to comment
Share on other sites

Thanks. I'm not sure how to make this work. It prompted me to enter information.

 

I had found a fix somewhere on this forum. I put the lisp code in a script file and to my surprise it ran.

 

(ssget "_x" '((0 . "INSERT")(2 . "BKR,BKR")))

CHANGE P P LA WHITE-018 LT BYLAYER

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