wimal Posted December 13, 2011 Posted December 13, 2011 Please can you help me to write a lisp code; to select at once all blocks which have same name (dot) and inside a selection window. And after that I need to change scale factor of that blocks. Quote
Tharwat Posted December 13, 2011 Posted December 13, 2011 This ...? (defun c:TesT (/ sc ss i sn) ;;; Tharwat 13. Dec. 2011 ;;; (if (and (setq sc (getdist "\n Specify Scale factor :")) (setq ss (ssget "_:L" '((0 . "INSERT") (2 . "dot")))) ) (progn (repeat (setq i (sslength ss)) (setq sn (ssname ss (setq i (1- i)))) (command "_.scale" sn "" (cdr (assoc 10 (entget sn))) sc) ) (sssetfirst nil ss) ) (princ) ) (princ) ) Quote
Lee Mac Posted December 13, 2011 Posted December 13, 2011 QSELECT the Blocks, then Properties > Scale Quote
Lee Mac Posted December 13, 2011 Posted December 13, 2011 Another, by modification of the DXF Group codes: (defun c:scaleblocks ( / ent inc sel ) (if (and (setq sel (ssget "_:L" '((0 . "INSERT") (2 . "dot")))) (setq *scale* (cond ( (getdist (strcat "\nSpecify Scale <" (rtos (setq *scale* (cond (*scale*) (1.0)))) ">: " ) ) ) ( *scale* ) ) ) ) (repeat (setq inc (sslength sel)) (setq ent (entget (ssname sel (setq inc (1- inc))))) (foreach x '(41 42 43) (setq ent (subst (cons x *scale*) (assoc x ent) ent))) (entmod ent) ) ) (princ) ) Quote
wimal Posted December 13, 2011 Author Posted December 13, 2011 Thanks a lot. Both files are working properly.But difference ways. Please can you wright one more code to select single line text that height is 100 and to change the height. If you do that it is very convenience to my cad jobs. Quote
alanjt Posted December 13, 2011 Posted December 13, 2011 Again: QSELECT > PROPERTIES Again: QSELECT > PROPERTIES Quote
Tharwat Posted December 13, 2011 Posted December 13, 2011 Again: QSELECT > PROPERTIES Most of users would forget to use the basic commands that are attached within Cad with the use of Lisp , although that I recommend using them . (defun c:TesT (/ sc ss i sn) ;;; Tharwat 13. Dec. 2011 ;;; (if (and (setq sc (getdist "\n Specify new height :")) (setq ss (ssget "_:L" '((0 . "TEXT,MTEXT") (40 . 100)))) ) (repeat (setq i (sslength ss)) (setq sn (ssname ss (setq i (1- i)))) (entmod (subst (cons 40 sc) (assoc 40 (entget sn))(entget sn))) ) (princ) ) (princ) ) Quote
alanjt Posted December 13, 2011 Posted December 13, 2011 Most of users would forget to use the basic commands that are attached within Cad with the use of Lisp , although that I recommend using them . (defun c:TesT (/ sc ss i sn) ;;; Tharwat 13. Dec. 2011 ;;; (if (and (setq sc (getdist "\n Specify new height :")) (setq ss (ssget "_:L" '((0 . "TEXT,MTEXT") (40 . 100)))) ) (repeat (setq i (sslength ss)) (setq sn (ssname ss (setq i (1- i)))) (entmod (subst (cons 40 sc) (assoc 40 (entget sn))(entget sn))) ) (princ) ) (princ) ) Because people continue to post erroneous code, instead of just informing them of existing commands. Quote
Tharwat Posted December 13, 2011 Posted December 13, 2011 Because people continue to post erroneous code, instead of just informing them of existing commands. Hope you don't talking about annotative texts . Quote
alanjt Posted December 13, 2011 Posted December 13, 2011 Hope you don't talking about annotative texts . Quote
wimal Posted December 14, 2011 Author Posted December 14, 2011 Thanks for all information. But I could not found the way to use QSELECT command with command prompt It is always going to dialog box:(. Quote
tzframpton Posted December 14, 2011 Posted December 14, 2011 Again: QSELECT > PROPERTIES FILTER would be a better alternative, right? This way it gives the poster the use of a selection box, plus you can save Selection Filters. Because people continue to post erroneous code, instead of just informing them of existing commands. Hope you don't talking about annotative texts .This made me el-oh-el. Quote
alanjt Posted December 14, 2011 Posted December 14, 2011 This made me el-oh-el. Made me whuh-tha-hell. Quote
wimal Posted December 14, 2011 Author Posted December 14, 2011 Even filter command could not use with the command prompt. So I cannot feed data from a lisp code to evaluate. That is why I asked some lisp codes. Thanks all. Quote
Tharwat Posted December 14, 2011 Posted December 14, 2011 This made me el-oh-el. Made me whuh-tha-hell. What's made what ? Quote
wimal Posted December 18, 2011 Author Posted December 18, 2011 I try to feed a variable instead of value 100 to the following way but failed.What is the reasn (setq [b][color=red]ht 100[/color][/b])(setq ss (ssget "_:L" '((0 . "TEXT,MTEXT") (40 . [b][color=red]ht[/color][/b])))) ;;Originally Posted by Tharwat (defun c:TesT (/ sc ss i sn) ;;; Tharwat 13. Dec. 2011 ;;; (if (and (setq sc (getdist "\n Specify new height :")) (setq ss (ssget "_:L" '((0 . "TEXT,MTEXT") (40 . [color=red][b]100[/b][/color])))) ) (repeat (setq i (sslength ss)) (setq sn (ssname ss (setq i (1- i)))) (entmod (subst (cons 40 sc) (assoc 40 (entget sn))(entget sn))) ) (princ) ) (princ) Quote
Tharwat Posted December 18, 2011 Posted December 18, 2011 This way .... ? (setq ht 100) (setq ss (ssget "_:L" (list '(0 . "TEXT,MTEXT") (cons 40 ht)))) Quote
Tharwat Posted December 18, 2011 Posted December 18, 2011 Thanks it works. Glad to hear that . Good luck 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.