Beruflich Dokumente
Kultur Dokumente
I have found that updating help sheets that nobody uses is a pain and a waste of time. Many of these are old
and do not work with newer versions of AutoCAD. I am still writing and updating my lisps, and Im better now
than I was when most of these were done. My newer stuff is much better.
My personal AutoCAD setup looks nothing like this web page. Each problem and each profession requires its
own touch. Therefore, each lisp that is uploaded to the site is generic. I can modify them to your needs! These
are mostly in order of complexity, not usefulness. Be sure to request a lisp before you leave the site. I may
already have it what you need. Ive literally written thousands.
Check here and here for more lisps.
These are listed in order of complexity. The most difficult lisps Ive written are field specific and would not likely
be useful to the general public.
You can download all lisps at once or browse the html.
Generic Script
(DEFUN C:gs () ; A generic script in AutoLISP. for training purposes It does nothing! By
Brian Forbes http://www.autolisp.org/
(PRINC "You can make this say whatever you want!")(COMMAND
"move") (COMMAND) (COMMAND "select" "p" pause)
)
Change Color
(DEFUN C:cxc (/ osm ln) ; Change the color of a layer by selecting an object
By Brian Forbes http://www.autolisp.org/
(SETQ osm (getvar "osmode")) (SETVAR "osmode"
0)
(SETQ ln (cdr (assoc 8 (entget (car (nentselp (getpoint
"Select object: ")))))))
(PROMPT "Select Color: ")
(COMMAND "LAYER" "C" pause ln "")
(SETVAR "osmode" osm) (PRINC))
Text
(DEFUN C:cf () ; Copy text [normally with snap modes enabled, this one is simplified]
By Brian Forbes http://www.autolisp.org/
(PRINC (SETQ CT (CDR (ASSOC 1 (setq ed (entget (car
(nentselp (getpoint "Select text to copy: ")))))))))
(while T (c:yt))
(PRINC))
(DEFUN C:YT () ; Paste text By Brian Forbes http://www.autolisp.org/
(setq ed (entget (car (nentselp (getpoint "\nSelect
text to replace: ")))))
(entmod (subst (cons 1 CT) (assoc 1 ed) ed ) )
(ENTUPD (CDR (CAR ED)))
)
; (setq ui (getstring)) ; Use this to prompt for string and comment out the following line
(entmod
(subst
))
(assoc 1 ed)
ed
(PRINC))
(PRINC dwn)(PRINC)
)
Resize a line
(defun c:res () ; Resize a line by Brian Forbes http://www.autolisp.org/
(command "undo" "be")(setq osm (getvar
"osmode"))(setvar "osmode" 0)
(setq op (getpoint "Select object to resize: "))
(while (not (setq obj (ssname (ssget op) 0)))
(setq op (getpoint "Select
object to resize: "))
)
(setq P1 (cdr (assoc 10 (entget obj))))
(setq P2 (cdr (assoc 11 (entget obj))))
(setq newdist (getstring "New size in inches: "))
(if (< (distance p1 op) (distance p2 op))
(progn
(command
"line" p1 "" "line" (strcat "@" newdist
"<" (angtos (angle p1 p2) 0 4)) "")
(entmod
(subst (cons 11 (getvar "lastpoint")) (assoc 11 (entget obj)) (entget
obj))))
(progn
(command
"line" p2 "" "line" (strcat "@" newdist
"<" (angtos (angle p2 p1))) "")
(entmod
(subst (cons 10 (getvar "lastpoint")) (assoc 10 (entget obj)) (entget
obj))))
)
(command "undo" "e") (setvar "osmode"
osm)
(princ))
(= "DIMENSION" (CDR
(ASSOC 0 (ENTGET (SSNAME (SSGET "L") 0)))))
(= "MTEXT" (CDR (ASSOC
0 (ENTGET (SSNAME (SSGET "L") 0)))))
(= "ATTDEF" (CDR (ASSOC
0 (ENTGET (SSNAME (SSGET "L") 0)))))
)
(COMMAND "DDEDIT" "L" "")
(COMMAND "DDATTE" "L"))
(princ))
The Following is for use with mj [ssget] print out and attach to monitor!
-4 Conditional operator
-3 Extended data sentinel
-2 Name
0 Type
1 Text
2 Name, block name, attrib tag
3-4 Misc.
6 Ltype
7 Text Style or attrib def.
8 Layer
10 Primary pt.
11-18 Other pts.
39 Thickness
40-48 Block scale, text height, etc.
50-58 Angles
62 Color
66 "Entities follow"
67 Drawing space (0 ps, 1 ms)
70-78 Integers for counters
210 3d
999 Comments
(subst
(cons
asno 0.0)
(assoc
asno curent)
curent
)
))))
nil
)
nil
)
)
T
);
if polyline
)
(if (/= 0 (cadddr (assoc asno curent)))
(entupd (cdr (assoc -1 (setq
curent (entmod
(subst
(cons
asno (list (cadr (assoc asno curent)) (caddr (assoc asno curent)) 0))
(assoc
asno curent)
curent
)
))))) ; entupd
) ; if
) ; while and
(setq count (1- count) asno 9)
) ; while count
(princ)
)
) ; while
) ; if
) ; if
) ; while count
(setq input (open (findfile (strcat dir (nth count files))) r))
(while continue
(progn
(while (and (= (strlen eol) 7) (/= (setq eol (strcase (substr curline n 7))) (DEFUN ))
(setq n (+ 1 n) )
(setq n (+ n 7) n2 n)
(while (and (/= (substr curline n2 1) ) (/= (substr curline n2 1) () (/= (substr curline n2 1) ))
(setq n2 (+ n2 1))
) ; progn curline
) ; if curline
) ; while continue
(if curline (setq continue T eofcountdown -1 eol 1234567 n 1 n2 1) (setq eofcountdown (- eofcountdown 1)))
) ; while
(close input)
) ; while count
(close output)
(princ Done!)
(princ)
) ; listlisp v2
Batch Bind
Download Batch Bind script in AutoLISP
Match Block
Download Match Block script in AutoLISP
Toggle Text
; Togtext
; Permissions:
; Permission is hereby granted to copy and modify this lisp. It is provided as is by the author.
; The authorship and url must remain with the copied function.
; Version:
; Explanation:
; This function takes in a list of strings and a selection set. It will extract the text from the
; selection set, search the text strings for matches with those found in the passed list, and replace
; those found strings with the next string in passed list. When the end of the passed list is reached,
; the first string replaces the last. The function searches the entire string of all the strings in
; the selection set for all the strings in the list. All strings in the passed list must be capitalized
; and the string selected will be capitalized. The character case issue is documented within the lisp.
; Known bugs:
; none
;)
;)
; (setq ss (ssget))
; (setq lst (list st1 (setq st2 (getstring New string: ))))
; ))
;)
; (princ)
;)
(defun togtext (lst ss / count count2 ss lst numberinlst oldtxt oldlen string)
(setq ce (getvar cmdecho)) (setvar cmdecho 0) (command undo be undo end) (setvar cmdecho ce)
; You may ask why I added a string to the list. Simple. The numberinlst countdown
; starts at the end, thus the end value is replaced by the first in the list. When
; the countdown finds its way to the begining again, it thinks to replace the first
; string in the list too. It doesnt know that that string was already replaced.
(if (and
)) ; if & while
string nil
(setq nextlst
count2 -1
(if
; (= (substr oldtxt (1+ count2) curlen) (nth numberinlst lst)) ; List is case sensitive
(= (strcase (substr oldtxt (1+ count2) curlen)) (nth numberinlst lst)) ; List is CAPS
; The string being compared is made to be upper case. If you wish to make
; the function case sensitive, comment out the lower string with a ;,
(progn
(strcat
nextlst
))
(setq
) ; progn
) ; if strings equal
(if string (entupd (cdr (assoc -1 (entmod (subst (cons 1 string) (assoc 1 (entget (ssname ss count)))
(princ)
)
These autolisps are provided as is. I think theyll work, but I have not tested them extensivly from off my site.
Use them at your own risk!
If you have lisps that you would like to share on this site, please do so by uploading them.