I am looking for code that will delete all the properties within a DWG file. Can anyone help?
Searching the forum, I found the following code:
; Remove any existing Properties
(dictremove (namedobjdict) "DWGPROPS")
However, further research (forum, testing and help system) indicates that it no longer applies to current releases of AutoCAD so my initial happiness was short-lived!
Thankyou kindly,
Braydon
Hammer, just saw your old post. To use this code, you have to "wrap" it in a defun. Whatever that is, but it really is FUN! JK. It means something like define function, which means it makes the code snippet pasted above act like a little mini-program. If you put a C:thisismycommandname in front of it, then you can type the command name after the C: part and it will run that mini-program in your cad. The braniacs that post all these gems, have a secret code of ethics which involves leaving just enough of the code out to make it NOT run by just copying and pasting. The intent is to force you to learn how to start writing your own lisp code. So get started!
So to summarize and get started writing your own code, follow these steps.
1. Find the code that was so generously donated.
2. Copy that code. Be sure that you get only lines that will run in a lisp. A good starting point is usually the double semi-colon. This is a "comment" line and will not run, but it usually tells you where the code starts and tells you about the function code.
3. In the example that _gile shared, copy all the text between the {code} markers. Leave the {code} out of your selection set.
4. Go to your desktop.
5. Make a new text or .txt file.
6. Open that new .txt file.
7. Paste your copied code.
8. Now it's time to "wrap" that code snippet in a function.
9. Make a blank line at the top of the text file.
10. On the top, blank line, type just the following (defun C:DelCustomProps ( / )
11. Make a blank line at the bottom of your text file.
12. Type just the following )
13. That last parenthesis "closes" the mini-program or function.
14. Go into your cad and on the command line, type the following appload
15. A window will open. Browse to your desktop and choose the .txt file that you created on your desktop.
16. Click on the "load" button. The mini-program is loaded into cad memory.
17. To run your mini-program, type just the command name that comes after the C: in your .txt file.
18. In this example, you would just type the following DelCustomProps
19. Your program will now begin running.
20. If the mini-program was written to ask for input, just pay attention to your command line and do what you are prompted to.
21. Congratulations. You "wrote" your very first lisp routine. It's a small step, but it's how everyone in these forums got started.
22. Keep at it. Keep on learning. You will begin recognizing patterns and wondering how you would write something like that.
23. Try mashing some different lisps together. Make them do new things. Share what you create. Keep the sharecycle going.