Hello all.
I am wondering how to combine multiple unique value text strings from attribute definitions into one separate attribute definition value. I also want it to update automatically (or use a command to sync it all at once but "attsync" doesn’t seem to do the trick) For example: I want the unique value of "" , "", and "" values to be combined text with spaces on the "" line.
I have included below what I have already tried but can't get it to update atomatically correctly:
I am trying to get this block "x GROUP" to update as "x x x" automatically
Each value will be different so a "find and replace" or update in properties tab wont work.
I have included a DWG with an example block with data and original inserted block.
Thank you in advance for your time and help.
Like this ? You'll need to regen to see the changes. AFAIK you cannot link the default values within the attribute definitions. It has to point back to the attributes within the block to get the actual text 'values'.
Wait when I go to redefine the block it changes "Block Reference" to "Block" and doesnt work. Could you tell me how to redefine the block instead of just changing the "Las Vegas" block.
@sarahsarah2015 wrote:
Wait when I go to redefine the block it changes "Block Reference" to "Block" and doesnt work. Could you tell me how to redefine the block instead of just changing the "Las Vegas" block.
Why are you trying to redefine the block?
Give this code a try .. it will populate all existing "ADDRESS_DATA" blocks with the correct fields.
(defun c:foo (/ _fld a b c d s)
;; RJP » 2023-05-04
(defun _fld (id) (strcat "%<\\AcObjProp Object(%<\\_ObjId " (itoa id) ">%,1).TextString>%"))
(cond ((setq s (ssget "_X" '((0 . "INSERT") (2 . "ADDRESS_DATA"))))
(foreach e (mapcar 'cadr (ssnamex s))
(foreach at (vlax-invoke (vlax-ename->vla-object e) 'getattributes)
(cond ((= "AP#" (vla-get-tagstring at)) (setq a at))
((= "APSIZE" (vla-get-tagstring at)) (setq b at))
((= "TAILFT" (vla-get-tagstring at)) (setq c at))
((= "APGROUP" (vla-get-tagstring at)) (setq d at))
)
)
(vla-put-textstring
d
(strcat (_fld (vla-get-objectid a))
" "
(_fld (vla-get-objectid b))
" "
(_fld (vla-get-objectid c))
)
)
)
)
)
(princ)
)
I need hundreds of these blocks to be imported at once (using mapimport and a address shapefile). So I have to redefine the block I think. The intention is to automatically have this field setup to generate on import.
If you're importing them and the blockname matches your example as well as the attributes then run my code once after the import and all should be good.
I don't use MAP so not sure what this import looks like.
I can do that for my current project but this is intended for a n is for this to work on import. Thank you for the script it's just not what I am looking for unfortunately. If you have any insight into how to create the block to be formatted like the example block you did any hints are welcomed!
A hack would to use that block I made which is correct .. then insert it into your drawing .. explode it then do whatever map import specializes in.
but you didn't redefine the block which is what I need to do first in order to insert the block again. You edited the individual example block but when I redefine the block you made it doesn't automatically update the field. That is what the original purpose of the post is.
I told you much earlier in this thread that you cannot link the default values to attribute definitions. The block I "fixed" is referencing itself ( block reference ) and the attributes ( not attribute definitions ) within it that contain values.
Long story short, AFAIK what you're trying to do is not possible. Use the code I provided .. it's better than nothing.
Can't find what you're looking for? Ask the community or share your knowledge.