Author Topic: combining two attributes for extraction  (Read 3127 times)

0 Members and 1 Guest are viewing this topic.

ELOQUINTET

  • Guest
combining two attributes for extraction
« on: April 04, 2005, 01:32:14 PM »
i believe i asked this before in another question so i've given it it's own topic. is there a way to combine two attributes and put a space in between the two so when i extract the info it come in a single cell?

daron

  • Guest
combining two attributes for extraction
« Reply #1 on: April 04, 2005, 02:04:03 PM »
As strings: Strcat. As entities: cons, append, list... Some should be combined. Depends what you are looking to do.

ronjonp

  • Needs a day job
  • Posts: 7529
combining two attributes for extraction
« Reply #2 on: April 04, 2005, 02:11:19 PM »
Dan,

You could use the export attributes in express tools and use this formula in excel to combine the 2 columns with a space between them.

Column H =
Code: [Select]
=(C3)&" "&(D3)



Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

ELOQUINTET

  • Guest
combining two attributes for extraction
« Reply #3 on: April 04, 2005, 03:27:25 PM »
ah that's cool ron i was having to trim the text then was using =CONCATENATE(a1," ",b1) to join them so this cuts out a step thanks. i was actually trying to do it in autocad so i could limit the amount of formulas i need to use as i'm copying and pasting stuff all over the place. since we are on the topic, what i am now trying to figure out how to do is print out some sort of report which will show first a list of numbers then beside it the corresponding number and name and what row it is on so i can quickly match the room name to the number. i was playing with filters but it would be nicer to have a report i could print out. what are pivot tables used for? thanks

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
combining two attributes for extraction
« Reply #4 on: April 04, 2005, 07:11:02 PM »
Dan,
If you have the attribute values stored as att1 & att2 then it's just this to combine them:
(strcat att1 " " att2)

ELOQUINTET

  • Guest
combining two attributes for extraction
« Reply #5 on: April 05, 2005, 11:25:30 AM »
jeff i'm really a novice at writing code so don't laugh, here's where i am right now yikes  :shock:

Code: [Select]
(defun c:combatt ()
(strcat tag30 " " tag40)
      (princ)
  )

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
combining two attributes for extraction
« Reply #6 on: April 05, 2005, 01:32:20 PM »
Heh, I'm not laughing....how do you want to get the 2 attributes? All attributed blocks? Selection set? Single pick? By block name? By attribute value?

You see, I kinda thought you already had that part..... ;)

Here's one way that uses ssget but only allows you to select one attributed block:
Code: [Select]

(defun c:attcombine (/ ss obj atts att attstr)
  (vl-load-com);make sure Visual Lisp extensions are available
  (while (setq ss (ssget ":S" '((0 . "INSERT")(66 . 1))))
    ;select one attributed block, the while allows you to do it more than once
    (setq obj (vlax-ename->vla-object (ssname ss 0)));get vla-object for block reference
    (setq atts (vlax-invoke obj 'getattributes));;now get the attributes into a list
    (foreach att atts ;;loop through the list
      (if (not attstr);;if attstr has not been set yet
(setq attstr (vla-get-textstring att));;set it to the att value
(setq attstr (strcat attstr " " (vla-get-textstring att)));;else add the attvalue to the end of attstr
);;if
      );;foreach
    (alert (strcat "Combined attribute string is: " attstr))
    ;;do whatever with the value, here I just show the user what it is but sending it to excel could be done here
    )
  (princ);;exit quietly
  )

ELOQUINTET

  • Guest
combining two attributes for extraction
« Reply #7 on: April 05, 2005, 01:53:00 PM »
jeff i think you have the right idea but it's not exactly working. i uploaded 2 symbols to show you what i have. the one i get from the architect doesn't behave like mine which is the simple letter and number one so maybe there's more to it? check it out here thanks

http://www.theswamp.org/lilly_pond/dan/attcombine%20test.dwg?nossi=1

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
combining two attributes for extraction
« Reply #8 on: April 05, 2005, 02:36:26 PM »
Well, sadly, I cannot....I am languishing back here in R2002 land........