CivilTechSource Posted yesterday at 12:03 AM Posted yesterday at 12:03 AM Hi All, just wanted to thank everyone again for helping me so far in my lisp journey! As a token, I worked on a VS Code extension for AutoCAD snippets. This so it can allow users to type in quickly common functions the use all the time (e.g. search layer if dont exist create layer and so on). So far I have added the comment section. Happy to receive feedback and suggestions. Thank you https://marketplace.visualstudio.com/items?itemName=CivilTechSource.autocad-lisp-snippets 1 Quote
BIGAL Posted 20 hours ago Posted 20 hours ago (edited) @CivilTechSource Like you, It is a good idea to have a library of functions that you use all the time, in my Excel lisp there are 41 defuns so just copy and paste the ones I want to use, same with my Multi lisps for dcl's. often set them to write a dcl and then convert that file to dcl lisp code, like 3 lines of code to make a dcl. I have a VLAX lsp open all the time in my Notepad++ so again copy paste a function. I have a lot of lisp's saved as a function name eg Sort.lsp has various sort methods in it. I use windows "Findstr" a lot in a bat file so can look through an entire lisp directory for a keyword, identifies lisp files with that key word and copy and paste what I want out of existing code. You can in a lisp load an entire other lisp program and continue and use functions in that new lisp, I mention it as you could have little tiny lisp's like your "make layer.lsp" and just load when required. eg (if (not ah:butts)(load "Multi radio Buttons.lsp")) so you could have a few load lisp's at start of code saving lots of copying and pasting. Interested what others do. Edited 20 hours ago by BIGAL Quote
CivilTechSource Posted 4 hours ago Author Posted 4 hours ago @BIGAL this is exactly what I want to achieve! I want to make it more accessible to people to learn how to write lisps. My plan is to start with basic functions, like getpoint and getdistance, if statements, prompts and so on. If you have suggestions on what more I can add please feel free. Quote
Steven P Posted 3 hours ago Posted 3 hours ago I have some snippets saved away in different files - open, copy and paste as I need them. Others I have some files with many functions, such as text where I'll save the common functions and refer to them. For example a simple text selection (entsel, check it is text, message if not and reselect, return the text) or an entmod to update a text string... all in the same file but referenced by many functions in it. However I keep meaning to save away little functions to answer questions on the forum that get asked time and time again such as PDF plotting and batch LISPs Quote
BIGAL Posted 1 hour ago Posted 1 hour ago Another very useful is "Entmake functions.lsp", it has various entmake functions in it. Maybe make a word doc etc of your functions describing what they do. We had a "how to directory" with lots of help files. Was thinking about doing macros in Notepad++ run ents, run ss, ssl for layer, ssi for insert and so on. This is a common one. (repeat (setq x (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1))))) ) Posted this before. Lisp files Apr 2024.docx 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.