I have looked through the help pages and have found hundreds of answers that are close to what I need but not exactly.
I am in the process of writing a lisp routine that will insert in a block that contains 12 attributes. The routine prompts you to select two points and from that the routine calculates the values of the 12 attributes.
I need to be able to move around certain attributes depending on their values. I have the following bit of code that works great to search through a block for the attribute I want and then revises the insertion point. The dilemma is that you need to select the block, something I don't want the user to do. The block is the block that the routine is inserting.
The obvious solution (to me at least) was to use entlast. Unfortunately entsel and entlast return different values so I can't interchange them here.
Anyone have any idea how I can do this?
(other solutions besides this bit of code is fine as well)
Does (setq LastInsertedBlock (cdr(assoc -1(entget (entlast))))) do what you need? It will return the entity name of the last block inserted. Then you can usen entget to see the assoc code for that block.
wrote in message news:firstname.lastname@example.org...
Does (setq LastInsertedBlock (cdr(assoc -1(entget (entlast))))) do what you
need? It will return the entity name of the last block inserted. Then you
can usen entget to see the assoc code for that block.
If you call (entlast) right after the insertion of the block and you have to
modify your code to read like this:
(setq ent (entlast))
(setq ent (entsel "\n Select a Block: "))
You fact, you should remove the c: because you say you don't need a command
with user interaction and pass the block entity name as argument, so your
code becomes (take care of the slash and how is placed):
This will call the above function and pass the last inserted block (I repeat
that this works only if you call your function immediately after the
of the block is over, so make sure no other entity is created in between.)
a écrit dans le message de news:
I need the line in the code that reads (setq ent (entsel "\n Select a
Block: ")) to select the block I am inserting with the routine.