Jump to content

Recommended Posts

Posted

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.
 

Posted

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?

 

  • Like 1
Posted
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?

Posted
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.

Posted

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)

 

  • Like 1
Posted
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.

  • Thanks 1
Posted

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.

  • Thanks 1
Posted (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 by Nikon
Posted
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

Posted (edited)
 

 

@NikonI think there's an easier and more definitive way.

Wait.

Edited by GLAVCVS
  • Like 1
Posted

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?

 

  • Thanks 1
Posted (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.

 

LISPLogV1-0.png

Edited by Nikon

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...