Replace entities / blocks

Replace entities / blocks

adaptacad
Advocate Advocate
867 Views
2 Replies
Message 1 of 3

Replace entities / blocks

adaptacad
Advocate
Advocate
Hello everyone, everything good?
I need help 😞 I'm learning autolisp and would like to create a code
but I do not know if it is possible or if there is a way to do better.
So come on. I have a sequence of 7 "entities" in my drawing,
and would be erased and replaced by one another. (follows a .dwg showing)
BUT HOW TO DO IT
I use this code to delete the selected entity:
(Defun c:SBT (/ ss)
  (if(setq ss (ssget ":L" '((0 . "CIRCLE,TEXT"))))
    (mapcar 'entdel
	    (vl-remove-if 'listp(mapcar 'cadr(ssnamex ss))))
    )
  (Subsbt)
  )
right after you create a subroutine to make the choice of entity.
(defun Subsbt (/ aa )
  (initget "1 2 3 4 5 6 7")
  (setq aa (cond ((getkword "\n[1/2B/3C/4D/5E/6F/7] <1>: "))
			   ("1")))
  )
but how does it give continuity? how to store the selection to work on all drawings?
 
Note: Note These entities are exploded blocks inserted in this way:
(command "Insert" "T:/LC/B1" "S" 1 pause pause
	 "Explode" (entlast))
The block name is the same as the name of the text.
0 Likes
868 Views
2 Replies
Replies (2)
Message 2 of 3

Kent1Cooper
Consultant
Consultant

I think you need to fix some things....  You don't have 7 entities, you have 18.  Not all Blocks were created equal -- most of them with 2-character number-and-letter combinations have the two as separate Text objects, but one has them combined into one.  That will make whatever you're trying to do very difficult to automate.

 

But after you fix that discrepancy, I don't quite understand what you want to do -- explain more about what you mean by "would be erased and replaced by one another. (follows a .dwg showing)".

Kent Cooper, AIA
0 Likes
Message 3 of 3

pbejse
Mentor
Mentor

@adaptacad wrote:
Note: Note These entities are exploded blocks inserted in this way:

Which means reverting the CIRCLE and TEXT on its original state as blocks?

 

0 Likes