CAD Forum - Database of tips, tricks and utilities for AutoCAD, Inventor and other Autodesk products [www.cadforum.cz]
CZ | EN | DE
Login or
registration
  Visitors: 7917
RSS channel - CAD tips RSS tips
RSS discussions

Discussion Discussion forum

 

HelpCAD discussion

 
CAD Forum - Homepage CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.

Please abide by the rules of this forum.

How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic ClosedMULTIPLE LINE LENGTHS SUMMATION

 Post Reply Post Reply Page  <12
Author
jmontesmx View Drop Down
Senior Member
Senior Member


Joined: 28.Jan.2008
Location: Mexico
Using: AutoCad2017
Status: Offline
Points: 113
Direct Link To This Post Posted: 27.May.2016 at 20:15
This can help you too, I ask the same thing some time ago
Back to Top
jmontesmx View Drop Down
Senior Member
Senior Member


Joined: 28.Jan.2008
Location: Mexico
Using: AutoCad2017
Status: Offline
Points: 113
Direct Link To This Post Posted: 27.May.2016 at 20:18

;;; J.A.
;;; www.jorgeanjos.com
;;; www.cadtom.com

;;; VER 1.0 - 2002-09-02
;;; VER 2.0 - 2009-08-28

;;; Begin Sumper.lsp - Application to calculate the length of selected objects

(defun C:SUMPER (/   VADEC    VALLPRC  GLG      SSLEN    TPNAM
   LGNAM   LGSTOTAL LGTOTAL  TERM     TXSTOTAL TXTOTAL
   TESTE
  )

  (setq VADEC (getvar "cmdecho"))
  (setvar "cmdecho" 0)
  (command "undo" "begin")
  (setq VALLPRC  (getvar "luprec")
 LGSTOTAL 0.0
 TERM  0
  )
  (mlen)
  (while (/= TERM nil)
    (progn
      (mlen)
    )
  )
  (setq TXTOTAL (rtos LGSTOTAL 2 VALLPRC))
  (princ "\n»» Total = ")
  (princ TXTOTAL)
  (command "undo" "end")
  (setvar "cmdecho" VADEC)
)

;;;
;;;

(defun MLEN ()

  (princ "\n»» Select entities to calculate the length: \n")
  (terpri)
  (setq GLG (ssget))
  (if GLG
    (progn
      (setq SSLEN (sslength GLG))
      (while (> SSLEN 0)
 (setq TPNAM  (ssname GLG (setq SSLEN (1- SSLEN)))
       ENTGT  (entget TPNAM)
       ENTLAY (cdr (assoc 0 ENTGT))
 )
 (if (equal ENTLAY "LINE")
   (setq TESTE 1)
 )
 (if (equal ENTLAY "POLYLINE")
   (setq TESTE 1)
 )
 (if (equal ENTLAY "LWPOLYLINE")
   (setq TESTE 1)
 )
 (if (equal ENTLAY "CIRCLE")
   (setq TESTE 1)
 )
 (if (equal ENTLAY "ARC")
   (setq TESTE 1)
 )
 (if (equal ENTLAY "SPLINE")
   (setq TESTE 1)
 )
 (if (equal ENTLAY "ELLIPSE")
   (setq TESTE 1)
 )
 (if (equal TESTE 1)
   (progn
     (command "lengthen" TPNAM "")
     (setq LGTPNAM  (getvar "PERIMETER")
    LGSTOTAL (+ LGTPNAM LGSTOTAL)
    TESTE    0
     )
   )
 )
      )
    )
    (princ "\n»» No entity was selected: \n")
  )
  (setq TXSTOTAL (rtos LGSTOTAL 2 VALLPRC))
  (initget "Add")
  (princ "\n»» Subtotal = ")
  (princ TXSTOTAL)
  (terpri)
  (setq TERM
  (getkword " [A] Add more entities or <Enter> to finish:  ")
  )
)
(princ "\n»» Type 'SUMPER' to start application ")

     ; END Sumper.lsp

Back to Top
Vladimir Michl View Drop Down
Moderator Group
Moderator Group

Arkance Systems CZ

Joined: 26.Jul.2007
Location: Czech Republic
Using: Autodesk software
Status: Offline
Points: 2015
Direct Link To This Post Posted: 28.May.2016 at 11:48
Vladimir Michl (moderator)
Arkance Systems - arkance-systems.cz - Autodesk reseller
Back to Top

Related CAD tips:


 Post Reply Post Reply Page  <12
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0,406 seconds.