Jump to content

Group scale blocks from individual centres


Recommended Posts

  • Replies 35
  • Created
  • Last Reply

Top Posters In This Topic

  • vards01

    17

  • alanjt

    8

  • MSasu

    8

  • ReMark

    2

Top Posters In This Topic

Posted Images

@alanjt: Chapeau!

 

I'm going to assume that's a compliment. :)

 

Here's one with the option to scale by center or insertion point.

 

(defun c:SB (/ ss scale flag a b)
 ;; Scale blocks by Center or Insertion point
 ;; Alan J. Thompson, 05.20.10
 (vl-load-com)

 (or *SB:Option* (setq *SB:Option* "Insertion"))

 (if (and (setq ss (ssget "_:L" '((0 . "INSERT"))))
          (setq scale (getreal "\nSpecify Scale Factor: "))
          (not (initget 0 "Center Insertion"))
          (setq *SB:Option*
                 (cond ((getkword (strcat "\nScale by [Center/Insertion] <" *SB:Option* ">: ")))
                       (*SB:Option*)
                 )
          )
     )
   (progn
     (setq flag (not (vla-startundomark
                       (cond (*AcadDoc*)
                             ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object))))
                       )
                     )
                )
     )
     (vlax-for x (setq ss (vla-get-activeselectionset *AcadDoc*))
       (vla-getboundingbox x 'a 'b)
       (vl-catch-all-apply
         (function vla-scaleentity)
         (list x
               (if (eq *SB:Option* "Center")
                 (vlax-3d-point
                   (mapcar (function (lambda (x y) (/ (+ x y) 2.)))
                           (vlax-safearray->list a)
                           (vlax-safearray->list b)
                   )
                 )
                 (vla-get-insertionpoint x)
               )
               (abs scale)
         )
       )
     )
     (vla-delete ss)
     (and flag (vla-endundomark *AcadDoc*))
   )
 )
 (princ)
)

Link to comment
Share on other sites

Hi, Still can not get this one to work. I have called the file SB.lsp, load the file and get nothing when I type SB in the command line? Probably something I'm doing wrong as I'm new to lsp commands! Wish I'd used these sooner I've been on CAD since R13!

Link to comment
Share on other sites

Not to sure why this will not load properly, MSASU's lisp file loads fine and runs, but alanjt's lisp code states loaded succuessfully but obviously doesn't as when I go back to check if its loaded its not listed. Any ideas?

Link to comment
Share on other sites

When you say you load it, are you using appload and loading it or adding it to your startup suite? Also, what does it return when you type SB at the commandline?

Link to comment
Share on other sites

I load it by the link posted here on how to load. I type SB and I get 'unknown command'. But when I go back to check if the SB.lsp file is loaded it is not, so really confused as it retains the lisp file submitted by msasu just not SB.lsp

Link to comment
Share on other sites

just checked command window, I get application loaded successfully followed by malformed list on input

Ah hah! That means you missed copying a paren. Recopy what I posted and try again.

Link to comment
Share on other sites

Absolute genius......what a time saver this is for me,

 

Thankyou very much indeed!

I wish I could get a piece of that time saved.

 

Enjoy and you're welcome.

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