highflybird Posted March 2, 2014 Posted March 2, 2014 Modify X, Y, and Z scale factors. There is a dynamic block,Through the properties dialog to modify the XYZ scale factors, is ok! But I use a lisp to modify xyz scale factors ,There is a problem. Thank you for any help!Be grateful! xyscl.lsp Quote
Tharwat Posted March 2, 2014 Posted March 2, 2014 So the text is a Dynamic Block and you want to relocate it by scaling it to X = 2.0 and Y = 2.0 and Z = 1.0 ? Quote
highflybird Posted March 2, 2014 Author Posted March 2, 2014 So the text is a Dynamic Block and you want to relocate it by scaling it to X = 2.0 and Y = 2.0 and Z = 1.0 ? Yes,use lisp,text scale does not change. Drawing1.dwg Quote
Tharwat Posted March 2, 2014 Posted March 2, 2014 (edited) I could not try the code on your Attributed Block due to the name is written in unknown language to my system , so anyway try it and let me know . (defun c:Test (/ u x y z s sn i e l v ls ent o nx) ;; Tharwat 02. March. 2014 ;; (setq u (entlast)) (if (and (setq x (getdist "\n Specify New scale factor for < X > :")) (setq y (getdist "\n Specify New scale factor for < Y > :")) (setq z (getdist "\n Specify New scale factor for < Z > :")) (progn (princ "\n Select Attributed Blocks to rescale ") (setq s (ssget "_:L" '((0 . "INSERT") (66 . 1)))) ) ) (repeat (setq i (sslength s)) (setq e (entget (setq sn (ssname s (setq i (1- i))))) v nil l (cdr (assoc 8 e)) v (mapcar '(lambda (a) (cons (vla-get-tagstring a) (vla-get-textstring a))) (vlax-invoke (setq o (vlax-ename->vla-object sn)) 'getattributes) ) ) (command "_.-insert" (vla-get-effectivename o) "_none" (cdr (assoc 10 e)) "xyz" x y z "0") (if (not (eq u (setq ls (entlast)))) (progn (entmod (subst (cons 8 l) (assoc 8 (entget ls)) (entget ls))) (setq nx ls) (while (and (setq nx (entnext nx)) (/= (cdr (assoc 0 (entget nx))) "SEQEND")) (if (eq (cdr (assoc 0 (setq ent (entget nx)))) "ATTRIB") (foreach j v (if (eq (car j) (cdr (assoc 2 ent))) (entmod (subst (cons 1 (cdr j)) (assoc 1 ent) ent)) ) ) ) ) (entdel sn) ) ) ) ) (princ) ) (vl-load-com) Edited March 3, 2014 by Tharwat Quote
highflybird Posted March 2, 2014 Author Posted March 2, 2014 I could not try the code on your Attributed Block due to the name is written in unknown language to my system , so anyway try it and let me know . Tharwat,Thank you very much ! is nice !but not support normal block . Quote
Tharwat Posted March 2, 2014 Posted March 2, 2014 Tharwat,Thank you very much ! is nice You're welcome . but not support normal block . It is much easier with Normal Blocks ... (defun c:Test (/ u x y z s sn i e l ls ent nx) ;; Tharwat 02. March. 2014 ;; (setq u (entlast)) (if (and (setq x (getdist "\n Specify New scale factor for < X > :")) (setq y (getdist "\n Specify New scale factor for < Y > :")) (setq z (getdist "\n Specify New scale factor for < Z > :")) (progn (princ "\n Select Blocks to rescale ") (setq s (ssget "_:L" '((0 . "INSERT")))) ) ) (repeat (setq i (sslength s)) (setq e (entget (setq sn (ssname s (setq i (1- i))))) l (cdr (assoc 8 e)) ) (command "_.-insert" (vla-get-effectivename (vlax-ename->vla-object sn)) "_none" (cdr (assoc 10 e)) "xyz" x y z "0" ) (if (/= u (setq ls (entlast))) (progn (entmod (subst (cons 8 l) (assoc 8 (entget ls)) (entget ls)) ) (entdel sn) ) ) ) ) (princ) ) (vl-load-com) Quote
highflybird Posted March 3, 2014 Author Posted March 3, 2014 It is much easier with Normal Blocks ... NOW,can support normal block. but Dynamic Block have problem. After change the dynamic block.the text of dynamic block is missing! In addition,Just want to input scale value once.Not need to enter 3 times. Quote
Tharwat Posted March 3, 2014 Posted March 3, 2014 NOW,can support normal block. but Dynamic Block have problem. After change the dynamic block.the text of dynamic block is missing!In addition,Just want to input scale value once.Not need to enter 3 times. Use the first lisp for attributed Blocks and Dynamics as well and use the second one for normal blocks . Quote
highflybird Posted March 4, 2014 Author Posted March 4, 2014 Use the first lisp for attributed Blocks and Dynamics as well and use the second one for normal blocks . Thank you !Tharwat. There is no other way. xyscl.lsp is can change normal blocks. 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.