Lisp to turn off dynamic block property display in properties palette?

Lisp to turn off dynamic block property display in properties palette?

rapidcad
Collaborator Collaborator
1,222 Views
8 Replies
Message 1 of 9

Lisp to turn off dynamic block property display in properties palette?

rapidcad
Collaborator
Collaborator

Hi all, I'm trying to write a utility so that I can automate a change to several hundred dynamic block definitions.

Here's my goal:

I have a dynamic block library of around 240 dynamic blocks which have certain standardized dynamic block properties.

We are discontinuing 3 of the properties so my goal is to hide them from displaying in the properties palette (not delete them entirely). This is easily done in the block editor by opening the Parameters Manager and selecting the show column and toggling the value for the property in question from Yes to No. Of course, that would take about half a day for all those blocks.

 

So, I'm trying to write something to automate this process - either by working on a selection set in a drawing that I would insert them all into, or by opening them from the drive folder one by one in the block editor and accessing the properties there (seems harder, but maybe not).

 

I’d like to search for the property names in question, (they are not in each block, sometimes two are, sometimes only one, occasionally neither) if they are found, change the Show value to :vlax-false. This could be done by cycling through the various properties until a name is matched and then change the value. I have most of the functions written to cycle through properties and search for specific names and set different values, but this isn’t value setting, it is the Show property that needs setting…

 

Does anyone know the proper vla-put that will do this? I was hoping vla-put-show would work but it is not a defined function.

So I tried (vlax-put oSBReferenceProperty "Show" :vlax-false ) but this also is a FAIL. Does anyone know how is this method called?

 

vla-get-show works but vla-put-show, not so much...

 

vla-get-show.JPG

Any help greatly appreciated..

ADN CAD Developer/Operator
0 Likes
1,223 Views
8 Replies
Replies (8)
Message 2 of 9

Anonymous
Not applicable

Hello!

 

Did you try vla-put-visible?

 

Take a look at this post, I think it may help you: http://forums.augi.com/showthread.php?123695-Toggle-attribute-visibility-through-vlisp

0 Likes
Message 3 of 9

rapidcad
Collaborator
Collaborator

Thanks but no, I am working on dynamic block properties, not block attributes.

ADN CAD Developer/Operator
0 Likes
Message 4 of 9

joselggalan
Advocate
Advocate

Outside of the block editor, the dynamic property "show" is read-only.

 

$ (setq a (vlax-invoke (vlax-ename->vla-object (car (entsel))) 'getdynamicblockproperties))
(#<VLA-OBJECT IAcadDynamicBlockReferenceProperty 0000000060547e98> #<VLA-OBJECT IAcadDynamicBlockReferenceProperty 0000000060548218> #<VLA-OBJECT IAcadDynamicBlockReferenceProperty 000000006052f358> #<VLA-OBJECT IAcadDynamicBlockReferenceProperty 0000000060547658> #<VLA-OBJECT IAcadDynamicBlockReferenceProperty 000000006053ed58>)
_$ (mapcar 'vlax-dump-Object a)
; IAcadDynamicBlockReferenceProperty: AutoCAD Dynamic Block Property Interface
; Valores de propiedad:
;   AllowedValues (RO) = ("Fondo No" "Fondo Si")
;   Description (RO) = ""
;   PropertyName (RO) = "Visibilidad1"
;   ReadOnly (RO) = 0
;   show (RO) = -1
;   UnitsType (RO) = 0
;   Value = "Fondo Si"
; IAcadDynamicBlockReferenceProperty: AutoCAD Dynamic Block Property Interface
; Valores de propiedad:
;   AllowedValues (RO) = (1.8 1.90001 2.0)
;   Description (RO) = ""
;   PropertyName (RO) = "Largo"
;   ReadOnly (RO) = 0
;   show (RO) = -1
;   UnitsType (RO) = 2
;   Value = 1.90001
; IAcadDynamicBlockReferenceProperty: AutoCAD Dynamic Block Property Interface
; Valores de propiedad:
;   AllowedValues (RO) = (0.8 0.899994 1.0)
;   Description (RO) = ""
;   PropertyName (RO) = "Ancho"
;   ReadOnly (RO) = 0
;   show (RO) = -1
;   UnitsType (RO) = 2
;   Value = 0.899994
_$ 

 

 

Message 5 of 9

rapidcad
Collaborator
Collaborator

Thanks Jose, That makes sense I suppose. I just thought it strange that I could read the property with vla-get-show, but there was no corresponding vla-put-show.

ADN CAD Developer/Operator
0 Likes
Message 6 of 9

DannyNL
Advisor
Advisor

Yes, they are read-only but you are showing the block instance and not the block definition.

I'm assuming that they should be read-write in the block definition, but I'm not sure if the dynamic block properties can be accessed in the definition with LISP.

0 Likes
Message 7 of 9

rapidcad
Collaborator
Collaborator

Thanks Danny - I came to the same conclusion, unless someone knows a method to write to the "Show" portion of dynamic block properties. vlax-put might be coded in such a way to accomplish this but I'm thinking I don't know the ActiveX method well enough because my attempts have not worked.

I do I think I'm getting warmer now...

I can do this...

(vlax-get-property oSBReferenceProperty "Show")

...and it returns :vlax-true

 

but the following...

(vlax-put-property  oSBReferenceProperty "Show" :vlax-false)

...returns ActiveX Server returned an error: Type mismatch.

 

So, taking Jose's advice, I try...

(vlax-put-property  oSBReferenceProperty "Show" 0)

or

(vlax-put-property  oSBReferenceProperty "Show" -0)

...however, it returns the same error ActiveX Server returned an error: Type mismatch.

 

Anyone know what I am doing wrong with that?

ADN CAD Developer/Operator
0 Likes
Message 8 of 9

DannyNL
Advisor
Advisor

Ronald,

 

My reply was on the post of José-Luis but is also applicable on your last post.

 

For as far as I can tell you are requesting the property value from Show from the block instance which works, but you cannot write to it.

The only way to change the dynamic property settings is in the definition of the block in the block collection (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object))) and not the instance (ssget, entsel, etc.). And if you are working in the block definition there is not a quick way to get to the dynamic block properties with LISP as far as I know. But in case I'm missing something and this is possible then I also really would like to know how.

0 Likes
Message 9 of 9

rapidcad
Collaborator
Collaborator

You are correct about the instance - I have been going the vla-GetDynamicBlockProperties route on a block selection and not going into the block table definition with vla-get-ActiveDocument. I should start digging there and see if I can get that deep with it.

ADN CAD Developer/Operator
0 Likes