Results 1 to 4 of 4

Thread: edited dimension sum

  1. #1
    Login to Give a bone
    0

    Default edited dimension sum

    hi everyone,

    i required a lisp that can calculate sum of the edited dimension

  2. #2
    Login to Give a bone
    0

    Default Re: edited dimension sum

    please help

  3. #3
    I could stop if I wanted to
    Join Date
    2002-08
    Posts
    231
    Login to Give a bone
    0

    Default Re: edited dimension sum

    This?

    Is taking in priority the text override of dimension IF CAN BE READ AS NUMBER otherwise is take the measurement.

    Code:
    (vl-load-com)
    (defun c:dim_cumul ( / js n ename cumul)
    	(princ "\nSelect dimensions for sum.")
    	(setq js (ssget '((0 . "DIMENSION"))))
    	(cond
    		(js
    			(setq cumul 0.0)
    			(repeat (setq n (sslength js))
    				(setq ename (vlax-ename->vla-object (ssname js (setq n (1- n)))))
    				(if (vlax-property-available-p ename 'TextOverride)
    					(if (not (zerop (atof (vl-string-subst "." "," (vlax-get ename 'TextOverride)))))
    						(setq cumul (+ (atof (vl-string-subst "." "," (vlax-get ename 'TextOverride))) cumul))
    						(if (vlax-property-available-p ename 'Measurement)
    							(setq cumul (+ (vlax-get ename 'Measurement) cumul))
    						)
    					)
    					(if (vlax-property-available-p ename 'Measurement)
    						(setq cumul (+ (vlax-get ename 'Measurement) cumul))
    					)
    				)
    			)
    			(princ (strcat "\nThe total sum of dimensions is " (rtos cumul)))
    		)
    		(T (princ "\nNothing selected"))
    	)
    	(prin1)
    )

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

    Default Re: edited dimension sum

    Hi,
    Simply this and regardless of the overwrite values.
    Code:
    (defun c:sumdims (/ sel int ent tot)
      (princ "\nSelect dimensions to sum :")
      (if (setq tot 0.0 int -1
                sel (ssget '((0 . "*DIMENSION")))
          )
        (while (setq ent (ssname sel (setq int (1+ int))))
          (setq tot (+ tot (cdr (assoc 42 (entget ent)))))
        )
      )
      (and (< 0.0 tot) (princ (strcat "\nTotal summation is : " (rtos tot 2 4))))
      (princ)
    )

Similar Threads

  1. Edited out of turn!
    By zach.schmitz959200 in forum Vault - General
    Replies: 0
    Last Post: 2011-08-29, 06:58 PM
  2. How to know when someone has edited styles
    By gandocadguy in forum AutoCAD Civil 3D - General
    Replies: 4
    Last Post: 2009-11-16, 11:18 PM
  3. Track edited dimension values
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 4
    Last Post: 2005-11-24, 05:53 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
  •