See the top rated post in this thread. Click here

Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: extract linear parameter length from dynamic block

  1. #11
    All AUGI, all the time Tharwat's Avatar
    Join Date
    2010-06
    Posts
    914
    Login to Give a bone
    1

    Default Re: extract linear parameter length from dynamic block

    I have completed the codes for you but you need to modify it to suit your needs since that I don't know what you are trying to do with the return value from the LENGTH attribute besides that the alert message which is not logic in this case I believe.

    So just ask if you stuck.

    NOTE: I could not open your drawing since it's saved in later release than mine CAD 2017.
    Code:
    (defun c:penrodcount (/ blks num blk effname unsup)
      (if (setq blks (ssget (list (cons 0 "insert") (cons 2 "`*U*,Pencil Rod") (cons 8 "TIE - Pencil Rod"))))
        (progn                                         
          (repeat (setq num (sslength blks))
            (setq blk (vlax-ename->vla-object (ssname blks (setq num (1- num)))))
            (setq effname (vla-get-EffectiveName blk))
            (cond ((= effname "Pencil Rod") (Get:param:value blk)) ;; you need to assign the value to a variable to use it elsewhere you like in the codes.
                  (t (setq unsup effname)) 
            )                       
          )                       
        )                         
      )                           
      (if unsup (alert (strcat "Unsupported block  " unsup "  found in count process")))
      (princ)
      )
    
    (vl-load-com)
    
    (defun Get:param:value (blk / val)
      ;; blk = Block reference vla-object.	;;
      (vl-some '(lambda (x)
                  (and (= (strcase (vla-get-propertyname x)) "LENGTH")
                       (setq val (vlax-get x 'Value))
                  )
                )
               (vlax-invoke blk 'getdynamicBlockproperties)
      )
      val
    )

  2. #12
    Login to Give a bone
    0

    Default Re: extract linear parameter length from dynamic block

    Quote Originally Posted by Tharwat View Post
    I have completed the codes for you but you need to modify it to suit your needs since that I don't know what you are trying to do with the return value from the LENGTH attribute besides that the alert message which is not logic in this case I believe.

    So just ask if you stuck.

    NOTE: I could not open your drawing since it's saved in later release than mine CAD 2017.
    Code:
    (defun c:penrodcount (/ blks num blk effname unsup)
      (if (setq blks (ssget (list (cons 0 "insert") (cons 2 "`*U*,Pencil Rod") (cons 8 "TIE - Pencil Rod"))))
        (progn                                         
          (repeat (setq num (sslength blks))
            (setq blk (vlax-ename->vla-object (ssname blks (setq num (1- num)))))
            (setq effname (vla-get-EffectiveName blk))
            (cond ((= effname "Pencil Rod") (Get:param:value blk)) ;; you need to assign the value to a variable to use it elsewhere you like in the codes.
                  (t (setq unsup effname)) 
            )                       
          )                       
        )                         
      )                           
      (if unsup (alert (strcat "Unsupported block  " unsup "  found in count process")))
      (princ)
      )
    
    (vl-load-com)
    
    (defun Get:param:value (blk / val)
      ;; blk = Block reference vla-object.	;;
      (vl-some '(lambda (x)
                  (and (= (strcase (vla-get-propertyname x)) "LENGTH")
                       (setq val (vlax-get x 'Value))
                  )
                )
               (vlax-invoke blk 'getdynamicBlockproperties)
      )
      val
    )
    Thanks, Tharwat! I am getting a result from your code, so I think i can integrate that into what I'm doing. If I get stuck, I'll be back. Thanks again! Cheers, -Aaron

  3. #13
    All AUGI, all the time Tharwat's Avatar
    Join Date
    2010-06
    Posts
    914
    Login to Give a bone
    0

    Default Re: extract linear parameter length from dynamic block

    Quote Originally Posted by aaronashley1977783620 View Post
    Thanks, Tharwat! I am getting a result from your code, so I think i can integrate that into what I'm doing. If I get stuck, I'll be back. Thanks again! Cheers, -Aaron
    You're welcome anytime Aaron.

    Feel free to ask whenever you need any further help.

    Have a nice day.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. 2011: Varying increment value for linear parameter for dynamic block
    By Sam Spade in forum Dynamic Blocks - Technical
    Replies: 4
    Last Post: 2013-02-07, 05:35 PM
  2. Linear Parameters vs. Linear Dimensional Constraint
    By melissa_r_alexander in forum Dynamic Blocks - Technical
    Replies: 1
    Last Post: 2010-07-09, 05:10 PM
  3. one linear parameter moves another's parameter grip
    By Coolmo in forum Dynamic Blocks - Technical
    Replies: 4
    Last Post: 2008-04-28, 01:26 PM
  4. Extract Dynamic Block Attributes, values change as Block changes
    By dave.buckberry in forum Dynamic Blocks - Technical
    Replies: 11
    Last Post: 2006-09-05, 04:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •