Jump to content

All Activity

This stream auto-updates

  1. Past hour
  2. Final edit to prevent the dialog from asking unnecessary questions. Remember: the LISP commands it will remember will be those that have been executed at some point. (defun fota (/ arch cad cmd mens) (defun pregunta (a b / cad) (cond ((= (car b) "CLOSE") (if (and *lstCmds* (setq mens (cmdsCargados)) (= (vlax-invoke-method (vlax-create-object "wscript.shell") 'popup "Print commands on screen?" 0 "Nikon's doubts" 4) 6) ) (vla-AddMText (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))) (vlax-3d-point (getpoint "\nInsertion point...")) 100 mens) ) ) ((= (type a) 'VLR-Lisp-Reactor) (if (not (member (setq cad (substr (car b) 4 (- (strlen (car b)) 4))) *lstCmds*)) (setq *lstCmds* (cons (substr (car b) 4 (- (strlen (car b)) 4)) *lstCmds*)) ) ) ) ) (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)))) (setq *r1* (vlr-lisp-reactor nil '((:vlr-lispwillstart . pregunta)))) ) (defun cmdsCargados (/ cad) (setq *cadCmds* nil) (foreach sim (atoms-family 0) (if (not (member sim *afI*)) (if (and (wcmatch (setq cad (strcase (vl-princ-to-string sim) T)) "c:*") (member (strcase (substr cad 3)) *lstCmds*) ) (setq *cadCmds* (strcat (if *cadCmds* (strcat *cadCmds* "\n") "\\C1Commands loaded during last sesion:\\C256\n") (substr cad 3))) ) ) ) *cadCmds* ) (fota)
  3. Thanks for the suggestion, @Steven P I'll look into it.
  4. I think it's a good idea that I'm also going to try: leaving a text box with the names of the Lisp commands used to edit a drawing. This new code will filter all of AutoCAD's predefined Lisp commands and, of those loaded by the user, will only consider those that have been used in the drawing. To avoid confusion, replace everything above with this new one. (defun fota (/ arch cad cmd) (defun pregunta (a b / cad) (cond ((= (car b) "CLOSE") (if (and *lstCmds* (= (vlax-invoke-method (vlax-create-object "wscript.shell") 'popup "Print commands on screen?" 0 "Nikon's doubts" 4) 6)) (c:cmdsCargados)) ) ((= (type a) 'VLR-Lisp-Reactor) (if (not (member (setq cad (substr (car b) 4 (- (strlen (car b)) 4))) *lstCmds*)) (setq *lstCmds* (cons (substr (car b) 4 (- (strlen (car b)) 4)) *lstCmds*)) ) ) ) ) (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)))) (setq *r1* (vlr-lisp-reactor nil '((:vlr-lispwillstart . pregunta)))) ) (defun c:cmdsCargados (/ cad arch linea) (setq *cadCmds* nil) (foreach sim (atoms-family 0) (if (not (member sim *afI*)) (if (and (wcmatch (setq cad (strcase (vl-princ-to-string sim) T)) "c:*") (member (strcase (substr cad 3)) *lstCmds*) ) (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)
  5. Today
  6. 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.
  7. 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?
  8. @NikonI think there's an easier and more definitive way. Wait.
  9. I saved this code in acad2021Doc.lsp
  10. 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...
  11. 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.
  12. 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.
  13. 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)
  14. 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.
  15. 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?
  16. Lee Mac

    switch to turn on or off a variable

    Another - (defun c:sf ( ) (setvar 'ucsfollow (- 1 (getvar 'ucsfollow))) (princ) )
  17. Steven P

    Selection set filter

    Your looking at DXF code 42 - which is "Actual Measurement" If X is say 1.2345 your selection set will look for dimensions measuring 1.2345 units, not passing through X coordinate 1.2345. Modified from Glavcvs code above: (ssget "_X" (list (cons 0 "DIMENSION") ; Filter for dimension '(-4 . "=,=,*") ; List filter modifiers (list 10 X Y ) ; Dimensions: '= 10' '= X' 'Anything Y' ) ; end list ) ; end ssget List filter modifiers could also be < or > '(-4 . "=,>,*") ; List filter modifiers (list 10 10 Y ) ; Dimensions: '= 10' 'X coord > 10' 'Anything Y' Weekend, beers last night, CAD is definitely off today so no testing done to check if I am typing rubbish or not.
  18. Perhaps this old program? https://lee-mac.com/lisplog.html
  19. 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?
  20. 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.
  21. GLAVCVS

    Selection set filter

    According to your original code, the dimension drawn when the command is executed isn't changed. Only the existing dimensions are. Therefore, the call to DIMORDINATE should be made at the end of the loop, like this: (defun C:or (/ dst w m x y cj e n) (prompt "\nSet UCS at 0,0") (while (setq w (getpoint "\nFirst point")) (setq m (getpoint w) x (car w) y (cadr w) n nil ) (setvar "osmode" 0) (if (> X 10) (if (setq cj (ssget "_F" (list w m) (list (cons 0 "DIMENSION")))) ;if (while (and cj (setq e (ssname cj (setq n (if n (1+ n) 0))))) (entmod (append (entget e) (list (cons 62 1)))) ) ) ) (command "_dimordinate" w M) ) ;while (setvar "osmode" 511) )
  22. I am using (command "_.BREAK" pause "_F" "0,0.3" "0,-0.3") On the pause I am selecting a vertical line that spans well past the first and second point. When I got run this command and I select the line, I get this error BREAK Select object: Specify second break point or [First point]: F Specify first break point: 0,.3 Specify second break point: 0,-.3 Command: nil It doesn't break how I expect it to. If I run this command manually as in I manually type in the first and second points, it works but as soon as I try to run that single command line, it doesn't break properly. This is eventually part of a bigger lisp routine but I am getting hung up on this. Any thoughts?
  23. Yesterday
  24. You are right about learning lisp the CAD suppliers give you example of how to use a lisp function but really no actual step by step tutorials. Look for Graden path tutorial if using Acad. A good tutorial. Ther are some good books out there I found some on kindle very cheap and can copy code from the electronic book. Also a good reference is 'The visual Lisp Developers Bible" Agree Afralisp has come good tutorials. A comment "6. Analyze the layers" we used to process output from other software brought into cad so had a text file with all the layer details, Oldname Newname etc. Eg for road surveys had a existing layer LIP it was renamed EX-LIP and color changed, when designing a layer called LIP was known then as a design layer.
  25. Tsuky

    switch to turn on or off a variable

    Or this, for toggle (defun c:SF ( / ) (if (zerop (boole 1 (getvar "UCSFOLLOW") 1)) (progn (setvar "UCSFOLLOW" (1+ (getvar "UCSFOLLOW"))) (princ "\nUCS Follow Activado") ) (progn (setvar "UCSFOLLOW" (1- (getvar "UCSFOLLOW"))) (princ "\nUCS Follow Desactivado") ) ) (prin1) )
  26. Haven't really looked at the rest of your code , simply changed the getfolder & split text part and pasted the rest. As far for learning , there are lots of posts here on this site asking the same thing so no use summing them up all again but Lee Mac's site and Afralisp are good places to start. Just kiss... (keep it simple stupid) , start easy and if you like it enough you'll find the motivation to take it next level. Lisp has some quirks & limitations but for many (repeating) tasks you can get great results with relatively little effort once you get the hang of it. But some lisp concepts will need a little time to sink in (if ever). 3d and matrixes for example are not really my thing but that's because I use them so little , when I need them I beg , steal , borrow , cut , copy & paste something together until it works and forget all about it until I need it again.
  27. GLAVCVS

    switch to turn on or off a variable

    'repeat 100...'? Changing the same variable 100 times...why? I guess that's a mistake. Something simple: every time the command sf is called, UCSFOLLOW changes state, without asking (defun c:sf (/ act) (setvar "UCSFOLLOW" (if (setq act (= (getvar "UCSFOLLOW") 0)) 1 0)) (princ (strcat "\n*** Variable UCSFOLLOW " (if act "activada" "desactivada"))) (princ) )
  28. hello : I use this code to quickly change a variable on or off. I would like to know if someone can improve it in appearance or functionality.
  1. Load more activity
×
×
  • Create New...