Jump to content

retrieve distance parameter from dynamic block


poorestchump

Recommended Posts

I don't know enough about vlisp to do this on my own. I've attached a dwg with dynamic blocks and a routine that numbers parts and totals the qty's. I need another routine that will find the distance from a stretch parameter created in the block editor so that only identically named parts with the same length will show up on the same line in a data extraction table. I can't find anything anywhere that shows how this might be done.

Please help me:(

Thanks in advance,

jb

junk.dwg

333.LSP

Link to comment
Share on other sites

Hi

 

The below code will set you on your way. Once you select a block it will list the attibutes and their corresponding values in the command line

 

(vl-load-com)
(defun c:gdi( / )
 (setq ent
    (vlax-ename->vla-object
        (car
          (entsel "\nSelect block"))))
 (if(=(vla-get-hasattributes ent) :vlax-true)
   (progn
     (foreach att(vlax-safearray->list(vlax-variant-value(vla-getattributes ent)))
       (princ (strcat "\n" (vla-get-tagstring att) ": " (vla-get-textstring att) ))
     )
   )
 )
)

Hope this helps

Ollie

Link to comment
Share on other sites

Here's one way to get Dynamic Block Properties:

 

(defun GetDynProps (obj)
 (if (eq :vlax-true (vla-get-isDynamicBlock obj))
   (mapcar
     (function
       (lambda (x)
         (list (vla-get-PropertyName x)
               (if (= 8192 (logand 8192 (vlax-variant-type
                                          (setq var (vla-get-value x)))))
                 (vlax-safearray->list
                   (vlax-variant-value var))
                 (vlax-variant-value var)))))
     
   (vlax-invoke obj 'GetDynamicBlockProperties))))

 

 

And another :)

 

(defun GetDynProps (obj)
 (if (eq :vlax-true (vla-get-isDynamicBlock obj))
   (mapcar
     (function
       (lambda (x) (list (vla-get-PropertyName x)
                         (vlax-get x 'Value))))
     
   (vlax-invoke obj 'GetDynamicBlockProperties))))

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