All Activity
- Past hour
-
I saved this code in acad2021Doc.lsp
-
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...
- Today
-
Get a list of used AutoLISP commands
GLAVCVS replied to Nikon's topic in AutoLISP, Visual LISP & DCL
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. -
Get a list of used AutoLISP commands
GLAVCVS replied to Nikon's topic in AutoLISP, Visual LISP & DCL
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. -
Get a list of used AutoLISP commands
GLAVCVS replied to Nikon's topic in AutoLISP, Visual LISP & DCL
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) -
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.
-
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?
-
Lee Mac started following switch to turn on or off a variable
-
switch to turn on or off a variable
Lee Mac replied to leonucadomi's topic in AutoLISP, Visual LISP & DCL
Another - (defun c:sf ( ) (setvar 'ucsfollow (- 1 (getvar 'ucsfollow))) (princ) ) -
Steven P started following 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.
-
Lee Mac started following Get a list of used AutoLISP commands
-
Get a list of used AutoLISP commands
Lee Mac replied to Nikon's topic in AutoLISP, Visual LISP & DCL
Perhaps this old program? https://lee-mac.com/lisplog.html -
Get a list of used AutoLISP commands
GLAVCVS replied to Nikon's topic in AutoLISP, Visual LISP & DCL
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? -
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.
-
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) )
-
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?
-
cadnub joined the community
- Yesterday
-
LISP To attach xref's and modify layers
BIGAL replied to adrath's topic in AutoLISP, Visual LISP & DCL
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. -
switch to turn on or off a variable
Tsuky replied to leonucadomi's topic in AutoLISP, Visual LISP & DCL
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) ) -
LISP To attach xref's and modify layers
rlx replied to adrath's topic in AutoLISP, Visual LISP & DCL
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. -
switch to turn on or off a variable
GLAVCVS replied to leonucadomi's topic in AutoLISP, Visual LISP & DCL
'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) ) -
leonucadomi started following switch to turn on or off a variable
-
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.
-
LISP To attach xref's and modify layers
adrath replied to adrath's topic in AutoLISP, Visual LISP & DCL
Thanks for the reply, RLX! I would love to learn how to do this myself, but I've had a hard time finding any instructional resources. Seems you just have to work with somebody that knows and get taught. Autodesk has very little about writing LISP's. If you know of any resources, I'm all ears. I would rather be in charge of the coding than doing this iterative, dystopian machine-building-machine nonsense. But for now, CoPilot writes a code, I read the code and get a sense of what it does, then I change the code and read it again and I'm at least starting to lay the groundwork that way. As far as your code, it didn't throw any errors and it brought in all the xref's but it didn't change the layer colors. I do like the folder dialogue you used better though and not throwing errors is a huge step in the right direction. Thank you. I'll keep messing with it. -
LISP To attach xref's and modify layers
adrath replied to adrath's topic in AutoLISP, Visual LISP & DCL
Sorry. I'll do that next time. -
Try (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) (command "_dimordinate" w M) (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)))) ) ) ) ) ;while (setvar "osmode" 511) )
-
I only want to select the dimension that goes through the specific x-axis point and y-axis is veriable. example point (13,17) (15, 18) co-ordinate greater than 10, select dimension which goes through co-ordinate 13, 15.
-
tillawy joined the community
-
Your question seems a little confusing to me. What do you want to achieve?
-
(defun C:or (/ dst) (prompt "\set UCS at 0,0") (while (setq w (getpoint)) (setq m (getpoint)) (setq x (car w)) (setq y (cadr w)) (setvar "osmode" 0) (if (< X 10) (command "dimordinate" w M ) (progn (setq e (ssget "X" (list '(0 . "DIMENSION") (CONS 42 X)))) (command "dimordinate" w M ) (command "_.CHPROP" e "" "_color" 1 "") ;;;;code;;;; ) ;progn ) ;if ) ;while (setvar "osmode" 511) ) (setq e (ssget "X" (list '(0 . "DIMENSION") (CONS 42 X)))) It does not create any selection set, dimension passing through only x-cordinate