Jump to content

Lisp to select block and change Known Attribute value


Recommended Posts

Posted (edited)

Hi.

I have a block representing a pipe.

all the attributes are invisible.

the block is already in the drawing - no need to insert it.

I have a lisp that enable me to use the DIST command to set the value of the pipe length and set it to the "QUANTITY" attribute value.

the problem with this lisp is that the attribute must be visible.

is it possible to select the block and make the lisp to enter the value to the "QUANTITY" attribute value?

here is the lisp:

 

(defun c:NLENGTH ( / obj p1 di )
(setq p1 (getpoint "\nPoint 1: "))
(setq di (getdist p1 "\nDistance: "))
(setq obj (vlax-ename->vla-object (car (nentsel "\nPick attribute "))))
(vla-put-textstring obj di)
(command "regen")
(princ)
)

 

basically what i need is this:

1.prompt to set the distance (exist in the lisp).

2. prompt to select the block (now it is prompt me to select the attribute it self).

3. insert the distance value in to the value field of the "QUANTITY" attribute.

 

many thanks,

Ari.

Edited by aridzv
Posted

if the TAG name is known you can use setpropertyvalue

(defun c:NLENGTH (/ obj p1 di)
  (setq p1 (getpoint "\nPoint 1: "))
  (setq di (getdist p1 "\nDistance: "))
  (setq obj (car (entsel "\nSelect Block ")))
  (setpropertyvalue obj "QUANTITY" (rtos di))
  (command "regen")
  (princ)
)

 

  • Like 1
Posted

@pBe

THANKS!!!

works perfectly!!!

Ari.

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