Hi folks,
1 - I found this code in some thread, written by Lee. Thanks Lee. In this code I want to supply list of full filenames (with path) and to skip folder selection dialogue box. But not idea where to change. I do have filename name list to supply. Please help!
2 - This code is doing great job by reading all attributes from directory files. Now, I want to process this list and update attributed texts in targeted drawing. For this need to know block's entity name or probably handle and insertion co-ordinates to sort by x-axis or y-axis.
While extracting block information through this code can we extract entity name or handle of entity and block's insertion co-ordinate ? If so it will be easy to updates attributes.
For example variable data returning list - (("C:\\Users\\vincent_r\\Desktop\\stuff \\1234-05.dwg" ("WD_WCH" (("WIRECOPY" . "07-41")) (("WIRECOPY" . "07-41")) …………………
If we can get - (("C:\\Users\\vincent_r\\Desktop\\stuff \\1234-05.dwg" ("WD_WCH" handle co-ordinate (("WIRECOPY" . "07-41")) (("WIRECOPY" . "07-41")) …………………
then calling function will be (functiontoupdateatt fullfilename handleorentityname tag newattvalue).
I am looking for code/function to update attribute in drawing without open it.
Its just an idea, mey be there is some other way.
(defun _getattributes ( doc / data item name values )
(vlax-for layout (vla-get-layouts doc)
(vlax-for object (vla-get-block layout)
(if
(and
(eq "AcDbBlockReference" (vla-get-objectname object))
(eq :vlax-true (vla-get-hasattributes object))
(setq values
(mapcar
(function
(lambda ( att )
(cons
(vla-get-tagstring att)
(vla-get-textstring att)
)
)
)
(vlax-invoke object 'getattributes)
)
)
)
(if (setq item (assoc (setq name (vla-get-effectivename object)) data))
(setq data
(subst
(append item (list values))
item
data
)
)
(setq data (cons (list name values) data))
)
)
)
)
data
)
(setq data (LM:ODBX '_getattributes nil nil))
Thanks in advance !
Sorry. First requirement was my mistake. Solved. I did not observed Lee's object DBX wrapper already loaded. Sorry again.
Any help on second ?
Any help will be highly appreciated.
Modified Lee's code to meet expectation. Now I can get block handle number for future reference. Now the block data list output is ("HA1D1~*~202EB4F" (("DESC1" . "0VDC").......))).
It may useful to someone.
(defun _getattributes ( doc / data item name values )
(vlax-for layout (vla-get-layouts doc)
(vlax-for object (vla-get-block layout)
(if
(and
(eq "AcDbBlockReference" (vla-get-objectname object))
(eq :vlax-true (vla-get-hasattributes object))
(setq values
(mapcar
(function
(lambda ( att )
(cons
(vla-get-tagstring att)
(vla-get-textstring att)
)
)
)
(vlax-invoke object 'getattributes)
)
)
)
(if (setq item
(assoc (setq name (strcat (vla-get-effectivename object) "~*~" (vla-get-Handle object))) data))
(setq data
(subst
(append item (list values))
item
data
)
)
(setq data (cons (list name values) data))
)
)
)
)
data
)