Jump to content

Modify dynamic block XYZ scale factors. need help !


Recommended Posts

Posted

Modify X, Y, and Z scale factors.

 

There is a dynamic block,Through the properties dialog to modify the XYZ scale factors, is ok!

sshot-29.png

But I use a lisp to modify xyz scale factors ,There is a problem.

sshot-30.png

 

Thank you for any help!Be grateful!

sshot-31.png

xyscl.lsp

Posted

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 ?

Posted
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

Posted (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 by Tharwat
Posted
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 .

Posted
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)

Posted

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.

Posted
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 .

Posted
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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...