need a lisp for scale of all objects(text,donuts) with respect of there center of point

need a lisp for scale of all objects(text,donuts) with respect of there center of point

archana96
Enthusiast Enthusiast
387 Views
6 Replies
Message 1 of 7

need a lisp for scale of all objects(text,donuts) with respect of there center of point

archana96
Enthusiast
Enthusiast

hi i need a lisp for the all objects(text and dounts) scale with there center

0 Likes
388 Views
6 Replies
Replies (6)
Message 2 of 7

cadffm
Consultant
Consultant

Hi,

 

for (M)TText, use command TSCALE (AutoCAD/ExpressTools)

 

for "Donuts" : DWG/DXF don't know about Donuts, command Donuts create CLOSED POLYLINEs with WIDTH >0.

So you need a Tool to scale from geometric center, or boundary center, because Polylines don't have a center or basepoint.

There is nothing out of the box, but you will find some tool to do what you want.

ScaleBB VariaBP or something like that are name for such tools.

Sample hit: https://apps.autodesk.com/ACD/en/Detail/Index?id=4821281435068614139&appLang=en&os=Win64&autostart=t...

 

You know that polylines width will scale too?

Sebastian

0 Likes
Message 3 of 7

archana96
Enthusiast
Enthusiast

ThankS BUT IN MY OFFICE INSTALLATION NOT POSSBLE

 

0 Likes
Message 4 of 7

cadffm
Consultant
Consultant

so, search another solution, as I wrote, there are more than one outside.

Another solution: >click and seek for SAC<

(the tool I use to find all these answers is: www.google.com)

 

And what is with my (M)Text solution? No flowers, no applause?

 

What product&Productversion your are running?

 

 
 

 

 

Sebastian

0 Likes
Message 5 of 7

hak_vz
Advisor
Advisor

This is approximation that doesn't count for various text formatting. 

(defun c:sce( / util ss i sc e eo pt)
	;scale selected objects in place
	(setq ss (ssget '((0 . "TEXT,LWPOLYLINE"))))
	(setq util (vla-get-utility (vla-get-activedocument (vlax-get-acad-object))))
	(cond
		((and ss)
			(setq i -1)
			(setq sc (vla-GetReal util "\nScale factor (let say 1.25) >: "))
			(while (< (setq i (1+ i)) (sslength ss))
				(setq e (ssname ss i))
				(setq eo (vlax-ename->vla-object e))
				(setq pt (cdr (assoc 10 (entget e))))
				(if (and pt)
					(vla-ScaleEntity eo (vlax-3d-point pt) sc)
				)	
			)
		)
	)
(princ)
)

  

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 6 of 7

Kent1Cooper
Consultant
Consultant

The attached ScaleAboutCenters.lsp will do that with anything, about the midpoint of each thing's extents, not the insertion or starting point.  If you like it, it can be made to limit selection, and to test for LWPolylines being Donuts [closed 2-vertex with two bulge factors of 1 -- they can have zero width, by the way].

Kent Cooper, AIA
0 Likes
Message 7 of 7

Moshe-A
Mentor
Mentor

@archana96 hi,

 

Check the SCTD command.

 

enjoy

Moshe

 

 

; scale texts + donuts

(defun c:sctd (/ askScale) ; local function
	         ; defscl ss ename AcDbObj MinPoint MaxPoint p0 p1 mp)

 (defun askScale (def / ask)
  (initget (+ 2 4))

  (if (not (setq ask (getdist (strcat "\nSpecify scale factor <" (rtos def 2) ">: "))))
   (setq ask def)
   (setq def ask)
  )
 ); askScale


 ; prepare default
 (if (= (getvar "userr3") 0.0)
  (setq defscl (setvar "userr3" 1.25))
  (setq defscl (getvar "userr3"))
 )
  
 (if (and
	(setvar "userr3" (setq sc (askScale defscl)))
	(setq ss (ssget '((-4 . "<or")
		         	(0 . "text,mtext")
			    	; select only donut
		           	(-4 . "<and") (0 . "lwpolyline") (90 . 2) (70 . 1) (-4 . "<>") (40 . 0) (-4 . "<>") (41 . 0) (42 . 1.0) (-4 . "and>")
		          (-4 . "or>")
		         ); list
	         ); ssget
     	); setq
     ); and
  (progn
   (foreach ename (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
    (setq AcDbObj (vlax-ename->vla-object ename))

    (vla-getBoundingBox AcDbObj 'MinPoint 'MaxPoint)
    (setq p0 (vlax-safearray->list MinPoint))
    (setq p1 (vlax-safearray->list MaxPoint))
    (setq mp (mapcar '(lambda (n) (* n 0.5)) (mapcar '+ p0 p1))) ; calc center point
    (vla-scaleEntity AcDbObj (vlax-3d-point mp) sc)
    (vlax-release-object AcDbObj)
   ); foreach
  ); progn
 ); if

 (princ)
); c:sctd

 

 

 

0 Likes