Jump to content

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


bijoyvm

Recommended Posts

hi,

I'm looking for a lisp which similer to MICROSTATION command "Scale about element center". Sometimes its very useful when we are using polyline, circles and polygons instead of blocks.

 

more detail about microstation command please check this below link

http://www.cadlispandtips.com/2012/01/ms-tip-scale-about-element-center.html

 

thanks & regards

Bijoy.v.m

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 4 months later...
  • 1 month later...
  • 3 years later...
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

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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