edit value attribute with the "find and replace" command

edit value attribute with the "find and replace" command

Sandervp
Advocate Advocate
10,368 Views
19 Replies
Message 1 of 20

edit value attribute with the "find and replace" command

Sandervp
Advocate
Advocate

Hello everybody,

 

If I want to change the value of a block or blocks, with the same value, it's easy to change this in the properties palette. But because I have a lot of these blocks, with the same block name, but not with the same value, it's not possible.

 

If I'm right, I can not use the "quickselect" command to select all the blocks with the same name as well as the same value. 

 

Do I use the "find" command, also the text and mtext object shall be found. I can solve this by changing the search options. The only thing I need to select is the "block attribute value". But do I need to use the "find" command again, for something else than the block attribute value, I have to select all the other options in the search options again.

 

Is there a way to select only the blocks with the same value by using a command and not any other object with the same value without changing the search options in the "find and replace" dialog box again and again?

 

Could it also be possible to create a "-find" command instead of a "find" command? If I use this, I'll get a list with the search options. After selecting the value option in the command bar, I need to "select objects" or "entire drawing"? 

 

thank you

 

 

 

 

Sorry for my English grammar and vocabulary.

0 Likes
Accepted solutions (1)
10,369 Views
19 Replies
Replies (19)
Message 2 of 20

wispoxy
Advisor
Advisor
Currently looking into the matter.
0 Likes
Message 3 of 20

wispoxy
Advisor
Advisor

Hip Tip for Selecting Blocks by Attribute Value:

 

So let's say you need to find all the blocks that have a specific attribute value...you'll see that the standard filtering methods such as QSELECT and FILTER won't let you drill down to the actual attribute value. That's where the fabulous FIND command reenters the scene. 

 

Enter the FIND command, input the attribute text string to search for and you'll notice that the "Select All" and "Zoom to" buttons are not enabled yet. You won't be able to use them until you hit the tiny Select Objects button on the right and select the objects you would like to include in the selection set.  Key in ALL if you'd like everything to be selected (or Control+A will also do the trick).

 

After selecting objects you'll find that the Select All button is available (presto!).  If your system variables GRIPS and PICKFIRST are set to 1, then bingo! (and I quote) - all of the blocks with your specified attribute value are selected.

0 Likes
Message 4 of 20

Sandervp
Advocate
Advocate

Hello Wisp,

 

If I use the find command and the "find and replace" dialog box appear, I can't see any tiny "select objects" button. I do can select this beneath the "find where" button and after using this, I can select everything.

 

 

find and replace.jpg

 

But  also the "select all" and "zoom to" buttons are not visible.

 

After doing everything like you'd described in your reply, also the text and mtext objects are selected. Not only the blocks with the particular value.

 

 

 

 

The variable "grips" and "pickfirst" are set to 1

 

I'm using AutoCad 2015

0 Likes
Message 5 of 20

wispoxy
Advisor
Advisor

Select All shows if your system variables GRIPS and PICKFIRST are set to 1.

Set commands GRIPS 1 and PICKFIRST 1

0 Likes
Message 6 of 20

Sandervp
Advocate
Advocate

Hello Wisp,

 

The system variables PICKFIRST and GRIPS are both set to 1. But I can't see/ find any Select all or Zoom to buttons. Doesn't matter how I try to find the blocks with the specific attribute text.....

0 Likes
Message 7 of 20

wispoxy
Advisor
Advisor

A screenshot of me doing it.

 

wisp_fr.png

0 Likes
Message 8 of 20

wispoxy
Advisor
Advisor

A screenshot of me doing it.

Remember, Find and Replace will only find values in a block, NOT PROMPT. People mix it up often.

 

wisp_eae_cut.png

0 Likes
Message 9 of 20

wispoxy
Advisor
Advisor
What version of AutoCAD are you using? What is your OS?
0 Likes
Message 10 of 20

Sandervp
Advocate
Advocate

Sorry Wisp, but I saw in your picture the checkbox "list results" is selected. I didn't selected that, the list wasn't visible.

 

Now I can see the "zoom to" and "select all" buttons.......

 

But if I use the "find" command first, I'm typing the text and push the "find" button. ALL the result in the drawing are visible in the list. The text objects, mtext objects and block attributes.

Now I have to sort the results first, select the block attributes, and after that I can replace them.

 

Isn't possible to search for only block attributes without changing the search options every time by using a new command or lisp? I prefer using a command with different options in the command bar, not a dialog box.

 

For example:

I'm also using 2 lisp files. One is for searching (100% matching) text and mtext objects, the other one is searching for text and mtext objects which contains a specific text string.

 

Isn't possible to change the first lisp, so that its search for blocks with the 100% matching value (not PROMPT)?

 

This is the lisp for searching the text or mtext objects;

(defun C:FT (/ str ss) ; = Find text(s) by Content
  (setq str (getstring "\nInsert mtext/text: "))
  (if (setq ss (ssget "_X" (list (cons 0 "*TEXT") (cons 1 str) (cons 410 (getvar 'ctab)))))
    (sssetfirst nil ss); select/highlight/grip
  ); if
); defun

 

 

 

I'm using AutoCad 2015 SP2 and OS Windows 7 

0 Likes
Message 11 of 20

wispoxy
Advisor
Advisor

Reposting Image, not sure why it's censored in my other post.

wisp_fr04y.png

0 Likes
Message 12 of 20

wispoxy
Advisor
Advisor
0 Likes
Message 13 of 20

Sandervp
Advocate
Advocate

I've copied the lisp;

 

(defun LM:vl-getattributevalue ( blk tag )
(setq tag (strcase tag))
(vl-some '(lambda ( att ) (if (= tag (strcase (vla-get-tagstring att))) (vla-get-textstring att)))
(vlax-invoke blk 'getattributes)
)
) 

 

but I can't use him. After using the "LM" command, the layer state manager dialog box shall appear. Do I need to change something first?

My own knowledge of lisp files isn't really good.

 

(My English neither)

0 Likes
Message 14 of 20

wispoxy
Advisor
Advisor
You talking about running the lisp? You need to use APPLOAD
0 Likes
Message 15 of 20

wispoxy
Advisor
Advisor

Your code is for visual lisp, Command VLISP. The command you're looking for is

-getattributevalue 

not LM, will only work in visual lisp though.   🙂

0 Likes
Message 16 of 20

Sandervp
Advocate
Advocate

What am I doing wrong?

 

I've copied your lisp and saved him on my pc named lm.lsp.

After that, I've opened the Load/unload applications dialog box.

I've loaded the lm.lsp into the Loaded applications and also into the Startup Suite. 

 

But do I use the command;

 

Command: -getattributevalue
Unknown command "-GETATTRIBUTEVALUE".  Press F1 for help.

 

 

It doesn't work......

 

The lisp file is standing between the other loaded applications int he loaded applications list. 100% for sure, it's loaded.

Everything is done like it should be done.

 

0 Likes
Message 17 of 20

wispoxy
Advisor
Advisor
You need to load it in visual lisp, command VLISP
0 Likes
Message 18 of 20

Sandervp
Advocate
Advocate

Sorry Wisp,

 

I'm not really familiar with Visual Lisp editor.

 

I've loaded the lsp file into the Visual Lisp editor. After that I've created an application called lm.vlx.

(load "lm.vlx") is the next command I use after I've close the vlisp editor.

 

But still I can't use the -getattributes command. Do I need to do something with the .prv file?

 

How do I need to use the visual lisp editor exactly? I'm only using appload to load .lsp files, to use te vlisp editor is totally new for me

 

 

0 Likes
Message 19 of 20

wispoxy
Advisor
Advisor
Accepted solution
0 Likes
Message 20 of 20

Anonymous
Not applicable

Hi Sandervp,

I had a problem same you.

i can fix it without lisp, try if you  like.

 

goodluck.

 

0 Likes