Jump to content

Group scale blocks from individual centres


Recommended Posts

Hi All,

I am trying to scale individual blocks within a drawing around 300 blocks, which as you can appreciate is time consuming and frustrating manually. So I'm wondering whether anyone knows a shortcut to group select these blocks and scale but from the individual block centres as oppose to singular centre point.

Thanks in advance,

Ian

Link to comment
Share on other sites

  • 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

If desired scale is the same for all blocks, try to select them all (by Quick Select) and after alter X, Y and Z scale factors in Properties.

 

Regards,

Link to comment
Share on other sites

A few questions to garner more information:

 

Are there other blocks contained within the drawing that you don't wish to scale ?

Do the blocks that you wish to scale share the same name, or at least part of the same name ?

Link to comment
Share on other sites

Around 4 different types in this prticular drawing and do share the same names, I am going to try to select by block name then x,y,z scale under properties.

 

Is there a way round this if they all have different names, for future reference?

Link to comment
Share on other sites

Is there a way round this if they all have different names, for future reference?

Use Quick Select feature (in Properties window, top-right corner, funnel & lightning icon) and filter by entity type; Operator = "select all".

 

Regards,

Link to comment
Share on other sites

Only problem with a select all is that blocks are different sizes, therefore get the 'VARIES' in sizes tab so would produced undesire results. I wanted to do an overall scale factor of 1.3........

Link to comment
Share on other sites

Use the below routine to apply a multiplication factor for X, Y and Z scale to all blocks in drawing:

 

(defun c:ScaleAllBlocks( / OldOsmode BlocksSet BlockItem BlockAssocList ScaleFactor )
(setq OldOsmode (getvar "OSMODE"))
(setvar "OSMODE" 0)

(setq ScaleFactor (getreal "\nInput scale factor multiplication to apply on all blocks: "))

(if (and ScaleFactor
         (setq BlocksSet (ssget "_X" '((0 . "INSERT"))))   ;select all inserted blocks
         (> (sslength BlocksSet) 0))
 (while (> (sslength BlocksSet) 0)
  (setq BlockAssocList (entget (setq BlockItem (ssname BlocksSet 0)))
        BlockAssocList (subst (cons '41 (* ScaleFactor (cdr (assoc 41 BlockAssocList)))) (assoc 41 BlockAssocList) BlockAssocList)
        BlockAssocList (subst (cons '42 (* ScaleFactor (cdr (assoc 42 BlockAssocList)))) (assoc 42 BlockAssocList) BlockAssocList)
        BlockAssocList (subst (cons '43 (* ScaleFactor (cdr (assoc 43 BlockAssocList)))) (assoc 43 BlockAssocList) BlockAssocList))

  (entmod BlockAssocList)                                  ;update block entity

  (setq BlockItem (ssdel BlockItem BlocksSet))             ;remove processed block
 )
)

(setvar "OSMODE" OldOsmode)
(princ)
)

 

Regards,

Link to comment
Share on other sites

That coding looks great, how to I apply this to my drawing? Seems It will do exactly what I require, just not sure how to impement....

Link to comment
Share on other sites

Hi MSASU......Right so do I have to download a lisp file to upload, or is this one preloaded? Also the function you say to use will this scale from the insertion point of the block or the centre of the geometry? As I have found the insertion points are all over the place.......so when I try the quick select method they go all over the shop :unsure:

Link to comment
Share on other sites

Hi MSASU.....I see I answer my own question regarding the lisp function. (when I follow your link)

 

Will try to see if this scales from the geometry centre or block insertion point, thanks for your help,

 

Ian

Link to comment
Share on other sites

Unfortunately scales from the insertion point of the block, which produces undesired results.......I guess I will just have to do it manually, a handy little though for future refernce.

 

I am trying to increase the size of fire protection symbols within rooms so as you can imagine very tedious, but with varying block insertion points perhaps not possible as a batch process.

Link to comment
Share on other sites

Yes, the routine scale each block by his insertion point – in fact adjust existing scale factors with a multiplication factor; to scale from centre of the block (centroid) will require a much elaborate code.

 

 

Regards,

Link to comment
Share on other sites

Another possibility...Blkscl.lsp under heading of Block/Xref Management at this website:

 

http://paracadd.com/lisp.htm

That routine will scale to a given factor all blocks with a given name – unfortunately it isn’t what the OP is looking for.

 

Regards,

Link to comment
Share on other sites

Yes a real bummer as its such a tedious task, guess sometimes it just has to be done manually - but thanks for all the advice

Link to comment
Share on other sites

Hmm...

 

(defun c:SBC (/ ss scale flag a b)
 ;; Scale blocks by Center
 ;; Alan J. Thompson, 05.20.10
 (vl-load-com)
 (if (and (setq ss (ssget "_:L" '((0 . "INSERT"))))
          (setq scale (getreal "\nSpecify Scale Factor: "))
     )
   (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
               (vlax-3d-point
                 (mapcar (function (lambda (x y) (/ (+ x y) 2.)))
                         (vlax-safearray->list a)
                         (vlax-safearray->list b)
                 )
               )
               (abs scale)
         )
       )
     )
     (vla-delete ss)
     (and flag (vla-endundomark *AcadDoc*))
   )
 )
 (princ)
)

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