Discussion:
multilple select and erase in one command
(too old to reply)
rjdrw
2004-05-17 18:42:13 UTC
Permalink
What I am trying to do is the following:
Command: ssx-select a block (choose a block and ssx command selects all occurences of this block in the drawing). Then, command: erase, select previous. This will erase all the objects that ssx has found. It is tedious typing ssx then entering then e enter p enter to erase. Trying to get this into one command.
rjdrw
2004-05-17 19:03:27 UTC
Permalink
I am using acad 2004. I tried what you had suggested but it left me in the ssx command. once I hit enter it just told me 44 objects found but does not erase them. I copied what you had typed and pasted it into my custom button.
ECCAD
2004-05-17 21:15:18 UTC
Permalink
Sorry for leaving ya hanging..had to run..back now.
Change what I posted to:
[Select Block, Erase All]^c^c(load "erase_blocks.lsp")(C:EB)

And, save the attached .lsp (unzipped) in your AutoCAD\support folder.

Bob
ECCAD
2004-05-17 18:53:38 UTC
Permalink
I don't know the 'ssx' function you have, but if it is a 'command' e.g. C:SSX, then a button macro would do it:
[Select Block, Erase All]^c^c(c:ssx);(command "_erase" "P" "");
David Kozina
2004-05-17 19:13:06 UTC
Permalink
Jason,

I bet Anne almost huskied that message. ;)
Jason Piercey
2004-05-17 19:16:59 UTC
Permalink
At a quick glance, I bet that is possible :)
Post by David Kozina
Jason,
I bet Anne almost huskied that message. ;)
rjdrw
2004-05-17 19:23:51 UTC
Permalink
Then does anyone know how to erase 44 or 1000 blocks that are scattered across the drawing without having to select every block?
R. Robert Bell
2004-05-17 20:42:06 UTC
Permalink
I renamed that function to SEX a long time ago... what's more natural than
selecting objects by their sex?! ;^)
--
R. Robert Bell


"Jason Piercey" <***@AtrEngDotCom> wrote in message news:***@newsprd01...
At a quick glance, I bet that is possible :)
Post by David Kozina
Jason,
I bet Anne almost huskied that message. ;)
Anne Brown
2004-05-17 19:28:36 UTC
Permalink
Had to read it a few times <G>

Anne
Post by David Kozina
Jason,
I bet Anne almost huskied that message. ;)
Jason Piercey
2004-05-17 19:12:28 UTC
Permalink
SSX is basically just user interface for ssget filtering.
--
Autodesk Discussion Group Facilitator
Post by ECCAD
I don't know the 'ssx' function you have
rjdrw
2004-05-17 19:30:01 UTC
Permalink
Out of all this, does anyone know how to erase multiple instances of a block w/o having to select every block?
and if possible, when a block is attributed.
Jason Piercey
2004-05-17 19:34:54 UTC
Permalink
See my post (to you) previous to this one
--
Autodesk Discussion Group Facilitator
Post by rjdrw
Out of all this, does anyone know how to erase multiple instances of a block w/o having
to select every block?
Post by rjdrw
and if possible, when a block is attributed.
Jason Piercey
2004-05-17 20:02:00 UTC
Permalink
Is this something that you will be using time and
time again? or is this simply a "one-shot" deal?

If the latter, you can simply cut/paste the code
to the command line (it'll look messy, but it will
work)

If the former, then some other things could be
done to allow you to use this whenever the need
arises.
--
Autodesk Discussion Group Facilitator
I have been using acad for about 6 years but have little customization skills. I am
learning but I have no clue what you want me to do w/ the text that you replied w/.
rjdrw
2004-05-17 19:53:40 UTC
Permalink
I have been using acad for about 6 years but have little customization skills. I am learning but I have no clue what you want me to do w/ the text that you replied w/.
Kent Cooper, AIA
2004-05-17 20:03:55 UTC
Permalink
Refinement:
The "Erase All of a Block" line below (like Jason's version using ssget "x")
does NOT do instances in different layouts, or in ANY layouts if you use it
in model space, or in model space if you're in any layout. But at least it
tells you there were some not in the current space. And it gets the block
name from a block you select with each invoking of it, whereas it looks like
Jason's would require you to extract the block name somehow first so you can
put it into the "YourBlockName" variable to be used in there.

Kent Cooper, AIA


"Kent Cooper, AIA" wrote...
[Erase All of a Block]^C^Cerase (ssx) \LA ;;;
"Jason Piercey" wrote...
This will work for blocks that are in the current layout.
(if (setq ss (ssget "x" '((0 . "INSERT") (2 . "YourBlockName"))))
(command ".erase" ss "")
)
rjdrw
2004-05-17 20:23:11 UTC
Permalink
This command worked in the current drawing that I had created the toolbar in. Problem was when I tried using it in another drawing. This is the error that I got:

Command: erase
Select objects: (ssx)
Error: no function definition: SSX; error: An error has occurred inside the
*error* functionAutoCAD variable setting rejected: "CLAYER" nil
Kent Cooper, AIA
2004-05-17 21:08:47 UTC
Permalink
First thing I'd check would be to make sure Express Tools are loaded in the
other drawing.

Kent Cooper, AIA

"rjdrw" wrote...
Post by rjdrw
This command worked in the current drawing that I had created the toolbar
in. Problem was when I tried using it in another drawing. This is the
Post by rjdrw
Command: erase
Select objects: (ssx)
Error: no function definition: SSX; error: An error has occurred inside the
*error* functionAutoCAD variable setting rejected: "CLAYER" nil
rjdrw
2004-05-18 11:56:51 UTC
Permalink
I changed my settings to load the acad.lisp w/ every drawing and the express tools are loaded. This has not changed the problem w/ having to type ssx before trying this command.
rjdrw
2004-05-20 15:52:04 UTC
Permalink
I looked at the ssx command after it was put into the erase command. There is no LAYER filter available at start. this is allowed after ssx was run by itself in the begining.
Any help?
ECCAD
2004-05-20 18:29:30 UTC
Permalink
rj,
Reference my post: 17th 21:15
erase_blocks.zip

Bob

Kent Cooper, AIA
2004-05-17 19:46:44 UTC
Permalink
SSX is an Express Tool (in A2K at least, I don't know about earlier), for
making a selection set of things just like the thing you select at its first
prompt. I fiddled with it a little, and it takes some getting used to. If
you use it "straight," in this situation looking for all occurrences of a
block, it will find all insertions of the same block name on the SAME layer,
with the same linetype, etc. If you remove the Layer filter, it finds them
on all layers. I tried inserting some with the current linetype and color
set to something other than bylayer, thinking you'd have to remove those
filters, too, but it seems if you remove the Layer filter, it does find the
ones that are inserted with other linetypes and colors, even though you
haven't removed those filters -- go figure.

You don't need to make the selection set and then erase P. You CAN use ssx
as a command to make a selection set to do it that way, but you can also use
(ssx) [with the parentheses] in response to the erase command's object
selection prompt, so you build your selection set inside the erase command.
The \ is to pick a block, the LA is to play with the Layer filter, and the
first enter (semicolon) after it is to turn it off (instead of, for example,
feeding in another Layer name) so all insertions on all Layers will be
found. The next semicolon completes the ssx operation, and the next
completes the erase command. I've tested this, and it works (in ADT2K4, at
least):

[Erase All of a Block]^C^Cerase (ssx) \LA ;;;

If you happened to pick a Line instead of a Block, this would erase all the
Lines in the drawing, so you might want to think about controls to prevent
that kind of thing. (Maybe it should be called "Erase all of an Entity
Type" or something.) I thought of trying something like this:

[Erase All of a Block]^C^Cerase
<however-you-get-into-'filter-without-dialog-box>
<however-you-specify-Block-name-as-the-Filter>
<pick-a-block-and-extract-its-block-name>
<however-you-say-Add-that-to-the-filter-list>
<however-you-say-Apply-the-filter-list> ALL ;;

but I couldn't find a way to get into filtering without the dialog box. Any
ideas?

Kent Cooper, AIA


"ECCAD" wrote...
Post by ECCAD
I don't know the 'ssx' function you have, but if it is a 'command' e.g.
[Select Block, Erase All]^c^c(c:ssx);(command "_erase" "P" "");
rjdrw
2004-05-17 20:17:34 UTC
Permalink
This is what I was looking for. If you figure out how to get rid of the "all line erase" please post it here so I can change this.

Thanks again.
Kent Cooper, AIA
2004-05-17 21:06:02 UTC
Permalink
Well, let's think about this....

(cdr (assoc 2 (entget (car (entsel))))) \
returns the block name.

(cdr (assoc 0 (entget (car (entsel))))) \
returns the entity type, which should be "INSERT" if it's a block, so you
want to do the routine only if that's what you get.

Maybe the best way would be to extract those pieces of information, and then
do an "if" thing to save the block name into a variable (here called
"YourBlockName" to fit into Jason's routine) and do the erasing, ONLY if
what you pick is a block. On experimentation, I find not every entity type
HAS an "assoc 2" value (Lines don't, for example). So you need to test for
its being a block before you can save the block name.

...
(setq pickeditem (entget (car (entsel "Select Block to Erase All Insertions
of: ")))) \+
(if (= (cdr (assoc 0 pickeditem)) "INSERT") +
(progn (setq YourBlockName (cdr (assoc 2 pickeditem))) +
(...<something like Jason's routine>...)) +
(...<tell you the thing you picked wasn't a block>...))
...

[formatted, like your original, as a pull-down or screen or tablet menu
macro -- add appropriate header for pull-down or screen, or adjust as
appropriate for a "defun" or whatever, with whatever other stuff like error
handling and so on....]

It doesn't use ssx, but it may be the simpler way to do it if you want to
first test for the selected item being a block insertion. But it might be
doable by saving the entity itself to feed back into ssx, in addition to
extracting the assoc information from it.

Kent Cooper, AIA


"rjdrw" wrote ...
Post by rjdrw
This is what I was looking for. If you figure out how to get rid of the
"all line erase" please post it here so I can change this.
Post by rjdrw
Thanks again.
Jason Piercey
2004-05-17 19:32:06 UTC
Permalink
This will work for blocks that are in the current layout.

(if (setq ss (ssget "x" '((0 . "INSERT") (2 . "YourBlockName"))))
(command ".erase" ss "")
)
--
Autodesk Discussion Group Facilitator
Then does anyone know how to erase 44 or 1000 blocks that are scattered across the
drawing without having to select every block?
Loading...