Tlen.lsp Download Free

0 views
Skip to first unread message

Shameka Roessler

unread,
Aug 4, 2024, 10:43:23 PM8/4/24
to raswarmvepgoe
Ihave attemted locating the tlen.lsp on the site but am having a hard time finding it. Any suggestions? It appears much more convenient than dataextraction in finding total linear units in a multi object drawing.

Depending on how you use it, something like this might also do it for you, or perhaps this other one or maybe here [just because I was aware there were some such routines on that site]. Searching these Forums will probably reveal a number of routines along similar lines.


It answers in whatever your current Units settings are. If they are different from the format you want it to use, you can force it to use whatever format you prefer, by adding mode and precision arguments to this part right near the end:


I am currently designing formwork for a concrete company, where i have lengths of varying length and witdh a ply wood all over the drawing that i have to add up a cutting list for the factory to cut the ply.


Funny, but I clicked on the link and just downloaded the lisp file to my Desktop. Then once in AutoCAD I used Appload to load the routine. At the command line I then typed tlen. I was asked to select the objects (in my test it was three short lines) and when I was done I pressed the Enter key. An AutoCAD Message appearred that read Total length of selected objects is 9.9675.


In some windows versions, I have seen notepad automatically add a "TXT" file extension to any file saved. I wonder if your file is really named "tlen.lsp.txt", and if that would even load in AutoCAD...?


I had the same issue. This is what I do to get lisp routines that are just text on the screen instead of a download file. I copy it from the screen,then find an old lisp routine in my computer folder that I know works and save it as the new one. Then erase all the text and paste into that file. It usually works. I have had trouble creating new lisp routines because something happens to the format. But that method almost always works for those of us who don't write lisp routines.


It seems with 2010 onwards the area command doesn't work on plines. So that means the famous tlen.lsp doesn't work anymore. I have tried to play around with it myself, but just can't get it to work. (Don't have any experience with lisp). I've tried using the lengthen command instead, but I can't get it to work either.


Be aware that the above returns zero for circles and for closed Polylines or Ellipses [but for some reason not closed Splines]. Using the shorter version of stevor's suggestion with parameters rather than points:


to the beginning of the routine. For me, some (vlax-...) functions [including, I believe, all the (vlax-curve-...) ones] work without doing that, and some don't, and I don't know what the difference is -- I think the ArchDeskTop overlay we have somehow takes care of some of them, but why not all, I couldn't say. Anyway, apparently your setup doesn't include anything that takes care of any of them, so you need to load them.


The *LINE part will find Lines, all kinds of Polylines, and Splines. But you wouldn't want to do it that way and let it also find Xlines, if you ever use them, because there will be a problem trying to determine their length.]


If you filter the selection set for the allowable entity types at the time of selection, then you know everything in the set will have a length that you want to add to the total. That means you don't need to use a variable for the entity type or check that against a list, nor do you need to use a variable for the length, if present, to add to the total [you can just go ahead and add it directly], nor do you need the fallback position of adding 0 if it's not one of the right entity types. So several variables and Lisp functions are eliminated.


The (repeat) and (ssdel) combination, in place of the (while) and increment-variable approach, is less of an "improvement" per se, but my personal preference. Someone else has made the argument that (repeat (sslength ss).... is really a better "description" of what you want to do in a case like this. But it also eliminates both the incrementing variable and the resetting of it, and the need for the routine to do any evaluation when it jumps back to the beginning of a (while) loop. I couldn't say whether there's any time savings, comparing the work of (ssdel) against the combined work of the (while (>= n 0) evaluation and the (setq n (1- n)) incrementing. But any such difference would never be noticeable unless you had a very large selection set.


SomeBuddy often uses an approach [worth taking a look at -- you can search the Discussion Group history], involving (ssnamex), that essentially converts the selection into a list of entity names, so it can use (foreach) on that list, instead of using either (while) or (repeat) on the selection set. It can save a little code, but I've wondered whether the overhead of doing that conversion, and the needed screening of the resulting list for only certain kinds of information, outweigh any savings -- I wouldn't know how to test that. But in any case, I find the (repeat) approach easier to grasp, looking at the code.


And of course, if you are going to need to use that selection set again for anything after you've added up the lengths, you wouldn't want to do it my way, because mine empties the selection set in the process of moving through it.


Welcome to these Forums! This seems un-related to the Subject of this thread, which means that if someone answers it here, others looking for the same thing may not be able to find it. I suggest you [first Search for something that already does what you want, and if you don't find anything,] start a new thread.


And when you do, describe more about what you want to do. If you are drawing Xlines only for the purpose of [for example] TRIMming the object they're drawn across, a routine could be made to take 22% off both ends of any object, or leave 22% of it at each end and take out the middle, or some such thing. If you actually need the Xlines themselves for some reason, it could be made to draw them, but if they are only an intermediate step on the way to what you really want to accomplish, it may not be necessary to actually draw them. Also, a routine could be made to do whatever you're after with the 22% hard-coded into it, if you always need that specific ratio, or if the ratio isn't always the same, it could be made to ask the User what percentage inward they want to go. Etc., etc.


That would return it in whatever your current numerical mode and precision settings are. If you want it to always give you a whole number, even though the true distance usually will not be one, you can have it round it off with the mode and precision [number of decimal places, or fraction denominator] options in the (rtos) function:

3a8082e126
Reply all
Reply to author
Forward
0 new messages