Dayananda Posted July 3, 2022 Posted July 3, 2022 After selecting a block I want to change attribute values as feed to lisp file. Can some one help me? Quote
Dayananda Posted July 3, 2022 Author Posted July 3, 2022 (edited) I want to create a lisp file . Edited July 3, 2022 by Dayananda Quote
Dayananda Posted July 3, 2022 Author Posted July 3, 2022 ;; Get Attribute Value - Lee Mac ;; Returns the value held by the specified tag within the supplied block, if present. ;; blk - [vla] VLA Block Reference Object ;; tag - [str] Attribute TagString ;; Returns: [str] Attribute value, else nil if tag is not found. (defun LM:vl-getattributevalue ( blk tag ) (setq tag (strcase tag)) (vl-some '(lambda ( att ) (if (= tag (strcase (vla-get-tagstring att))) (vla-get-textstring att))) (vlax-invoke blk 'getattributes)) ) Pl. explain me blk-[vla] VLA Block Reference Object Is that mean the entity name of the block or some other thing. Quote
Steven P Posted July 3, 2022 Posted July 3, 2022 18 minutes ago, Dayananda said: Pl. explain me blk-[vla] VLA Block Reference Object Is that mean the entity name of the block or some other thing. A few options but looking at this I reckon it is the VLA- entity name, if you scroll down the page there is a version with entity name as well, however Sunday, CAD is off so can't check for you 2 Quote
BIGAL Posted July 4, 2022 Posted July 4, 2022 You need to explain more, what it is your trying to do. I have for example update title blocks across multiple layouts. So do you need pick block, pick attributes ? Are you aware this gets a attribute details. (setq att (entget (car (nentsel "\nPick a attribute ")))) (setq att (entget (car (nentsel "\nPick a attribute ")))) ((-1 . <Entity name: 3d5bc970>) (0 . "ATTRIB") (5 . "D999") (330 . <Entity name: 3d5bd070>) (100 . "AcDbEntity") (67 . 1) (410 . "D01") (8 . "DRGTEXT") (62 . 5) (370 . -1) (100 . "AcDbText") (10 693.8875 56.125 0.0) (40 . 7.0) (1 . "PRELIMINARY DRAWING") (50 . 0.0) (41 . 1.0) (51 . 0.0) (7 . "Standard") (71 . 0) (72 . 4) (11 742.1875 59.625 0.0) (210 0.0 0.0 1.0) (100 . "AcDbAttribute") (2 . "DRAWING_STATUS") (70 . 0) (73 . 0) (74 . 0) (280 . 0)) 1 is text 2 is tagname 1 Quote
phjlc Posted July 4, 2022 Posted July 4, 2022 can you try this ; (defun c:asd() (setq attlist (vlax-invoke (vlax-ename->vla-object (car (entsel))) 'getattributes) attnumb (- (getint "which attribute number is it?") 1) attstrg (getstring "what string??") ) (vlax-put-property (nth attnumb attlist) 'textstring attstrg) ) i guess this will give you a basic idea how to access the attribute blocks Quote
BIGAL Posted July 5, 2022 Posted July 5, 2022 (edited) (car (entsel)) better as (car (entsel "\nSelect a block ")) like in another post ssget with filter "INSERT" is more reliable as it must be a block use (ssname ss 0) to get block. need dayananda to provide more info 1 attribute or more, is it to be a random number of attributes to be changed, there are ways of displaying all the tag names and selecting them. Edited July 5, 2022 by BIGAL Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.