PDA

View Full Version : Creating 2 ATTTRIBUTES with same value



george.arq
2008-04-10, 12:54 AM
Hi Guys,
How can I create 2 or more attributes that will receive SAME value and need not to write them twice (or more).
I want it ask me one time only and all attributes with same tag receive the same value.

An basic example:
SECTION LINE - A section line displays its identifications in both sides of the line. And these both sides has the same identification values (number of section, page in project). I wish I need not to write them twice in this case ( in others case i have more than 5 attributes with same value)
I though I just needed to create both attributes with same TAG, but i was wrong. It still ask me the value twice when insert.

How to proceed?

Thanks,
George Cabral
http://img88.imageshack.us/img88/2800/userbarativanewmx9.png (http://ativa.arq.br)

ccowgill
2008-04-10, 02:55 PM
you could get a program that will fill in the second attribute for you. We use a very similar one for one of our title blocks that the sheet description must appear in the title block and also in the bottom right corner of the drawing, just inside the border.

george.arq
2008-04-11, 12:20 AM
How can i find this program?
Do you know the program's name?
Is it like a lisp? and is it free?

Thanks :)

ccowgill
2008-04-11, 01:01 PM
It will require tweaking to get it to run for your particular situation:


(defun SDC (/ ss Ent EntData Att Att2 tmplist tmp2list val2 val point1
point2)
(setq ss
(ssget
"_x"
(list
'(-4 . "<and")
(cons 410 (getvar "ctab"))
'(0 . "insert")
'(2
.
"TBL01,TBL06,TBL07,TBL09,TBL12,TBL13,TBL14,TBL14TEXTWRAP,TBL15,WJITBLK24X36"
)
(cons 10 '(0 0 0))
'(-4 . "and>")
) ;_end list
) ;_end ssget
) ;_end setq
(if (/= ss nil)
(progn
(setq Ent (ssname ss 0))
(setq EntData (entget Ent))
(IF (= (strcase (cdr (assoc 2 EntData))) "TBL13")
(progn
(setq tmp2List (cons Att2 (vla-get-TextString Att2))
val2 (cdr tmp2list)
) ;_ end of setq
(SetCustomDwgProp "SHEET DESCRIPTION" val2)
(vla-Regen
(vla-get-ActiveDocument
(vlax-get-Acad-Object)
) ;_ end of vla-get-ActiveDocument
acActiveViewport
) ;_ end of vla-Regen
) ;_end progn
) ;_end if
) ;_ end progn
) ;_ end if
) ;_ end defun
(defun getCustomDwgProp (key / try val)
(vl-load-com)
(cond
((vl-catch-all-error-p
(setq try (vl-catch-all-apply
'vla-GetCustomByKey
(list DwgProps key 'val)
) ;_ end of vl-catch-all-apply
) ;_ end of setq
) ;_ end of vl-catch-all-error-p
(setq val nil)
)
) ;_ end of cond
val
) ;_ end of defun
(defun SetCustomDwgProp (key value /)
(vl-load-com)
(if (getCustomDwgProp key)
(vla-SetCustomByKey DwgProps key value)
(vla-AddCustomInfo DwgProps key value)
) ;_ end of if
) ;_ end of defun
(if (not Command_Ending_Reactor)
(setq Command_Ending_Reactor
(vlr-command-reactor
nil
'((:vlr-commandended
.
Command_Ended_Command
)
)
) ;_ end of vlr-command-reactor
) ;_ end of setq
() ;_ the reactor is already loaded
) ;_ end of if
(defun Command_Ended_Command (In_ReactorName In_Command / LayObj tess)
(cond
((or
(= (car In_Command) "EATTEDIT")
(= (car In_Command) "DDEDIT")
) ;_ end of or
(if
(/= (setq tess (cdr (assoc 2 (entget (ssname (ssget "_P") 0)))))
nil
) ;_ end of /=
(if
(wcmatch
(strcase
tess
) ;_ end of strcase
"TBL01,TBL06,TBL07,TBL09,TBL12,TBL13,TBL14,TBL14TEXTWRAP,TBL15,WJITBLK24X36"
) ;_ end of wcmatch
(SDC)
) ;_ end of if
) ;_ end of if
) ;_end cond5
((or
(= (car In_Command) "ACDCATTEDIT")
(= (car In_Command) "INSERT")
) ;_ end of or
(if
(wcmatch
(strcase (cdr (assoc 2 (entget (entlast)))))
"TBL01,TBL06,TBL07,TBL09,TBL12,TBL13,TBL14,TBL14TEXTWRAP,TBL15,WJITBLK24X36"
) ;_ end of wcmatch
(progn
(SDC)
(c:dwa)
) ;_ end of progn
) ;_ end of if
) ;_end cond6
) ;_ end cond
) ;_ end defun

it might not work at all, we have a very complex set up for our lisp routines, and the above are several pieces from several different programs. You will definitely need to change the names of the blocks to match your standard block name, as well as the tag name. All the parenthesis appear to check out, so you should be able to tweek, load, and run. What the program will do is load a reactor that will fire when ever the block is edited and will look for information in the particular tag and then automatically update the other entity. You will have to set up your block so the other text is a field matching back to the custom drawing property. Like I said, it is pretty complex to get it to work.

Gigliano70
2008-04-11, 10:40 PM
Read up on "fields" you can place them in blocks and all kinds of good stuff. they will accomplish what your asking. we use a "fields" to populate most of our repatitious fields such as section tags and detail bugs. i wish i could tell you how to use them but it's just a tad more information than i can type here. look them up you'll be glad you did.

george.arq
2008-04-12, 01:00 PM
The Gigliano70's asnwer seems simpler and more accurate then ccowgill's one.
Even so I will test both. Thank you very much guys.

ccowgill:

it might not work at all, we have a very complex set up for our lisp routines, and the above are several pieces from several different programs. You will definitely need to change the names of the blocks to match your standard block name, as well as the tag name. All the parenthesis appear to check out, so you should be able to tweek, load, and run. What the program will do is load a reactor that will fire when ever the block is edited and will look for information in the particular tag and then automatically update the other entity. You will have to set up your block so the other text is a field matching back to the custom drawing property. Like I said, it is pretty complex to get it to work.
Actually, this is for my new dynamic blocks, so I didnt create so many yet. And Coincidentally the ones I created has the same block and tag name. :) This definitely will not be a problem.
I will test it when i have a free time and I will post here the result :) Thanks.



Read up on "fields" you can place them in blocks and all kinds of good stuff. they will accomplish what your asking. we use a "fields" to populate most of our repatitious fields such as section tags and detail bugs. i wish i could tell you how to use them but it's just a tad more information than i can type here. look them up you'll be glad you did.

I really thought I could use fields. But I took a over view in it and thought I could only use the default fields like file name, date... etc. I will read up deeply now and any doubts I come here again :)

Peace. ;)

ccowgill
2008-04-14, 12:51 PM
The Gigliano70's asnwer seems simpler and more accurate then ccowgill's one.
Even so I will test both. Thank you very much guys.

ccowgill:

Actually, this is for my new dynamic blocks, so I didnt create so many yet. And Coincidentally the ones I created has the same block and tag name. :) This definitely will not be a problem.
I will test it when i have a free time and I will post here the result :) Thanks.




I really thought I could use fields. But I took a over view in it and thought I could only use the default fields like file name, date... etc. I will read up deeply now and any doubts I come here again :)

Peace. ;)
the program I posted might not play well with dynamic blocks, the name seems to change when the block is dynamically modified. I have some other routines that I have downloaded that I may be able to incorporate to run back to the base name, not the revised block name after dynamic modification.