• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

substitute an entity in a block

  • Thread starter Thread starter StoneDesign
  • Start date Start date

StoneDesign

Guest
Good morning to all,
I have a problem with autocad blocks.
I would need to replace an entity within a block with another entity of the same type.
I have the name of all the entities involved but I have no idea how to replace them.

Do you have any ideas?

Thank you.
squarzoni luigi
 
you can use my varblok that allows you to add or remove entities to a block.
in your case it's about removing the old entity and then relaunching the command to add the new one.
 

Attachments

Thank you, it can be a good solution but I have to run the command many times.
I saw something with vl functions.... but I don't find any exhaustive documentation on these.

he's doing it.
 
is it not easier to replace the blocks with the updated ones? you can run it through a script on all necessary files.
"I have the name of all entities involved"; What do you mean? It's a text, a line, what? to be replaced with a different equivalent or type?
If you go down in detail it's easier to help you, if you're not handy to lisp put hand to the controls to change the blocks doesn't seem like a good start, indeed, I would say a bad one.
 
Now I think that autocad has the function, about replacing the blocks. Since my intellicad didn't have it, I wrote this little utility.
Code:
(defun replace()
(setq memblock 0)
(prompt "\replaces selected blocks <point cro="" las="" pre="" win="">. "
(setq selez(ssget))
(if (/= selez nil)
(progn)
(setq l(sslength selez))(setq l(1- l))(setq a 0))
(while(< = a l)
(progn)
(setq ename(sname selez a))
(setq alist(entget ename))
(if (= "insert"(cdr(assoc 0 alist))))
(progn)
(setq bn (cdr (assoc 2 alist)); get block name
; (prompt (strcat bn) --------------------------------------------->debug
(setq newname (getstring ( strcat "insert new block name for "bn" : "))))
(setq alist (subst (cons 2 newname ) (assoc 2 alist ))
(if (entmod alist) (setq mes " ok.") (setq mes " but that ***** again you wrote? There's no.") )
(setq memblock 1)
)
)
)
(setq a(1+) (a)
)
)
(if (/= memblock 0)
(progn)
(prompt "\nblocks to reload found.\n")
(prompt (strcat mes)
)
(prompt "\nblocks to recharge not found. "
)
)
)
) ;</point>
 
solved!
I carry the line below with the functions vl....
it solves my problem

he's doing it.

(vl-load-com)
(setq minted (car (nentsel "selects the block size to be eliminated")))

(Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (
(vla-delete (vlax-ename->vla-object minted))
(Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (Bleep) (

(command "_regen")
 
<grazie, buona="" comando="" devo="" essere="" il="" io="" lanciare="" ma="" può="" soluzione="" tantissime="" una="" volte.="">So, what did you solve?</grazie,>
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top