Author Topic: find a specific attribute by value  (Read 3240 times)

0 Members and 1 Guest are viewing this topic.

curmudgeon

  • Newt
  • Posts: 194
find a specific attribute by value
« on: December 10, 2010, 10:43:03 PM »
this should be easy, but I have been away for a while.

I have a device number saved in a file as an attribute. I want to get it's location so I can zoom to it and find it.
Code: [Select]
(ssget "_X" '((0 . "ATTRIB") (1 . "17.91.1")))
of course, that returns nil.

I can
Code: [Select]
(setq them (ssget "x" '((0 . "insert")(2 . "a-fp17-fp-alarm$0$sr-ur"))))<Selection set: 64>

then I can zoom to the (cdr (assoc 10 (entget (ssname them 0))))

but I think there is a way to get the one and only attribute I want, I just can't remember how the attributes are associated to a specific insert.
Never express yourself more clearly than you are able to think.

curmudgeon

  • Newt
  • Posts: 194
Re: find a specific attribute by value
« Reply #1 on: December 10, 2010, 11:41:46 PM »
OK - I was being  :ugly:
the attributes FOLLOW and what I need is entnext.

you missed your chance to make me feel even more silly.
Never express yourself more clearly than you are able to think.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: find a specific attribute by value
« Reply #2 on: December 11, 2010, 12:37:39 AM »
No we didn't ... I saved and printed  your post to stick on the beer fridge :)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Lee Mac

  • Seagull
  • Posts: 12929
  • London, England
Re: find a specific attribute by value
« Reply #3 on: December 11, 2010, 06:13:47 AM »
OK - I was being  :ugly:
the attributes FOLLOW and what I need is entnext.

you missed your chance to make me feel even more silly.

Yup - you'll have to cycle through a SelectionSet of all attributed blocks (maybe with a name filter, if possible), dig through the attributes of each til you find your value, then perhaps zoom to the insertion of the Attrib entity.

These may help to demonstrate how to cycle through the attributes associated with a block.  :-)

Good luck!

pBe

  • Bull Frog
  • Posts: 402
Re: find a specific attribute by value
« Reply #4 on: December 11, 2010, 08:00:38 AM »
I would do it this way

vla-get-textsring
vla-getboundingbox
vla-zoomwindow

 :-)



kruuger

  • Swamp Rat
  • Posts: 637
Re: find a specific attribute by value
« Reply #5 on: December 11, 2010, 04:11:25 PM »
maybe this...still working on it
kruuger