×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Attributes to attributes sharing info between em???

Attributes to attributes sharing info between em???

Attributes to attributes sharing info between em???

(OP)
ok i have 6 layouts each have a block called fema info$$$$ each have attributes with the same tags which can contain the same info but i want to some how populate one block with the other block's attributes info

anyone done this

if everyone helps everybody the world will be a better place

RE: Attributes to attributes sharing info between em???

Dear shadow,
In AutoCAD 2002 you can change tags and values of attributes using the EATTEDIT command.
:)
Farzad

RE: Attributes to attributes sharing info between em???

It can be done with LISP or VBA. Do you know either?

RE: Attributes to attributes sharing info between em???

(OP)
I'm some what of a beginer in lisp and vba

just thought some one might of addressed this at some poiint if i come up with something ill post here k

if everyone helps everybody the world will be a better place

RE: Attributes to attributes sharing info between em???

I built this from some other snippets. Give it a try.

(defun C:COPYBLKATTS()
  (setq ENT (ssget))
  (if (= (sslength ENT) 1)
    (progn
      (setq BLKINF   (BL_GETATTS (cdr (assoc -1 (setq BLK1 (entget (ssname ENT 0))))))
        BLK1NAME (cdr (assoc 2 BLK1))
        BLK1LIST (list (cons 0 "INSERT") (cons 2 BLK1NAME))
        ENTS     (ssget "X" BLK1LIST)
        CNT         0
      ) ;setq
      (if (> (sslength ENTS) 1)
    (progn
      (while (< CNT (sslength ENTS))
        (setq ED (entget (ssname ENTS CNT))) ; get 1st entity in ss
        (setq EN (cdr (assoc -1 ED))) ; Sets ED to the entity data of entity EN
        (foreach ITEM BLKINF
          (setq TAG      (cadr ITEM)
            VALUE (car ITEM)
          ) ;setq
          (BL_WRITEATTR EN TAG VALUE)
        ) ;foreach
        (setq CNT (1+ CNT))
      ) ;end while
    ) ;progn
      ) ;if
    ) ;progn
    ) ;if  
  (princ)
  )
(defun BL_GETATTS (ENAME / ENTL EN ATT TAG ATTLST FLAG TMP)
  (setq
    ATTLST '()
    ENTL   (entget ENAME)
    TMP       (LI_ITEM 66 ENTL)
  )
  (if (and TMP (not (zerop (logand TMP 1))))
    (progn
      (setq
    ENAME (entnext ENAME)
    ENTL  (entget ENAME)
    EN    "ATTRIB"
      )
      (while (/= EN "SEQEND")
    (setq
      ATT     (LI_ITEM 1 ENTL)
      FLAG     (LI_ITEM 70 ENTL)
      TAG     (strcase (LI_ITEM 2 ENTL))
      ATTLST (append ATTLST (list (list ATT TAG FLAG)))
      ENAME     (entnext ENAME)
      ENTL     (entget ENAME)
      EN     (LI_ITEM 0 ENTL)
    )
      )
    )
  )
  ATTLST
)

(defun LI_ITEM (N ALIST)
  (cdr (assoc N ALIST))
)

(defun BL_WRITEATTR (ENAME TAG VALUE / ANAME ENTL)
  (setq ANAME (BL_FINDATTR ENAME TAG))    ; Search for attribute
  (if ANAME
    (progn
      (setq
    ENTL (entget ANAME)
    ENTL (subst (cons 1 VALUE) (assoc 1 ENTL) ENTL)
    )
      (entmod ENTL)
      (entupd ENAME)
      )
    )
  ENAME
  )

(defun BL_FINDATTR (ENAME TAG / ANAME ENTL EN CNT MORE _TAG)
  (setq    EN "ATTRIB"
    ANAME NIL
    TAG (strcase TAG)
    MORE t
    )
  (while MORE
    (setq ENAME    (entnext ENAME)
      ENTL    (entget ENAME)
      EN    (LI_ITEM 0 ENTL)
      )
    (if    (= EN "ATTRIB")
      (progn
    (setq _TAG (strcase (LI_ITEM 2 ENTL)))
    (if (= TAG _TAG)
      (setq    ANAME ENAME
        MORE  NIL
        )
      )
    )
      (setq MORE NIL)
      )
    )
  ANAME
  )
(princ "\nType COPYBLKATTS to begin")

RE: Attributes to attributes sharing info between em???

(OP)
Hey borgunit
great try but im still trying to figure out what its doing but i think you have the capturing of the info right ?? i think anyone else wanna take a look maybe

?tigrek?

if everyone helps everybody the world will be a better place

RE: Attributes to attributes sharing info between em???

(OP)
ok i got it to work but it only affects the blocks with the same name

if everyone helps everybody the world will be a better place

RE: Attributes to attributes sharing info between em???

(OP)
this is great but like i said if 2 like blocks doesnt mean that they are the same maybe the name is different or the scale or size is ya know
but the common thing is it has some or all attribs incommon like tag wise but the way you have it isnt bad cause it populated all of my blocks with the same info its great
but better if an option to pick block to populate or say all of specific name

maybe

if everyone helps everybody the world will be a better place

RE: Attributes to attributes sharing info between em???

You are correct. It only takes one block, captures its attributes, and then finds like named blocks and fills in the info with matching tags. If you are looking for similar named blocks, it can be done. It also sounds like you are looking for some other logic (finding scales and what-not). Before I get too involved, you may need to describe each step that you want to accomplish along the way.

RE: Attributes to attributes sharing info between em???

(OP)
1 Captures block attrib info
2 either one of several options
   a select another block with same/similar attribs meaning the attribute tag/prompt hasta match
   b option to by block name with option to do all or prompt one at a time
   c match by attrib tag (ie meaning that all blocks with an attrib with the same tag/prompt would be populated with just that attribs info
3 populates blocks/a block attribute with info/infos
returns the amount of plocks fully populated and # that were populated depending on tag/prompt

if everyone helps everybody the world will be a better place

RE: Attributes to attributes sharing info between em???

awesome, thanks to borgunit's LSP routine. I'm gonna see if I can incorporate a little scripting to bring up the LSP routine during startup to change attributes once and for all.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources