Control of block properties table setting

Control of block properties table setting

murmanator
Advocate Advocate
624 Views
2 Replies
Message 1 of 3

Control of block properties table setting

murmanator
Advocate
Advocate

Hello. Hoping someone can help me piece this together. The attached file has the blocks I am referring to. My goal was to have LISP control the setting of my Block property table, the same as if you used the grip. Using Lee Macs wonderful dynamic block suite I tried this but to no avail:

 

(defun c:drainspec ()
(setq lst '(("DRAINS" . "STD-POOL")))
(setq blk (vlax-ename->vla-object (ssname (ssget) 0)))
(LM:setdynprops blk lst)
)

 

Ideally there is way to make this method work but I figure if not then I can use this program to control the one parameter I have in the block, and add something else to change the attribute values. The start of that looked like this and has worked:

 

(defun c:drainspec ()
(setq lst '(("POSITION1 X" . "19")))
(setq blk (vlax-ename->vla-object (ssname (ssget) 0)))
(LM:setdynprops blk lst)
)

 

But now Im at a loss as to how to do the attributes. I tried this but it didnt work:

 

(defun c:ATTTEST ( / ent vla-obj)
(if (setq ent (entsel)) 
(setq vla-obj (vlax-ename->vla-object (car ent))) 
)
(LM:setattributevalue (vla-obj "SIZ" "2")) 
)

 

Ideally the property and attribute changes are part of the same program. I tried a few ways of doing this but none worked. And it needs to be based on a block selection as opposed to just changing stuff by the block name, as there will be multiple iterations of the block in every drawing. Thanks for looking and for your help in advance. 

0 Likes
Accepted solutions (1)
625 Views
2 Replies
Replies (2)
Message 2 of 3

CodeDing
Advisor
Advisor
Accepted solution

@murmanator ,

 

Assuming you're using AutoCAD, you can use the (getpropertyvalue ...) and (setpropertyvalue ...) functions.

Also, to learn more about what these can accomplish, you can use the  (dumpallproperties ...) function.

 

 

 

(setq e (car (entsel)))
(setpropertyvalue e "AcDbDynBlockPropertyBlock Table1" 1)
(dumpallproperties e)

 

 

Best,

~DD

Message 3 of 3

murmanator
Advocate
Advocate

This solves this issue and opens up a whole new world for me! Ive been trying to figure out how to change the properties table selection for some time now. Thank you!!!