gdanielo Posted December 30, 2023 Posted December 30, 2023 Hello everyone, I'm new to AutoLISP and I don't know how I can find Autocad commands to draw objects in graphic area. The "command" and "command-s" are quite archaic (compared to other CAD software API) and Autocad help pages are not so helpful. Do I need to use these everytime ? e.g.: (command-s "._-layer" "_m" "Text" "_C" "3" "" "") If so, I imagine arguments are the same from Autocad command ? And what's the best Autocad command to use, the ones with dash or not ? I hope that I'm not creating a duplicate post, Thanks all Quote
Steven P Posted December 30, 2023 Posted December 30, 2023 Welcome to a frustrating world. Simplest way to start programming LISP is as you are doing, (command...... ) and what follows command is exactly as you would type into the command line, unless you are happy for the LISP to have a dialogue box open (automation is great - dialogue boxes are useful, but user interaction is slow). Same as the command line there are prefixes to a command: . (dot) is the native command. It is possible to redefine a command, or call a LISP by the same name as a command (LISP loads last so that is the command that will be used). 'dot' prefix will revert to the native original command _ (underscore) is for the AutoCAD native language version of the command, that is English. Other countries use other languages and the command names are replaced... however the English command can still be used with _ - useful if for example you share LISPs particularly internationally - (dash) is for command line version running if it exists, no dialogues and this means you can take away user interaction. A common first LISP might be a PDF plotting routine where (command "-plot".....) lets you plot without the dialogue box there are a couple of others but these are the main one. As in your question, you can add them together. The arguments after the command name will be the same as you would use in the command line. I'd probably only really use . and - (I don't share many LISPS, no need for _ ) 1 Quote
mhupp Posted December 30, 2023 Posted December 30, 2023 Also here is the Autodesk lisp commands. https://help.autodesk.com/view/ACD/2024/ENU/?guid=GUID-4CEE5072-8817-4920-8A2D-7060F5E16547 So you can look up the difference between command & command-s. While command is the simplest to programming it should be pointed out its very clunky and slow compared to lisp functions. their is usually multiple ways to do things in lisp. This is the entmake way of make a layer. this won't output anything to the command line thus cutting down on spam. (entmake '((0 . "LAYER") (100 . "AcDbSymbolTableRecord") (100 . "AcDbLayerTableRecord") (2 . "Text") (70 . 0) (62 . 3))) 1 Quote
gdanielo Posted December 31, 2023 Author Posted December 31, 2023 Thanks everyone, it should help me enough. If think I will stick with "command" and "command-s" function to create objects. The "entmake" must be a great alternative for complex objects, such layers as you said. Have a nice new year's eve ! Quote
Steven P Posted December 31, 2023 Posted December 31, 2023 You can always ask away for advice if you need it - it is more satisfying to guide someone and they learn than just dumping code in here to be copied blindly - so we're more than happy usually to give advice and guidance. Have a great year next year. 1 Quote
BIGAL Posted December 31, 2023 Posted December 31, 2023 Here is some entmake samples. But starting out it may still be easier to use Command. I am sorry don't know where I got it from. Others may add more common functions. You need to have a basic understanding about the use of dxf codes. entmake functions.lsp 2 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.