Sensath Posted October 6, 2016 Posted October 6, 2016 (edited) I've incorporated and created many LISP functions for surveying purposes in AutoCAD. I've been wanting to share them, so here goes. A lot of the functions reference other functions. I've used the naming scheme: mfcb* for My Functions CBass (me) mfcbLM for My Functions Lee Mac (because he is awesome) Many of these functions have been the work of others and I have revised them to my needs. Use them as you see fit. Enjoy! AutoCAD Blocks Edit: Minor text fixes. Sorry about that. Edit2: Optimizations. Edit3: Optimizations and error fixing. Edit4: More optimizations and a few new functions. Edit5: Optimized SPL function. Edit6: Fixed c:CLOSEST (iNdx was causing infinite loop). Edit7: Fixed multiple selections with c:MASK command (forgot to nil the XData and it would error). Edit8: Formatted Benchmark.lsp for readability. Edit9: Revised XData functions to preserve other application XData. Created menus for the functions. Edit10: Added dropbox link to AutoCAD blocks. Benchmark.lsp PointCodeList.txt acaddoc.lsp Global Functions.LSP Menu.zip Edited November 18, 2016 by Sensath Quote
BIGAL Posted October 6, 2016 Posted October 6, 2016 Lots of work there, just 1 one suggestion we have our layer set up in a txt file rather than inside the code, much easier to edit. Just read the txt file when required, use a csv file see lee-mac parse csv.lsp. Try rename acaddoc.lsp to autload.lsp makes sure its in the default paths you may be suprised rather than use the default acaddoc.lsp name. Quote
Sensath Posted October 6, 2016 Author Posted October 6, 2016 Try rename acaddoc.lsp to autload.lsp makes sure its in the default paths you may be suprised rather than use the default acaddoc.lsp name. I hadn't heard of the autoload.lsp file. I know about the others but not that one. Do you have a reference somewhere that explains it? I'm having a hard time finding anything about that file, search is failing me. Quote
BIGAL Posted October 6, 2016 Posted October 6, 2016 It just another way of auto loading lisp files but you dont need to call it acaddoc.lsp, so it is like your own company lisp file, another way is just have (load "mycompanylisp") in acaddoc.lsp, someone else a 3rd party may make a different acaddoc.lsp and bring it in hence clashing. Another question you have a lot of little defuns to insert blocks, are you using this because you dont have the ability to read/import survey data, string and auto insert blocks ? Like CIV3d etc. There are ways around this. Have you looked at tool palettes as well or menu's. Quote
Sensath Posted October 6, 2016 Author Posted October 6, 2016 We use Carlson to work with points. I don't like using the symbols on the points, as I have less control over presentation and I would like to be able to use the code with base AutoCAD (not Civil or Carlson or whatever else). The major part being that you can use AutoCAD without purchasing the other software. Currently it's written with Carlson in mind for points, but it's a small change to create my own insertion routines (I have the code, but it's not incorporated). Quote
BIGAL Posted October 7, 2016 Posted October 7, 2016 Thats what I thought why would you not use the "points" and take advantage of the descriptor, I am talking plain autocad here, insert a new block taking advantage of auto reading the descriptor. eg 101,11234.56,2345.78,12.34, tree 1 6 ptnum x,y,z Desc Tree 1 6 desription is a tree 1 trunk 6 spread. My tree block is a dynamic block. Quote
Sensath Posted October 21, 2016 Author Posted October 21, 2016 I've updated the functions to account for more error handling and added some new functions (overriding DIMSCALE when working with annotative styles). I'd like to hear about any requests, modifications or fixes. Quote
Sensath Posted November 1, 2016 Author Posted November 1, 2016 If anyone can look at my c:SPL function and perhaps suggest a faster way, I would appreciate it much! Right now, over a few thousand points seems to take forever. Perhaps changing the foreach to a (mapcar '(lambda (x)) y)? Quote
Sensath Posted November 8, 2016 Author Posted November 8, 2016 For anyone that cares, I figured out why my c:SPL function was slow. It was called mfcbLayAlter in GlobalFunctions.lsp to change each point (good), that called mfcbLayCreate to make sure the layer is in the drawing (good) but in that it was calling the regen function (bad). Because it was doing 1000+ points, it was regenerating the drawing 1000+ times (very, very bad). I removed the regen from mfcbLayCreate and it was much, much faster. Quote
Sensath Posted November 18, 2016 Author Posted November 18, 2016 I've created a menu for others to use. Load with the CUI command and rename the menu however you like. 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.