Jump to content

Attributes load with lisp


Dayananda

Recommended Posts

;; 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.

Link to comment
Share on other sites

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

  • Like 2
Link to comment
Share on other sites

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

  • Thanks 1
Link to comment
Share on other sites

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 

Link to comment
Share on other sites

(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 by BIGAL
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...