Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TLEN.LSP

3,594 views
Skip to first unread message

Antonio Salazar

unread,
Nov 18, 2002, 11:24:34 PM11/18/02
to
Is it possible to extract the total length or area of a number of different
lines, polylines, arcs, etc. on each layer.

Something like a distance-command - just that it measures the total length
or area
of a collection of lines or shapes?
for example to know the total lineal meters of wood base on a house, or the
total floor愀 area. I all ready use the TLEN.LSP, but I want to select a
group of layers and have the total length or area of each layer, and if its
posible to make a copy paste to excel or better, have a link so when I
change the lines of a drawing the excel sheet change automaticly


Jason Wilder

unread,
Nov 19, 2002, 10:44:00 AM11/19/02
to
Simple answer, Yes.

It's a matter of how you put it together and how you want it to function.
Either you can start from scratch or start looking at some of the customer
files and websites that have free routines and somewhere along the line I
imagine you could paste together a routine to suite your needs.

"Antonio Salazar" <anto...@terra.com.mx> wrote in message
news:38D5B50EFFB78B64...@in.WebX.maYIadrTaRb...

Paul Turvill

unread,
Nov 19, 2002, 11:23:22 AM11/19/02
to
It's all in how you filter your selection set.
(ssget "x" '((0 . "POLYLINE,LWPOLYLINE")(8 . "MYLAYER,YOURLAYER")))
for example, will find all Polylines and LWPolylines on layers MYLAYER and
YOURLAYER).

Or, you could prompt the user for the layer name(s) and use the construct
(setq LayName (getstring "\nLayer Name: ")
ss (ssget "x" (list '(0 . "POLYLINE,LWPOLYLINE")(cons 8 LayName)))
)
___

"Antonio Salazar" <anto...@terra.com.mx> wrote in message
news:38D5B50EFFB78B64...@in.WebX.maYIadrTaRb...

Reeb

unread,
Dec 13, 2002, 5:06:40 PM12/13/02
to
More or less a beginner LISP user here:

I'm trying to edit the TLEN.LSP file so that it ignores lengths
greater than a value I determine (in this case, 200). I tried the
following but get a syntax error message when I try to load it:

(defun C:TLEN2 (/ ss tl n ent itm obj l)
(setq ss (ssget)
tl 0
n (1- (sslength ss)))
(while (>= n 0)
(setq ent (entget (setq itm (ssname ss n)))
obj (cdr (assoc 0 ent))
l (cond
((= obj "LINE")
(distance (cdr (assoc 10 ent))(cdr (assoc 11 ent))))
((= obj "ARC")
(* (cdr (assoc 40 ent))
(if (minusp (setq l (- (cdr (assoc 51 ent))
(cdr (assoc 50 ent)))))
(+ pi pi l) l)))
((or (= obj "CIRCLE")(= obj "SPLINE")(= obj "POLYLINE")
(= obj "LWPOLYLINE")(= obj "ELLIPSE"))
(command "_.area" "_o" itm)
(getvar "perimeter"))
(T 0))
(if (< l 200) (tl (+ tl l)) (tl tl))
n (1- n)))
(alert (strcat "Total length of selected objects is " (rtos tl)))
(princ)
)

It seems like I should only have to edit that one line with an if then
statement (if l<200, add l to tl, if not, leave tl alone) but I don't
understand quite enough about the syntax to understand why I keep
getting a syntax error.
After looking in a manual, I've tried several permutations for that
one line such as:
(if (< l 200) (setq tl (+ tl l)) (setq tl tl))

but obviously never got it to work. Can you tell me what I'm doing
wrong?

Thanks,
Brent

0 new messages