Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attributes to attributes sharing info between em??? 1

Status
Not open for further replies.

shadow

Computer
Mar 1, 2001
321
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
 
Replies continue below

Recommended for you

Dear shadow,
In AutoCAD 2002 you can change tags and values of attributes using the EATTEDIT command.
:)
Farzad
 
It can be done with LISP or VBA. Do you know either?
 
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
 
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 &quot;ATTRIB&quot;
)
(while (/= EN &quot;SEQEND&quot;)
(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 &quot;ATTRIB&quot;
ANAME NIL
TAG (strcase TAG)
MORE t
)
(while MORE
(setq ENAME (entnext ENAME)
ENTL (entget ENAME)
EN (LI_ITEM 0 ENTL)
)
(if (= EN &quot;ATTRIB&quot;)
(progn
(setq _TAG (strcase (LI_ITEM 2 ENTL)))
(if (= TAG _TAG)
(setq ANAME ENAME
MORE NIL
)
)
)
(setq MORE NIL)
)
)
ANAME
)
(princ &quot;\nType COPYBLKATTS to begin&quot;)
 
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
 
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
 
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
 
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.
 
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
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor