Jump to content

Looking for a LISP which SCALE objects with its own center point


Recommended Posts

Posted

Here is a generalisation of the code in that thread:

 

;; Scale About Center  -  Lee Mac

(defun c:sac ( / ll sel obj ur )
   (initget 6)
   (if
       (and
           (setq *scl*
               (cond
                   (   (getdist (strcat "\nSpecify Scale Factor" (if *scl* (strcat " <" (rtos *scl* 2) ">: ") ": "))))
                   (   *scl*   )
               )
           )
           (ssget "_:L")
       )
       (progn
           (vlax-for obj (setq sel (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object))))
               (if (null (vl-catch-all-error-p (vl-catch-all-apply 'vla-getboundingbox (list obj 'll 'ur))))
                   (vla-scaleentity obj
                       (vlax-3D-point
                           (mapcar '(lambda ( a b ) (/ (+ a b) 2.0))
                               (vlax-safearray->list ll)
                               (vlax-safearray->list ur)
                           )
                       )
                       *scl*
                   )
               )
           )
           (vla-delete sel)
       )
   )
   (princ)
)
(vl-load-com) (princ)

Posted (edited)

that's the one Im looking for...

Thank you so much lee & remark

 

Lee, can you add this lisp to www.lee-mac.com beacuse lots of cad users need this one.

 

thanks again

bijoy.v.m

Edited by bijoyvm
  • 4 months later...
Posted

Thank you very much dude you are great too Mr. Lee...

  • 1 month later...
  • 3 years later...
Posted
You're welcome! :)

 

Hi Lee,

The sac's code is fantastic!! :)

 

Your code isn't working for blocks?

 

Because I have thousand block into my drawing and I'd like to change the scale.

 

Thanks

test.dwg

Posted

If your happy with scale about insertion point then its easy just use a ssget the right blocks and change the scale. Your dwg gives no hints to what you want.

 

 ; a roughy
(defun c:test (/ sc ss x)
(setq sc (Getreal "\nEnter scale"))
(setq ss (ssget "x" (list(cons 0 "INSERT"))))
(repeat (SETQ X (SSLENGTH SS))
(setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1)))))
(vla-put-XScaleFactor obj sc)
(vla-put-YScaleFactor obj sc)
)
)
(c:test)

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