Nikon Posted 12 hours ago Posted 12 hours ago Good day to everyone. Is it possible to display a list of AutoLISP commands before closing and saving the dwg file? For example, in notepad or text in dwg. Quote
GLAVCVS Posted 11 hours ago Posted 11 hours ago I assume you're referring to commands defined in Lisp code. One way to do this is to call ATOMS-FAMILY, save its contents in a variable, call ATOMS-FAMILY again when the drawing is about to be closed, compare the difference, and filter out symbols that don't begin with "c:" But why do you need to do this? 1 Quote
Lee Mac Posted 10 hours ago Posted 10 hours ago Perhaps this old program? https://lee-mac.com/lisplog.html 1 Quote
Nikon Posted 8 hours ago Author Posted 8 hours ago 1 hour ago, Lee Mac said: Perhaps this old program? https://lee-mac.com/lisplog.html LISPLogV1-0.lsp is a very convenient program. Thanks @Lee Mac. Is it possible to get a list of lisp commands in the drawing? That is, when saving a drawing, a request appears: "Save a list of lisp commands?" and the text with the commands is inserted into the drawing? Quote
Nikon Posted 7 hours ago Author Posted 7 hours ago 3 hours ago, GLAVCVS said: But why do you need to do this? I often have to go back to old drawings. I have over 300 lisp programs. I would like the drawing to have a list of programs used to continue working, but over time it is not always possible to remember the name of the desired program. Quote
GLAVCVS Posted 4 hours ago Posted 4 hours ago This could be one way to do it: (defun fota (/ arch cad cmd) (defun pregunta (a b) (if (= (car b) "CLOSE") (if (= (vlax-invoke-method (vlax-create-object "wscript.shell") 'popup "Print commands on screen?" 0 "Nikon's doubts" 4) 6) (c:cmdsCargados)))) (foreach sim (atoms-family 0) (if (wcmatch (setq cmd (strcase (vl-princ-to-string sim) T)) "c:*") (setq *afI* (cons sim *afI*)) ) ) (setq *r* (vlr-command-reactor nil '((:vlr-commandwillStart . pregunta)))) ) (defun c:cmdsCargados (/ cad cadCmds arch linea) (foreach sim (atoms-family 0) (if (not (member sim *afI*)) (if (wcmatch (setq cad (strcase (vl-princ-to-string sim) T)) "c:*") (setq cadCmds (strcat (if cadCmds (strcat cadCmds "\n") "\\C1Commands loaded during last sesion:\\C256\n") (substr cad 3))) ) ) ) (if cadCmds (vla-AddMText (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))) (vlax-3d-point (getpoint "\nInsertion point...")) 100 cadCmds)) (princ) ) (fota) 1 Quote
GLAVCVS Posted 3 hours ago Posted 3 hours ago 4 minutes ago, GLAVCVS said: This could be one way to do it: (defun fota (/ arch cad cmd) (defun pregunta (a b) (if (= (car b) "CLOSE") (if (= (vlax-invoke-method (vlax-create-object "wscript.shell") 'popup "Print commands on screen?" 0 "Nikon's doubts" 4) 6) (c:cmdsCargados)))) (foreach sim (atoms-family 0) (if (wcmatch (setq cmd (strcase (vl-princ-to-string sim) T)) "c:*") (setq *afI* (cons sim *afI*)) ) ) (setq *r* (vlr-command-reactor nil '((:vlr-commandwillStart . pregunta)))) ) (defun c:cmdsCargados (/ cad cadCmds arch linea) (foreach sim (atoms-family 0) (if (not (member sim *afI*)) (if (wcmatch (setq cad (strcase (vl-princ-to-string sim) T)) "c:*") (setq cadCmds (strcat (if cadCmds (strcat cadCmds "\n") "\\C1Commands loaded during last sesion:\\C256\n") (substr cad 3))) ) ) ) (if cadCmds (vla-AddMText (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))) (vlax-3d-point (getpoint "\nInsertion point...")) 100 cadCmds)) (princ) ) (fota) How to make it work? Locate your acad**doc.lsp file and copy the code at the end of the original code, but before any code you may have added yourself. Try it. 1 Quote
GLAVCVS Posted 3 hours ago Posted 3 hours ago Once you've done this, after opening any drawing, the code will be loaded, and when you close the drawing, it should prompt you for a location point for an MTEXT with the loaded commands. The only question I have is whether it's better to save this code in acad####Doc.lsp or acad####.lsp. 1 Quote
Nikon Posted 2 hours ago Author Posted 2 hours ago (edited) 1 hour ago, GLAVCVS said: Once you've done this, after opening any drawing, the code will be loaded, and when you close the drawing, it should prompt you for a location point for an MTEXT with the loaded commands. I open a new file, download, for example, 3 lisps, but when I close it, the text is saved indicating the number of programs, more than 3. In my opinion, programs that are in startup are being displayed... Edited 2 hours ago by Nikon Quote
Nikon Posted 2 hours ago Author Posted 2 hours ago 1 hour ago, GLAVCVS said: The only question I have is whether it's better to save this code in acad####Doc.lsp or acad####.lsp. I saved this code in acad2021Doc.lsp Quote
GLAVCVS Posted 2 hours ago Posted 2 hours ago (edited) @NikonI think there's an easier and more definitive way. Wait. Edited 1 hour ago by GLAVCVS 1 Quote
Steven P Posted 1 hour ago Posted 1 hour ago 300 Lisp programmes... If you have the time, create this: (defun recordLISP (LispName / ) (if (= LispsList nil) ; check if list exits (progn (setq LispsList (list LispName)) ; create new list, add text string to it ) ; end progn (progn (setq LispsList (cons LispName LispsList)) ; add LispName to LispsList ) ; end progn ) ; end IF ) (defun c:MySave ( / ) (defun MakeMText (pt TxtString) (entmakex (list (cons 0 "MTEXT") (cons 100 "AcDbEntity") (cons 100 "AcDbMText") (cons 10 pt) (cons 1 TxtString) )) ; end Entmakex, End List ) ; end MakeMText (defun LM:lst->str ( lst del ) (if (cdr lst) (strcat (car lst) del (LM:lst->str (cdr lst) del)) (car lst) ) ) (MakeMText (GetPoint "Enter Insert Point") (LM:lst->str (reverse LispsList) "\\P")) ) and for every LISP you want to record add this line (recordLISP "-LISPNAME-") A little over the top maybe, but you get to control what LISPs you really want to record. For example, I have a couple of shortcuts, for example "ZA" for Zoom All, "PlotPDF" to plot a PDF - neither of these examples are a part of the process to create a drawing, where others such as "CTX+" - Copy Text, increment by 1 is, I might want to record that. If you LISP library is like mine you could probably cut 50 or so off that 300 LISPs as unnecessary to record think. I am curious what the end result you want to do is, once you have listed the commands you use, you can recreate process to create the drawing, but perhaps without also knowing mouse clicks and keyboard entries not a lot else? 1 Quote
Nikon Posted 1 hour ago Author Posted 1 hour ago (edited) 54 minutes ago, Steven P said: A little over the top maybe, but you get to control what LISPs you really want to record. For example, I have a couple of shortcuts, for example "ZA" for Zoom All, "PlotPDF" to plot a PDF - neither of these examples are a part of the process to create a drawing, where others such as "CTX+" - Copy Text, increment by 1 is, I might want to record that. If you LISP library is like mine you could probably cut 50 or so off that 300 LISPs as unnecessary to record think. I am curious what the end result you want to do is, once you have listed the commands you use, you can recreate process to create the drawing, but perhaps without also knowing mouse clicks and keyboard entries not a lot else? I have about 50 lisp programs in startup. I upload the rest as needed. I have a list of autoload programs of this type (_autoload "MTxt")(c:MTxt). Many teams have pseudonyms in acad.pgp. I just want the list of used programs to remain in the drawing. Lee Mac's LISPLogV1-0.lsp program does what I need, only in a .csv file. Edited 32 minutes ago by Nikon 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.