Jump to content
bustr

Can these commands be executed without dialog boxes?

Recommended Posts

bustr

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

Share this post


Link to post
Share on other sites
ReMark

Did you try searching for a lisp routine?

Share this post


Link to post
Share on other sites
bustr

That was my question: How to put this in a script.

Share this post


Link to post
Share on other sites
bustr

I wouldn't necessarily know how to modify a lisp routine to make it work.

Share this post


Link to post
Share on other sites
ReMark

Maybe someone has already written a lisp routine that will do what you want. Try a search.

Share this post


Link to post
Share on other sites
bustr

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.

Share this post


Link to post
Share on other sites
ReMark

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.

Share this post


Link to post
Share on other sites
bustr

I have around 80 drawings with the same mistake.

Share this post


Link to post
Share on other sites
BIGAL

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)

Share this post


Link to post
Share on other sites
bustr

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×