Results 1 to 2 of 2

Thread: Help: add total length in dynamic blocks

  1. #1
    Member
    Join Date
    2017-08
    Posts
    19
    Login to Give a bone
    0

    Default Help: add total length in dynamic blocks

    First of all, I want to thank each of the users that with their great help I have been able to learn a little about Lisp.
    I hope and some of you can help me with this code to add the total length of dynamic blocks that have a stretch parameter.
    Basically the code works well; asks the user to enter the name of the parameter and then performs its function.
    There is a problem: if I select other dynamic blocks that have another parameter by name, it does not work; I would like to be able to solve that problem. Any ideas?
    I would also like it to be repeated multiple times and that the previous user's entry be saved for the name of the parameter.
    I hope it's not too much to ask. From Mexico I thank you very much, and I apologize for my English, which is not very good. I will be very grateful if someone can help me.

    Code:
    ;Suma en bloques dinamicos: Indicando el nombre del parametro
    ;Solo seleccionar bloques dynamicos que tengan ese parametro
    
    
    (vl-load-com)
    
    (defun c:SUMBD
           (/ total selectionset count intger selectionsetname obj AR)
      
      (setq AR (getstring t "\nNOMBRE PARAMETRO: "))
    
    (defun LM:getdynpropvalue ( blk prp )
        (setq prp (strcase prp))
        (vl-some '(lambda ( x ) (if (= prp (strcase (vla-get-propertyname x))) (vlax-get x 'value)))
    	     (vlax-invoke blk 'getdynamicblockproperties)
    	     )
        )
      
      (if (setq total 0
    	    selectionset
    	     (ssget '((0 . "INSERT")
    		      (-4 . "<or")
    		      (2 . "`*U*")
    		      (2 . "_P1000")
    		      (-4 . "or>")
    		      )
    		    )
    	    )
        (progn
          (setq count (sslength selectionset))
          (repeat (setq intger (sslength selectionset))
    	(setq selectionsetname
    	       (ssname selectionset
    		       (setq intger (1- intger))
    		       )
    	      obj (vlax-ename->vla-object selectionsetname)
    	      total (+ total
    		       (LM:getdynpropvalue obj AR)
    		       )))
          (alert (strcat " CANTIDAD TOTAL DE BLOQUES DYNAMICOS :"
    		     "< "
    		     (itoa count)
    		     " >"
    		     "\n"
    		     " LONGITUD TOTAL EN BLOQUES DYNAMICOS :"
    		     "< "
    		     (rtos total 2)
    		     " >"
    		     )
    	     )
          )
        (princ)
        )
      (princ)
    )

  2. #2
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Help: add total length in dynamic blocks

    Hi,

    Did not my reply help you with what you are after in this THREAD ?

Similar Threads

  1. Replies: 9
    Last Post: 2015-05-03, 07:12 PM
  2. Total Length of Polylines
    By vijaybaskergundla in forum AutoLISP
    Replies: 7
    Last Post: 2015-04-30, 04:29 PM
  3. DIM Pline by total length?
    By cadtag in forum AutoLISP
    Replies: 1
    Last Post: 2014-08-04, 04:25 PM
  4. Polylines and Total Length
    By revit.wishlist1942 in forum Revit Architecture - Wish List
    Replies: 3
    Last Post: 2012-06-13, 08:10 PM
  5. Total Length of Selection
    By YZ in forum AutoCAD General
    Replies: 4
    Last Post: 2008-07-16, 03:32 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
  •