elli0t Posted May 25, 2023 Posted May 25, 2023 Hi, I'm looking to be able to select multiple tables in a drawing and return the sum of the values. Each table has a value (formula displaying a number) in a cell that is in the last column and first row. I'm completely new to AutoLISP as we've only ever had LT at my work (AutoLISP now supported in LT 2024). This seems like it wouldn't be too hard but I'm really not sure on where to start. Can't really find anything on retrieving the cell value from a table. ChatGPT hasn't been much help either unfortunately. If anyone can help it would be greatly appreciated. Thanks! Quote
elli0t Posted May 26, 2023 Author Posted May 26, 2023 11 hours ago, devitg said: @elli0t please upload your sample dwg Tables.dwg Hi, dwg with various tables attached. I want to get the total sum of the number in green (last column) of all selected tables. Thanks! Quote
devitg Posted May 26, 2023 Posted May 26, 2023 @elli0t Find attached lisp and result dwg the new command is LAST-CELL sum table last cell.LSP sum Tables last cell.dwg 2 Quote
devitg Posted May 26, 2023 Posted May 26, 2023 41 minutes ago, rlx said: nice one devitg! @rlx, Thanks for your like It got me a huge time to notice that rows and columns has base 0, the same as NTH, ssname, and VLA-item, maybe some others, because there is not quoted at any help . Quote
rlx Posted May 26, 2023 Posted May 26, 2023 yeah, (lisp) help function hasn't improved over the years. In the good old days you would get printed books with each AutoCad license , full of examples to play with. That's why sometimes you have to beg , steal & borrow all over the place to get the info you want. And sometimes is just experimenting and make use of the debug functions in vlisp editor. Not sure you need entity or object?... just try it. If you get an error you know you needed the other one and sometimes you find you can use both. Quote
elli0t Posted May 27, 2023 Author Posted May 27, 2023 6 hours ago, devitg said: @elli0t Find attached lisp and result dwg the new command is LAST-CELL sum table last cell.LSP 2.12 kB · 5 downloads sum Tables last cell.dwg 65.63 kB · 2 downloads Thank you so much @devitg, that's great! Would love to know how you went about solving this, or where to get started to learn how to write LISP code. Quote
BIGAL Posted May 27, 2023 Posted May 27, 2023 (edited) Files like this help I did not make it. Look for a word that seems what you want then google it to see if it matches. To learn lisp, start here look at what has been done, its a question often asked, books, ebooks are cheap, Afralisp has tutorials, some tutorials like "down the garden path" is done by Autodesk. Just google "Your task Autocad lisp". I use Bricscad mostly but still look for "AutoCad lisp" As mentioned here I have a R12 lisp paper book comes in handy at times as it has examples. Plus 4 ebooks. list of methods for a table.txt Edited May 27, 2023 by BIGAL Quote
Tharwat Posted May 27, 2023 Posted May 27, 2023 9 hours ago, devitg said: It got me a huge time to notice that rows and columns has base 0, the same as NTH, ssname, and VLA-item, maybe some others, because there is not quoted at any help . They DID explain that clearly but very very few who read to understand but the majority copy and paste and blame the others if their posted codes did not work for them , so here are two snapshots with indications. Quote
devitg Posted May 27, 2023 Posted May 27, 2023 @Tharwat from the last Help I have Autodesk AutoCAD 2018: ActiveX Reference Guide > Methods > G Methods > GetCellValue Method (ActiveX) Gets the cell value for the given row and column. Supported platforms: Windows only Signature VBA: RetVal = object.GetCellValue(row, col) object Type: Table The object this method applies to. row Access: Input-only Type: Long The row number of the cell to set. col Access: Input-only Type: Long The column number of the cell to set. There is no mention about 0 based order Quote
Recommended Posts
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.