vards01 Posted May 20, 2010 Posted May 20, 2010 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 Quote
MSasu Posted May 20, 2010 Posted May 20, 2010 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, Quote
ReMark Posted May 20, 2010 Posted May 20, 2010 Perhaps the block scale lisp routine found here might do the trick. Scroll down until you find the file Bsc51.zip. http://www.cadcorner.ca/lisp.php Quote
NBC Posted May 20, 2010 Posted May 20, 2010 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 ? Quote
vards01 Posted May 20, 2010 Author Posted May 20, 2010 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? Quote
MSasu Posted May 20, 2010 Posted May 20, 2010 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, Quote
vards01 Posted May 20, 2010 Author Posted May 20, 2010 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........ Quote
MSasu Posted May 20, 2010 Posted May 20, 2010 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, Quote
vards01 Posted May 20, 2010 Author Posted May 20, 2010 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.... Quote
MSasu Posted May 20, 2010 Posted May 20, 2010 Please check this FAQ for information about AutoLISP routines usage. Regards, Quote
vards01 Posted May 20, 2010 Author Posted May 20, 2010 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 Quote
vards01 Posted May 20, 2010 Author Posted May 20, 2010 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 Quote
vards01 Posted May 20, 2010 Author Posted May 20, 2010 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. Quote
MSasu Posted May 20, 2010 Posted May 20, 2010 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, Quote
ReMark Posted May 20, 2010 Posted May 20, 2010 Another possibility...Blkscl.lsp under heading of Block/Xref Management at this website: http://paracadd.com/lisp.htm Quote
MSasu Posted May 20, 2010 Posted May 20, 2010 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, Quote
vards01 Posted May 20, 2010 Author Posted May 20, 2010 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 Quote
vards01 Posted May 20, 2010 Author Posted May 20, 2010 would be great if someone had that elaborate code ;-) Quote
MSasu Posted May 20, 2010 Posted May 20, 2010 Ask a moderator to move this thread into AutoLISP, VBA, the CUI & Customisation section. Maybe someone from there will be able to help you. Regards, Quote
alanjt Posted May 20, 2010 Posted May 20, 2010 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) ) Quote
Recommended Posts
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.