Tfisch Posted July 9, 2010 Posted July 9, 2010 got this off a website, it is for changing text height, I want to see if it is something I want to use, but I can't get it load properly. I did everything the same as other LISPs that are working. I get to where you load the app and I get an error saying "cannot load......" here is the code. (defun chtext (/ a ts n index b1 b c d b2) (setq a (ssget)) (setq ts (getreal "\nEnter new text size")) (setq n (sslength a)) (setq index 0) (repeat n (setq b1 (entget (ssname a index))) (setq index (1+ index)) (setq b (assoc 0 b1)) (if (= "TEXT" (cdr b)) (progn (setq c (assoc 40 b1)) (setq d (cons (car c) ts)) (setq b2 (subst d c b1)) (entmod b2)))) (princ) ) EDIT: here is another LISP I am having trouble with, I got this one loaded, but when I try to use it and select an item, it does not let me select anything and then I get this message in the command line "; error: bad argument type: lselsetp nil" it is for sacling multiple items, here is the code: ;;;CADALYST 08/05 Tip 2049: mscale.lsp Scale Multiple Objects (c) Jamie Spartz ;;Written by Jamie Spartz on 3/2/05 (defun c:mscale (/ ss1 scale ssl count en el ip) (setvar "cmdecho" 0) (command "undo" "end") (command "undo" "group") (setq ss1 (ssget '((0 . "INSERT,AEC_MVBLOCK_REF")))) (setq scale (getreal "\nEnter scale factor to use: ")) (setq ssl (sslength ss1)) (setq count 0) (repeat ssl (setq en (ssname ss1 count)) (setq el (entget en)) (setq ip (cdr (assoc 10 el))) (setq count (1+ count)) (command "scale" en "" ip scale) ) (command "undo" "end") (setvar "cmdecho" 1) (princ) ) I am using AutoCAD 11. Quote
Lt Dan's legs Posted July 9, 2010 Posted July 9, 2010 I am using AutoCAD 11. USE # FOR YOUR CODE (defun [b]c[color=red]:[/color]htext[/b] (/ a ts n index b1 b c d b2);;COMPARE WITH YOUR CODE (setq a (ssget)) (setq ts (getreal "\nEnter new text size")) (setq n (sslength a)) (setq index 0) (repeat n (setq b1 (entget (ssname a index))) (setq index (1+ index)) (setq b (assoc 0 b1)) (if (= "TEXT" (cdr b)) (progn (setq c (assoc 40 b1)) (setq d (cons (car c) ts)) (setq b2 (subst d c b1)) (entmod b2)))) (princ) ) (defun c:mscale (/ ss1 scale ssl count en el ip) (setvar "cmdecho" 0) (command "undo" "end") (command "undo" "group") (setq ss1 (ssget '((0 . [color=red][b]"INSERT"[/b][color=black]))));;IF IT WORKS COMPARE HERE[/color][/color] (setq scale (getreal "\nEnter scale factor to use: ")) (setq ssl (sslength ss1)) (setq count 0) (repeat ssl (setq en (ssname ss1 count)) (setq el (entget en)) (setq ip (cdr (assoc 10 el))) (setq count (1+ count)) (command "scale" en "" ip scale) ) (command "undo" "end") (setvar "cmdecho" 1) (princ) ) Quote
Tfisch Posted July 12, 2010 Author Posted July 12, 2010 sorry I am new at this, very very new. ... as for the above codes, what should I copy and paste? I see that in the first line of the FIRST posted code it has (defun c:htext (/ a ts n index b1 b c d b2);;COMPARE WITH YOUR CODE now I don't want to copy the ;;COMPARE WITH YOUR CODE part correct? Same thing with the second code, what exactly am I copying and pasting. I've been doing so much research the last 4-5 days on LISP's. I went from literally NOTHING to now, no CPU programming knowledge at all, so sorry for the dumb questions. Thanks for the help though! Quote
Lt Dan's legs Posted July 12, 2010 Posted July 12, 2010 sorry I am new at this, very very new. ... as for the above codes, what should I copy and paste? I see that in the first line of the FIRST posted code it has (defun c:htext (/ a ts n index b1 b c d b2);;COMPARE WITH YOUR CODE now I don't want to copy the ;;COMPARE WITH YOUR CODE part correct? Same thing with the second code, what exactly am I copying and pasting. I've been doing so much research the last 4-5 days on LISP's. I went from literally NOTHING to now, no CPU programming knowledge at all, so sorry for the dumb questions. Thanks for the help though! A great place to start learning lisp is afralisp.net start with autolisp and work your way up. Many more sites but I really like this one. ;; For loading: http://www.cadtutor.net/forum/showthread.php?t=1390 your code.lsp Quote
Tfisch Posted July 12, 2010 Author Posted July 12, 2010 ... I tried the second code again and I am having the same type of problem, I did not include the part that says IF IT WORKS COMPARE HERE. the problem is that I can load the app (mscale - the second code) but after I load and try to use it, it will not let me select objects to scale. I type in MSCALE to run the program, and then it says SELECT OBJECTS, but I click on multiple obects - blocks, texts, lines and I cannot select anything... thoughts? Can someone point me in the direction of a LISP that scales MULTIPLE objects but with individual base points? IE - room names on a floorplan, select all of them and scale them by 1/2 but each roomname uses it's own basepoint from the center of the object. Quote
Lt Dan's legs Posted July 12, 2010 Posted July 12, 2010 I missed a ( copyclip this and replace the first routine or just add ( infront of defun c:htext (defun c:htext (/ a ts n index b1 b c d b2) (setq a (ssget '((0 . "text")))) (setq ts (getreal "\nEnter new text size")) (setq n (sslength a)) (setq index 0) (repeat n (setq b1 (entget (ssname a index))) (setq index (1+ index)) (setq b (assoc 0 b1)) (if (= "TEXT" (cdr b)) (progn (setq c (assoc 40 b1)) (setq d (cons (car c) ts)) (setq b2 (subst d c b1)) (entmod b2)))) (princ) ) this code should work. Works fine on my end... are you trying to scale a block? (defun c:mscale (/ ss1 scale ssl count en el ip) (setvar "cmdecho" 0) (command "undo" "end") (command "undo" "group") (setq ss1 (ssget '((0 . "INSERT")))) (setq scale (getreal "\nEnter scale factor to use: ")) (setq ssl (sslength ss1)) (setq count 0) (repeat ssl (setq en (ssname ss1 count)) (setq el (entget en)) (setq ip (cdr (assoc 10 el))) (setq count (1+ count)) (command "scale" en "" ip scale) ) (command "undo" "end") (setvar "cmdecho" 1) (princ) ) Quote
Lt Dan's legs Posted July 12, 2010 Posted July 12, 2010 did it work? try the above codes. I've tried it on acad 2007 and 2006. Works on both Quote
manirpg Posted July 13, 2010 Posted July 13, 2010 Hi friend Tfisch, I am also junior in LISP. I can help u little........ Actually ur first code miss C: (C: means command prompt) ur second code working fine, this program for only blocks. You select blocks then scaling value, u will get the result. Hopefully...... Thanks mani Quote
Tfisch Posted July 13, 2010 Author Posted July 13, 2010 ok the first one is NOT saving as a .LISP I am using notepad to save it in, and have been trying to same method I was using before. Same folder, selecting "All Files", and saving with a .lisp filename. As far as the second one.. I got it to "work" but it does not perform the way I want it too. I want to be able to select ANYTHING, text, blocks, lines and have them scaled, not just blocks. .. and when I did get MSCALE to work, it did not scale the items in place with individual base points, it grouped them all together. Still looking for a muti-scale lisp that scales ALL items selected in place with individual base points. Quote
alanjt Posted July 13, 2010 Posted July 13, 2010 What're you wanting to use as individual base points? Quote
Tfisch Posted July 13, 2010 Author Posted July 13, 2010 What're you wanting to use as individual base points? Im looking for an lisp that can perform this task: say you have a floorplan with roomnames in each room. Now you have to scale the roomtags, but you want to scale them alltogether because say there are 100 roomnames and you don't want to indivdual go around 100 times and scale each one. I would like to be able to select ALL 100 roomtags (prob through a LAYISO in regular cad, if you would do this it would scale all the tags, but also scale the distance between the tags and move them. I don't want to tags to move at all, other than being scaled. Quote
Lt Dan's legs Posted July 13, 2010 Posted July 13, 2010 ok the first one is NOT saving as a .LISP I am using notepad to save it in, and have been trying to same method I was using before. Same folder, selecting "All Files", and saving with a .lisp filename. As far as the second one.. I got it to "work" but it does not perform the way I want it too. I want to be able to select ANYTHING, text, blocks, lines and have them scaled, not just blocks. .. and when I did get MSCALE to work, it did not scale the items in place with individual base points, it grouped them all together. Still looking for a muti-scale lisp that scales ALL items selected in place with individual base points. this will work for everything. For some reason I thought you just wanted to scale blocks (defun c:mscale (/ ss1 scale ssl count en el ip) (setvar "cmdecho" 0) (command "undo" "end") (command "undo" "group") (setq ss1 (ssget)) [color=red];;removed '((0 . "INSERT"))[/color] (setq scale (getreal "\nEnter scale factor to use: ")) (setq ssl (sslength ss1)) (setq count 0) (repeat ssl (setq en (ssname ss1 count)) (setq el (entget en)) (setq ip (cdr (assoc 10 el))) (setq count (1+ count)) (command "scale" en "" ip scale) ) (command "undo" "end") (setvar "cmdecho" 1) (princ) ) Maybe some of the more experienced will help us understand why it's not working for Tfisch Quote
Tfisch Posted July 13, 2010 Author Posted July 13, 2010 Post one of these 'tags' in a DWG. the tag itself is NOT the issue. - basically it is MTEXT with a roomname, underneath a small rectangle with a 3-digit number in it. If I highlighter an entire tag in my drawing, and then used SC to scale it down by 1/2, the entire thing will sacle down by 1/2. I am trying to do this, but do mutiple roomtags (or items, i am using roomtags as an example) at the same time, with each item having it's own centered basepoint. Quote
Tfisch Posted July 13, 2010 Author Posted July 13, 2010 this will work for everything. For some reason I thought you just wanted to scale blocks (defun c:mscale (/ ss1 scale ssl count en el ip) (setvar "cmdecho" 0) (command "undo" "end") (command "undo" "group") (setq ss1 (ssget)) [color=red];;removed '((0 . "INSERT"))[/color] (setq scale (getreal "\nEnter scale factor to use: ")) (setq ssl (sslength ss1)) (setq count 0) (repeat ssl (setq en (ssname ss1 count)) (setq el (entget en)) (setq ip (cdr (assoc 10 el))) (setq count (1+ count)) (command "scale" en "" ip scale) ) (command "undo" "end") (setvar "cmdecho" 1) (princ) ) Maybe some of the more experienced will help us understand why it's not working for Tfisch I am getting your Mscale to work better now, but it is still not scaling with individual basepoints... or maybe I am not using it correctly? I am just selecting 2 differnet objects, typing in a scale factor. I am sure this part might be a problem as well.... (more I think about it, it probably is.) EX: if you have a circle with a number in it, and then another circle with a number in it, that is four items, even though 2 are grouped, and the other 2 are grouped... so maybe that is why I can't get it to work the way I want it to. Quote
Lt Dan's legs Posted July 13, 2010 Posted July 13, 2010 I am getting your Mscale to work better now, but it is still not scaling with individual basepoints... or maybe I am not using it correctly? I am just selecting 2 differnet objects, typing in a scale factor. I am sure this part might be a problem as well.... (more I think about it, it probably is.) EX: if you have a circle with a number in it, and then another circle with a number in it, that is four items, even though 2 are grouped, and the other 2 are grouped... so maybe that is why I can't get it to work the way I want it to. I see what you mean. The single line text seems to move but the mtext stays at the base point. Quote
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.