Jump to content

Line-Length Calculator


Lee Mac

Recommended Posts

Hi Matatos,

 

I'm glad that you like the routine :)

 

What you request is not impossible, but would certainly take a lot of work. My thoughts are to use a second filter, i.e. allow to user to filter by a layer, then filter by a linetype - but the difficulty would be how to format all that in a table, for multiple selections of both layer and linetype etc.

 

Lee

Link to comment
Share on other sites

  • Replies 77
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    31

  • stevesfr

    9

  • RyanAtNelco

    8

  • Hsanon

    6

Top Posters In This Topic

Posted Images

Thanks Lee for your fast repply.

 

I have tryied the data extraction tables, but it reports many length's displaying line by line... :cry:

 

Basically i would like to know for each layer the total length of each linetype and report it to a table or Excel.

 

I attached a Excel file with an example with the layout that i think is possible.

 

I found here in the forum a lsp routine that report to Excel the total pline's Length by layer and another by linetype... but not both...

 

Thanks again... and sorry for the trouble...

Table Pipe length's.zip

Example 1.zip

Link to comment
Share on other sites

  • 2 years later...

Very nice!

 

Is there any chance of having the output in (U.S.) feet or feet and inches?

I'm not worried about the output being exact, as I'm using it for take off of distances.

 

Again, very cool lisp.

Perk

Link to comment
Share on other sites

  • 1 year later...
  • 2 years later...

Is there any possibility to change LenCal so it wont use Visual Lisp? I've used so many length calculators but this one is the best so far, but unfortunately on MacOs autocad it doesn't work because ACMAC doesn't support visual lisp.

Link to comment
Share on other sites

  • 3 years later...

This thread hasnt been used since a while.....

The Len Cal program is fantastic !!!!! just one question.... is it possible to select a group of lines, and then run the program, instead of it picking up all the lines in that layer ???? is that filter possible ???? im sure many guys are using it .... anyone ???

 

Thanks Lee, for this fantastic utility !!!!! 

Link to comment
Share on other sites

1 hour ago, Hsanon said:

This thread hasnt been used since a while.....

The Len Cal program is fantastic !!!!! just one question.... is it possible to select a group of lines, and then run the program, instead of it picking up all the lines in that layer ???? is that filter possible ???? im sure many guys are using it .... anyone ???

 

Thanks Lee, for this fantastic utility !!!!! 

 

Firstly, thank you for your positive feedback for my application - I'm delighted that you find it so useful.

 

Whilst it would certainly be possible to achieve the functionality that you have described, this particular program is now so old that I would opt to develop a separate program to permit a selection of objects and aggregate the length of the objects by a given property.

Edited by Lee Mac
Link to comment
Share on other sites

I understand this was made 11 years ago !!!! Would you be knowing some thread in any forum, which I can check for this utility.  It's a simple enough requirement actually, and I'm sure many users would have a need for this. But In my search for this utility, I havent yet found this functionality. Of choosing a selection of different coloured lines, and getting the total lengths of each colour on a table. 

 

Edited by Hsanon
Link to comment
Share on other sites

Like Lee a purpose written with choices the obvious Layer, Lines/plines, arcs, Circles, Color basically do a combo ssget, its not that hard.

 

(setq ss (ssget (list (cons 0 "*Line"))))

(setq ss (ssget (list (cons 0 "*Line")(cons 62 1))))

(setq ss (ssget (list (cons 0 "*Line")(cons 8 "mylayers")(cons 62 1))

and so on.

 

Something like this front end. The layers would pop up a list box, the color (acad_colordlg etc. The front end is done look in downloads here for Multi Toggles and other toggle dcl done by RLX.

 

image.png.65ac1994e27e5b5d6ebcaa1fbf7a2e90.png

 

 

Link to comment
Share on other sites

Not that hard ??😀😀

I do dabble in basic Lisp, but no Visual lIsp... furthermore modifying Lee's Program would be akin to amending the constitution for me !!!!😃

The modification I requested was to use the same filters to choose from, but within a selection set made by a window, instead of digging up the entire database, which may come up with some extra items added.....

Link to comment
Share on other sites

As I posted the front end gives the ssget filters I have not included any selection filters that's is up to you, window 1 by 1 "all" etc.

 

You will need say at least 3conds to get the object properties like length as they vary with some objects

Line & Pline = length

Arc = length

Circle = circumference

 

Its not that hard VLA-Insertrow for the table so adds line to an existing table as you make repeated choices. Or make a new table have an example just ask.

 

Its a biggish request in like type layer or pick from dwg an extra bit of code.

 

Like Lee "aggregate the length of the objects by given properties."

 

I will see what code snippets I have.

 

 

Edited by BIGAL
Link to comment
Share on other sites

As an example, just the total number (for example 10 nos lines) of objects, and sum of lengths of objects (as per the filters provided - layer/linetype/color) within a selection window / crossing required. And similar objects outside the window / crossing ignored. I tried to understand Lee's routine, but couldn't figure out how to modify the Visual lisp. I would request Lee / someone with the requisite knowledge to update when convenient.  And, as an add on, if the filter has  closed polylines, could they be numbered (for example 5 closed polylines) and added too??

 

 

Screen Shot 06-20-20 at 07.43 PM.PNG

Edited by Hsanon
updating the request and screengrab
Link to comment
Share on other sites

Hanson you have touched on the issue version 22 no matter what is posted some one else will want a small variation. That's why the rules are very important before any thing is started. The options list is only going to keep growing, so the code would start with say simple line, arc, circle, pline, choices then additions. There is just so many combinations that could be made.

 

Look at dataextraction and how many combinations are available.

 

The one thing that comes to mind is to make a table and how many columns, what happens when the next request needs an extra column ?

 

Write down all the items in a  combinations that may be required. You may be surprised how many.

 

Line

Pline

Arc

Circle

……………..……….

 

Link to comment
Share on other sites

Just ONE variation Bigal...... just a window selection from which the same length data is extracted as there is in the existing program..... instead of the entire database.... the rest of the program is great and will be used by me.  Ignore the other area request if necessary. 

And my expertise is not sufficient to modify the existing lencal program. 

Apologies for being so persistant... I do appreciate this is a free voluntary forum and it is the discretion of the program developer whether to do it or not. 

Edited by Hsanon
Clarifications updated
Link to comment
Share on other sites

It may be possible to simply amend Lee's code, BUT I can see that again it will come back with BUT I need this combination also. The only way is to submit the type of combinations you want as I said previously. And make a front end 1st.

 

This section needs to be rewritten to suit the user request in particular the SSGET filters.

 

    (if (setq s
            (ssget
               '(   (0 . "ARC,CIRCLE,ELLIPSE,LINE,*POLYLINE,SPLINE")
                    (-4 . "<NOT")
                        (-4 . "<AND")
                            (0 . "POLYLINE") (-4 . "&") (70 . 80)
                        (-4 . "AND>")
                    (-4 . "NOT>")
                )
            )

 

Edited by BIGAL
Link to comment
Share on other sites

Had a few minutes, Multi toggles.lsp is in Downloads. For anyone thinking about this. Multi toggle Image in other post.

 

Just did some simple testing not extensive.

 

; Multi total length choice with a user choice dcl for filtering
; By Alan H info@lanh.com.au June 2020


; Thank you to Lee-mac for the original Tlen code 
; changed to just accept a given selection set

(defun AH:tlen (s / e i l s )
             (setq l 0.0)
            (repeat (setq i (sslength s))
                (setq e (ssname s (setq i (1- i)))
                      l (+ l (vlax-curve-getdistatparam e (vlax-curve-getendparam e)))
                )
            )
            (alert (strcat "\nTotal Length: " (rtos l 2 2)))
    (princ)
)

(defun c:multi-sel ( / lst1 ans str lst1 x ss filter)
(if (not AH:Toggs)(load "Multiple toggles.lsp"))
(setq ans (reverse (ah:toggs   '("Please choose" "Arc" "Line" "Plines" "Circle" "Layer" "Color" "Linetype"))))
(setq lst1 '())
(if (= (nth 0 ans) "1")(setq lst1 (cons "Arc" lst1)))
(if (= (nth 1 ans) "1")(setq lst1 (cons "Line" lst1)))
(if (= (nth 2 ans) "1")(setq lst1 (cons "*Polyline" lst1)))
(if (= (nth 3 ans) "1")(setq lst1 (cons "Circle" lst1)))

(setq str "")
(repeat (- (setq x (length lst1)) 1)
(setq str (strcat str (nth (setq x (- x 1)) lst1) ","))
)

(setq filter '())
(setq filter (list (cons 0 (strcat str (nth 0 lst1)))))

(if (= (nth 4 ans) "1")(Alert "this is not done yet \n \n will pop a list box"))
; probably do an option pick layer objects or list

(if (= (nth 5 ans) "1")(setq filter (cons  (cons 62 (getint "enter Color number")) filter)))
; probably do an option pick layer objects or list

(if (= (nth 6 ans) "1")(Alert "this is not done yet \n \n will pop a list box"))
; probably do an option pick layer objects or list

(setq ss (ssget filter))
(if (/= ss nil)
(aH:tlen ss)
(alert "No objects match")
)

(princ)
)

 

Edited by BIGAL
Link to comment
Share on other sites

  • 8 months later...
On 6/23/2009 at 1:13 AM, Lee Mac said:

As this is a complete upgrade to the program in the recent thread of the same topic, I thought I'd include it in a new thread so that it can be found easier with searches etc.

 

Let me know if you find any bugs etc - or any suggestions you may have.

 

I tried to keep it as general as possible so that the majority of users could get something out of it. But if you want it customised to meet your particular needs, I'd be happy to lend a hand.

 

Type: LenCal to invoke ~ if the Dialog doesn't load first time, just re-invoke the command.

 

All code can be found here.

 

 

hello, awesome stuff!  can i ask to add a calculation to the table! knowing a the line density the insert table could give the us the product of the lenght vs density! 

thank you! 

 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...