Lisp help

Lisp help

Anonymous
Not applicable
2,096 Views
16 Replies
Message 1 of 17

Lisp help

Anonymous
Not applicable

I accidentally posted this in the installation and licensing forum (I have no idea why I was there rather than here)

 

Hi,

 

I've got next to zero experience using LISPs, but I managed to find one that would add up the total length of selected objects. The output is an alert displaying the total length. I've been asked to try and find a way to change this so it is displayed as text, or in a table.

 

I'm currently drawing duct plans, and I'm using the lisp to find the total length of ducting required. What would be great is if I could use the lisp multiple times, and each value is added to a table, adding a new row for each type of ducting. Is this possible to achieve? If the output was text, then I could place that into a table manually.

 

I'm currently using this lisp http://www.turvill.com/t2/free_stuff/tlen.lsp

 

Finally, where's the best place for a total novice to learn how to write a lisp. I've been looking around using google, but you might know of some hidden gems. I've been recommended Afralisp, which I've already started looking at.

 

Thanks

0 Likes
Accepted solutions (2)
2,097 Views
16 Replies
Replies (16)
Message 2 of 17

Slawomir_
Advisor
Advisor

Hi,

 

it seems that solution for your task is already in plain AutoCAD. Try DATAEXTRACTION wizard. I have used it often for several different kind of tasks and it did a great job. For Your purpose it should work great.

 

By the way good AutoLISP site is here.

Message 3 of 17

cadwomen
Collaborator
Collaborator

Hy

 

so take a look there , hope i am right

 

http://www.lee-mac.com/lengthfieldtoattribute.html

 

cu cw

If my post answers your question, please mark it as an Accepted Solution, so that others can find answers quickly!
0 Likes
Message 4 of 17

cadwomen
Collaborator
Collaborator

or more like this ?

 

 

http://www.lee-mac.com/chainlength.html

 

 

cu cw

If my post answers your question, please mark it as an Accepted Solution, so that others can find answers quickly!
0 Likes
Message 5 of 17

hencoop
Advisor
Advisor

More good lisp learning sites: TheSwamp; CADTutor

AutoCAD User since 1989. Civil Engineering Professional since 1983
Product Version: 13.6.1963.0 Civil 3D 2024.4.1 Update Built on: U.202.0.0 AutoCAD 2024.1.6
                        27.0.37.14 Autodesk AutoCAD Map 3D 2024.0.1
                        8.6.52.0 AutoCAD Architecture 2024
0 Likes
Message 6 of 17

Anonymous
Not applicable
I've had a look at the DATAEXTRACTON wizard, and it does help, but it shows too much information. Is it possible to tell it to show just a select few layers? I've got a lot going on in some of my drawings, and I get hundreds of lines of information, when I really only need between 4-8.

Thanks everyone for your suggestions for LISP sites 🙂
0 Likes
Message 7 of 17

ВeekeeCZ
Consultant
Consultant
Isolate desired layers and use DE on the selection.
0 Likes
Message 8 of 17

Slawomir_
Advisor
Advisor
Hi, have you solved your problem?
0 Likes
Message 9 of 17

Anonymous
Not applicable
Not really. I'm getting closer though.
0 Likes
Message 10 of 17

Anonymous
Not applicable
This only partially worked. I have 241 polylines on 12 layers. What I need is to be able to show the total length of the polylines on each layer, so I should end up with a table of 12 lines.

I have isolated the 12 layers, then used DATAEXTRACTION, but it still gives me results for other layers. The more I'm looking into this, the more I'm thinking if what I'm trying to achieve is actually possible.
0 Likes
Message 11 of 17

ВeekeeCZ
Consultant
Consultant
Layer Isolation only helps you to select desired objects - you still need to select those objects manually - Page 2 of DE
0 Likes
Message 12 of 17

hmsilva
Mentor
Mentor
Accepted solution

@Anonymous wrote:
This only partially worked. I have 241 polylines on 12 layers. What I need is to be able to show the total length of the polylines on each layer, so I should end up with a table of 12 lines.

I have isolated the 12 layers, then used DATAEXTRACTION, but it still gives me results for other layers. The more I'm looking into this, the more I'm thinking if what I'm trying to achieve is actually possible.

Hi jcolesRA725,

 

try this @alanjt_ 's code...

 

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/line-length-report/m-p/3942961#M311908

 

Hope this helps,
Henrique

 

EESignature

Message 13 of 17

Anonymous
Not applicable

Thanks. This actually helps a lot, and is almost exactly what I want. I'll mark it down as a solution as I can work with it.

 

Is there a way of having the results displayed in a table? If not, then as MText rather than in the command bar?

0 Likes
Message 14 of 17

hmsilva
Mentor
Mentor
Accepted solution

@Anonymous wrote:

Thanks. This actually helps a lot, and is almost exactly what I want. I'll mark it down as a solution as I can work with it.

 

Is there a way of having the results displayed in a table? If not, then as MText rather than in the command bar?


You're welcome, jcolesRA725
I have a deadline to meet, so at the moment, and I don't have much free time, but this @phanaem 's code should help

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/length-and-area-of-selected-objects/m-p/6576916#M344986


Hope this helps,
Henrique

EESignature

0 Likes
Message 15 of 17

Anonymous
Not applicable

@hmsilva wrote:

@Anonymous wrote:

Thanks. This actually helps a lot, and is almost exactly what I want. I'll mark it down as a solution as I can work with it.

 

Is there a way of having the results displayed in a table? If not, then as MText rather than in the command bar?


You're welcome, jcolesRA725
I have a deadline to meet, so at the moment, and I don't have much free time, but this @phanaem 's code should help

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/length-and-area-of-selected-objects/m-p/6576916#M344986


Hope this helps,
Henrique


Thank you very much. That is near enough exactly what I want. I'll be able to edit the lisp so it only gives me length.

 

You've saved me a long time learning how to do this from scratch.

 

Thanks again

Message 16 of 17

Slawomir_
Advisor
Advisor

I know that you have already found answer to your question, but perhaps this Meteor spec LT autocad app will shed new light on.

0 Likes
Message 17 of 17

reinaldo_togores
Contributor
Contributor

I believe this book I have written may help you in learning AutoLISP and Visual LISP:

http://lispexpert.blogspot.com/2018/07/release-2019-edition.html

Hope you find the information there useful.

0 Likes