guitarguy1685 Posted February 16, 2010 Posted February 16, 2010 Is it possible to retrieve the name of a visibility state from a Dynamic Block? I want a lisp that I can click on a block and then draw a leader and fill an attribute block with the block name. I was able to make it work with a simple block but what of a Dynamic Block? the DXF grp code "2" where the name of the block normally is just shows a "*U2" when it's a Dynamic block. any ideas? Thanks in advance Quote
lpseifert Posted February 16, 2010 Posted February 16, 2010 Q1 Is it possible to retrieve the name of a visibility state from a Dynamic Block?I can't take credit for this... posted by drsvsmani on Autodesk Discussion Groups (defun DynamicProps (ename propname value / obj prpL cla cll prp) (setq obj (if (= (type ename) 'VLA-OBJECT) ename (vlax-ename->vla-object ename))) (setq prpL (vlax-invoke obj 'getdynamicblockproperties)) (setq return (if (setq prp (vl-remove-if-not (function (lambda(x)(= (vlax-get-property x 'PropertyName) propname))) prpL)) (mapcar (function (lambda(v) (if (and (/= value nil)(vlax-property-available-p v 'Value)(/= (type value)'LIST)) (progn (vlax-put-property v 'Value value)(vla-update obj)) ) (if (and (vlax-property-available-p v 'AllowedValues) (vlax-get v 'AllowedValues)) (list (vlax-get v 'Value)(vlax-get v 'AllowedValues)) (vlax-get v 'Value) ) )) prp) (mapcar (function (lambda(v)(list (vla-get-propertyName v)(vlax-get v 'Value) v))) prpL) ) ) return ) (setq vs (DynamicProps (car (entsel)) "Visibility" nil)) (car (car vs));returns current visibility state Q2 (vlax-get (vlax-ename->vla-object (car (entsel))) 'EffectiveName) Quote
BearDyugin Posted February 16, 2010 Posted February 16, 2010 (defun block_name (bloc / name) [b][color="Red"](vl-load-com)[/color][/b] (setq bloc (if (eq (type bloc) 'ENAME) (vlax-ename->vla-object bloc) ) name (if (eq (type bloc) 'VLA-OBJECT) (cond ((= (vla-get-isdynamicblock bloc) :vlax-true) (vla-get-effectivename bloc) ) (t (vla-get-name bloc) ) ) ) ;_cond ) ) Quote
guitarguy1685 Posted February 19, 2010 Author Posted February 19, 2010 hmm i can't get either one to work Quote
BearDyugin Posted February 19, 2010 Posted February 19, 2010 Has forgotten to load in a code vla functions (vl-load-com) Command: (block_name (car(entsel)))Select object: "Geo_Point" Geo_Point - name of the selected block 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.