Nellie Posted September 8, 2008 Share Posted September 8, 2008 Hi Guys 7 Girls, This is my first thread so please br gentle. I was hoping somone could help me find a lisp online that can change variable (number) levels by a plus or minus value. It will take a good days work doing them one at a time so your help would be very much appriciated. Thanks in advance and i hope i've made myself clear. Regards Nellie Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 8, 2008 Share Posted September 8, 2008 Hi Nellie, Not sure if this is suitable for your needs, let me know if it is what you are after. ;increases number by 1 (defun c:addone() (setq ent (car (entsel "\nSelect Text object..."))) (while (/= nil ent) (setq ent (entget ent)) (setq count (atoi (cdr (assoc 1 ent)))) (setq count (+ 1 count)) (chg_txt) (setq ent (car (entsel "\nSelect Text object..."))) ) ; end while (princ) ) (defun chg_txt() (setq ent (subst (cons 1 (itoa count)) (assoc 1 ent) ent)) (entmod ent) ) or for minus... ;decreases number by 1 (defun c:minusone() (setq ent (car (entsel "\nSelect Text object..."))) (while (/= nil ent) (setq ent (entget ent)) (setq count (atoi (cdr (assoc 1 ent)))) (setq count (- count 1)) (chg_txt) (setq ent (car (entsel "\nSelect Text object..."))) ) ; end while (princ) ) (defun chg_txt() (setq ent (subst (cons 1 (itoa count)) (assoc 1 ent) ent)) (entmod ent) ) Hope this helps Quote Link to comment Share on other sites More sharing options...
Nellie Posted September 8, 2008 Author Share Posted September 8, 2008 Hi Lee Mac, Thanks for quick reply, I've not used a lisp before and have been told that i need to run a " macro DVB format" as well as a lisp. Is this correct or could you please confirm the correct process? Thanks again Nellie Quote Link to comment Share on other sites More sharing options...
lpseifert Posted September 8, 2008 Share Posted September 8, 2008 Try this... credit to Carl B. txm.lsp Quote Link to comment Share on other sites More sharing options...
lpseifert Posted September 8, 2008 Share Posted September 8, 2008 Hi Lee Mac, Thanks for quick reply, I've not used a lisp before and have been told that i need to run a " macro DVB format" as well as a lisp. Is this correct or could you please confirm the correct process? Thanks again Nellie Look here... Quote Link to comment Share on other sites More sharing options...
Nellie Posted September 8, 2008 Author Share Posted September 8, 2008 Thanks Ipseifert/Carl B, would you mind just confirming that once loaded i run the lisp by trping the lisp name in the command line? Also do i need to create a macro DVB? Cheers Nellie Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 8, 2008 Share Posted September 8, 2008 I am using AutoCAD 2004, and the LISP should work on AutoCAD 2006 as well. I dont think you need a macro dvb format, I would usually copy the LISP text (in the code box) into a notepad entry and save the file as a ".lsp" file. Then, in ACAD go to "Tools" "Load Application" and browse for the LSP file and load it. To run the LISP, type the syntax shown after the prefix "(defun c:XX " (where "XX" is the syntax... i.e. "addone" or "minusone") or alternatively, assign a toolbar button to run this syntax. Hope this helps Quote Link to comment Share on other sites More sharing options...
Nellie Posted September 8, 2008 Author Share Posted September 8, 2008 Thanks very much for all your help guys that was great. Nellie. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 9, 2008 Share Posted September 9, 2008 Here is a lisp that allows you add or subtract a value to multiple text we use in road designs where sometimes just need to raise a road a constant amount saves re plotting the whole lot again ;Adds a fixed amount to a number (PRINC "TO USE JUST TYPE A2L") (DEFUN c:A2L () (setvar "cmdecho" 1) (setq v2 (getreal "\nEnter ht adjustment ")) (setq test 1) (while (= test 1) (setq en1 (car (entsel "\nSelect text number:" ))) (if (/= en1 nil) (progn (setq el1 (entget en1)) (setq v1 (atof (cdr (assoc 1 el1)))) (setq a (+ v1 v2)) (setq b (rtos a 2 3)) (setq el (subst (cons 1 b) (assoc 1 el1) el1)) (entmod el) ; (entupd en1) );progn (princ "\nplease pick again"); else );if ); while true ); END DEFUN (setq el nil) (setq en nil) (setq a nil) (setq v1 nil) (setvar "cmdecho" 1) (princ) Its one at a time pick but still way quicker. Quote Link to comment Share on other sites More sharing options...
Nellie Posted September 9, 2008 Author Share Posted September 9, 2008 Thanks for your advice. Quote Link to comment Share on other sites More sharing options...
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.