Adjusting size

Adjusting size

Anonymous
Not applicable
770 Views
2 Replies
Message 1 of 3

Adjusting size

Anonymous
Not applicable

I am currently trying to scale multiple objects up in place. I have tried to use the scale command, but that changes the location of the objects. I need to scale the objects in place without needing a base point, and without referencing the center of the objects because they have odd shapes . Currently I use the code below to select multiple objects then use the properties window to manual change the Scale X, Scale Y, and Scale Z values under the Geometry section in the properties window. It does not seem like that difficult a task, but I am having trouble trying to find reference material.

(defun c:sbs2()
(sssetfirst nil(ssget "X" '((0 . "INSERT")(2 . "F_PREMISE,OH_JBOX.DWG,UG_JBOX.DWG,UG_PBOX_L,UG_PBOX_S"))))

)

0 Likes
771 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

You can scale it base on the objects built-in base point: I use something like this:

(defun C:SCBL (/ done ss1 nla e count emax en ed sen sed sc1 sc2)
(graphscr) (setq done nil)
(princ "Select Blocks to be Scale...\n") ; then select
(setq ss1
(ssget '((-4 . "<OR")(0 . "INSERT")(0 . "MTEXT")(-4 . "OR>")))
); select and place set into ss1
(if ss1 ; if any objects selected
(progn
(setq sc1(getstring"\nReference Scale: "))
(setq sc2(getstring"\nNew Scale: "))
(setq count 0) ; initialize counter
(setq emax (sslength ss1)) ; get length of ss1
(while (< count emax) ; while there are still entities in ss1
(setq en (ssname ss1 count)) ; get entity's name
(setq ed (entget en)) ; get entity's data
(command".Scale" en "" (cdr(assoc 10 ed)) "r" sc1 sc2)
(setq count (1+ count)) ; get next entity in ss1
) ; while
) ; progn
) ; if
) ; defun

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales | Exchange App Store

0 Likes
Message 3 of 3

dbroad
Mentor
Mentor

Assuming you wanted to enter different x, y, and z scales, this should work. Otherwise, the previous solution should be enough.

(defun c:sbs2  (/ xs ys zs doc blks)
  (if (ssget "X"'((0 . "INSERT")
		  ;(2 . "F_PREMISE,OH_JBOX.DWG,UG_JBOX.DWG,UG_PBOX_L,UG_PBOX_S")
	       ))
    (progn (setq xs   (getdist "\nX scale<1.0>: ")
		 xs   (cond (xs)(1.0))
		 ys   (getdist "\nY scale<1.0>: ")
		 ys   (cond (ys)(1.0))
		 zs   (getdist "\nZ scale<1.0>: ")
		 zs   (cond (zs)(1.0))
		 doc  (vla-get-ActiveDocument (vlax-get-acad-object))
		 blks (vla-get-blocks doc))
	   (vlax-for n	(vla-get-activeselectionset doc)
	     (cond ((= acUniform
		       (vla-get-BlockScaling
			 (vla-item blks (vla-get-EffectiveName n))))
		    (vla-put-XScaleFactor n xs))
		   (t
		    (vla-put-XScaleFactor n xs)
		    (vla-put-YScaleFactor n ys)
		    (vla-put-ZScaleFactor n zs)))))))

Architect, Registered NC, VA, SC, & GA.
0 Likes