Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple objects scaled

Status
Not open for further replies.

tafftech

Mechanical
Aug 8, 2003
2
I have put over 100 objects on a drawing by multiple copy function.The object is 3 circles with cross hair centres. Now I have been asked to reduce the size by 50%.The question is do I have to select each set individually then reduce it then move on to the next set. I want them to stay in the same position and just get smaller. Hope someone can help.
 
Replies continue below

Recommended for you

Unless the "object" is a block, I think you are looking at some pretty tedius work. If it weren't for the cross hairs, I could write you a LISP to scale circles about their centers.

Perhaps the best thing would be to make a block, insert it once then copy it 100 times having set your osnap to center. Make the block something easy to see, like a large filled red donut. Use a seaparate layer. Zoom out so your apeture box is large compared to the circles so you can pick easliy. Then freeze the block layer and erase using (ssx) the circles and cross hairs. Then change the block to what you need it to be.
 
Try this lisp called "mscale". It was given in a previous thread by SpeedCad. Unfortunately I was unable to link to that thread.

This lisp gives the option of choosing anything you wish to scale, not only circles or blocks.


;|

/¯¯¯ | /¯¯¯¯ / ¯ \ |¯¯¯¯\
\__ __ __ | | /___\ | |
\ |¯¯\ |__| |__| /¯¯| | / \ | |
___/ |__/ |__ |__ \__| \____ / \ |____/
|
| 2003
|;
(defun escala-ins ()
(initget
"Line PoliLine Circle Arc COtas Dtext Mtext Block MLine Spline Elipse Hatch SOlid selection"
)
(setq tipo-objeto
(getkword
"\nselect object to scale [Line/PoliLine/Circle/Arc/COtas/Dtext/Mtext/Block/MLine/Spline/Elipse/Hatch/SOlid/selection] <selection>:"
)
)
(if (= tipo-objeto nil)
(setq tipo-objeto "selection")
)
(cond ((= tipo-objeto "selection") (todos-esc))
((= tipo-objeto "Line") (Line-esc))
((= tipo-objeto "PoliLine") (poliLine-esc))
((= tipo-objeto "Circle") (Circle-esc))
((= tipo-objeto "Arc") (Arc-esc))
((= tipo-objeto "COtas") (cotas-esc))
((= tipo-objeto "Dtext") (dtext-esc))
((= tipo-objeto "Mtext") (mtext-esc))
((= tipo-objeto "Block") (Block-esc))
((= tipo-objeto "MLine") (mLine-esc))
((= tipo-objeto "Spline") (spline-esc))
((= tipo-objeto "Elipse") (elipse-esc))
((= tipo-objeto "Hatch") (hatch-esc))
((= tipo-objeto "SOlid") (SOlid-esc))
)
)

(defun todos-esc ()
(setq objetos (ssget))
(if (/= objetos nil)
(progn
(setq num-obj (sslength objetos)
n 0
)
(prompt (strcat "\n*** "
(rtos num-obj)
" object(s) selected ***"
)
)
(repeat num-obj
(setq nom-obj (ssname objetos n))
(redraw nom-obj 3)
(setq n (1+ n))
)
(if *escala*
()
(setq *escala* 1)
)
(initget 6)
(if (setq escala
(getreal (strcat "\nEnter scaling factor <"
(rtos *escala* 2 3)
">: "
)
)
)
()
(setq escala *escala*)
)
(setq *escala* escala)
(setq n 0)
(repeat num-obj
(setq nom-obj (ssname objetos n)
p-ins (cdr (assoc 10 (entget nom-obj)))
)
(command "_.scale" nom-obj "" p-ins escala)
(setq n (1+ n))
)
)
(prompt "\n*** no object selected ***")
)
)

(defun Line-esc ()
(setq objetos (ssget))
(if (/= objetos nil)
(progn
(setq num-obj (sslength objetos)
n 0
n-ent 0
)
(prompt (strcat "\n*** "
(rtos num-obj)
" object(s) selected ***"
)
)
(repeat num-obj
(setq nom-obj (ssname objetos n))
(if (= "LINE" (cdr (assoc 0 (entget nom-obj))))
(redraw nom-obj 3)
(setq n-ent (1+ n-ent))
)
(setq n (1+ n))
)
(prompt (strcat "\n*** "
(rtos (- num-obj n-ent))
" l?nea(s) select(s) ***"
)
)
(if *escala*
()
(setq *escala* 1)
)
(initget 6)
(if (setq escala
(getreal (strcat "\nEnter scaling factor <"
(rtos *escala* 2 3)
">: "
)
)
)
()
(setq escala *escala*)
)
(setq *escala* escala)
(setq n 0)
(repeat num-obj
(setq nom-obj (ssname objetos n)
p-ins (cdr (assoc 10 (entget nom-obj)))
)
(if (= "LINE" (cdr (assoc 0 (entget nom-obj))))
(command "_.scale" nom-obj "" p-ins escala)
)
(setq n (1+ n))
)
)
(prompt "\n*** no object selected ***")
)
)

(defun poliLine-esc ()
(setq objetos (ssget))
(if (/= objetos nil)
(progn
(setq num-obj (sslength objetos)
n 0
n-ent 0
)
(prompt (strcat "\n*** "
(rtos num-obj)
" objeto(s) select(s) ***"
)
)
(repeat num-obj
(setq nom-obj (ssname objetos n))
(if (= "LWPOLYLINE" (cdr (assoc 0 (entget nom-obj))))
(redraw nom-obj 3)
(setq n-ent (1+ n-ent))
)
(setq n (1+ n))
)
(prompt (strcat "\n*** "
(rtos (- num-obj n-ent))
" poliline(s) selected ***"
)
)
(if *escala*
()
(setq *escala* 1)
)
(initget 6)
(if (setq escala
(getreal (strcat "\nEnter scaling factor <"
(rtos *escala* 2 3)
">: "
)
)
)
()
(setq escala *escala*)
)
(setq *escala* escala)
(setq n 0)
(repeat num-obj
(setq nom-obj (ssname objetos n)
p-ins (cdr (assoc 10 (entget nom-obj)))
)
(if (= "LWPOLYLINE" (cdr (assoc 0 (entget nom-obj))))
(command "_.scale" nom-obj "" p-ins escala)
)
(setq n (1+ n))
)
)
(prompt "\n*** no object selected ***")
)
)

(defun Circle-esc ()
(setq objetos (ssget))
(if (/= objetos nil)
(progn
(setq num-obj (sslength objetos)
n 0
n-ent 0
)
(prompt (strcat "\n*** "
(rtos num-obj)
" object(s) selected ***"
)
)
(repeat num-obj
(setq nom-obj (ssname objetos n))
(if (= "CIRCLE" (cdr (assoc 0 (entget nom-obj))))
(redraw nom-obj 3)
(setq n-ent (1+ n-ent))
)
(setq n (1+ n))
)
(prompt (strcat "\n*** "
(rtos (- num-obj n-ent))
" Circle(s) seleccionado(s) ***"
)
)
(if *escala*
()
(setq *escala* 1)
)
(initget 6)
(if (setq escala
(getreal (strcat "\nEnter scaling factor <"
(rtos *escala* 2 3)
">: "
)
)
)
()
(setq escala *escala*)
)
(setq *escala* escala)
(setq n 0)
(repeat num-obj
(setq nom-obj (ssname objetos n)
p-ins (cdr (assoc 10 (entget nom-obj)))
)
(if (= "CIRCLE" (cdr (assoc 0 (entget nom-obj))))
(command "_.scale" nom-obj "" p-ins escala)
)
(setq n (1+ n))
)
)
(prompt "\n*** no object selected ***")
)
)

(defun Arc-esc ()
(setq objetos (ssget))
(if (/= objetos nil)
(progn
(setq num-obj (sslength objetos)
n 0
n-ent 0
)
(prompt (strcat "\n*** "
(rtos num-obj)
" objects selected ***"
)
)
(repeat num-obj
(setq nom-obj (ssname objetos n))
(if (= "ARC" (cdr (assoc 0 (entget nom-obj))))
(redraw nom-obj 3)
(setq n-ent (1+ n-ent))
)
(setq n (1+ n))
)
(prompt (strcat "\n*** "
(rtos (- num-obj n-ent))
" Arc(s) seleccionado(s) ***"
)
)
(if *escala*
()
(setq *escala* 1)
)
(initget 6)
(if (setq escala
(getreal (strcat "\nEnter scaling factor <"
(rtos *escala* 2 3)
">: "
)
)
)
()
(setq escala *escala*)
)
(setq *escala* escala)
(setq n 0)
(repeat num-obj
(setq nom-obj (ssname objetos n)
p-ins (cdr (assoc 10 (entget nom-obj)))
)
(if (= "ARC" (cdr (assoc 0 (entget nom-obj))))
(command "_.scale" nom-obj "" p-ins escala)
)
(setq n (1+ n))
)
)
(prompt "\n*** no object selected ***")
)
)

(defun cotas-esc ()
(setq objetos (ssget))
(if (/= objetos nil)
(progn
(setq num-obj (sslength objetos)
n 0
n-ent 0
)
(prompt (strcat "\n*** "
(rtos num-obj)
" objects selected ***"
)
)
(repeat num-obj
(setq nom-obj (ssname objetos n))
(if (= "DIMENSION" (cdr (assoc 0 (entget nom-obj))))
(redraw nom-obj 3)
(setq n-ent (1+ n-ent))
)
(setq n (1+ n))
)
(prompt (strcat "\n*** "
(rtos (- num-obj n-ent))
" cota(s) seleccionada(s) ***"
)
)
(if *escala*
()
(setq *escala* 1)
)
(initget 6)
(if (setq escala
(getreal (strcat "\nEnter scaling factor <"
(rtos *escala* 2 3)
">: "
)
)
)
()
(setq escala *escala*)
)
(setq *escala* escala)
(setq n 0)
(repeat num-obj
(setq nom-obj (ssname objetos n)
p-ins (cdr (assoc 10 (entget nom-obj)))
)
(if (= "DIMENSION" (cdr (assoc 0 (entget nom-obj))))
(command "_.scale" nom-obj "" p-ins escala)
)
(setq n (1+ n))
)
)
(prompt "\n*** no object selected ***")
)
)

(defun dtext-esc ()
(setq objetos (ssget))
(if (/= objetos nil)
(progn
(setq num-obj (sslength objetos)
n 0
n-ent 0
)
(prompt (strcat "\n*** "
(rtos num-obj)
" objects selected ***"
)
)
(repeat num-obj
(setq nom-obj (ssname objetos n))
(if (= "TEXT" (cdr (assoc 0 (entget nom-obj))))
(redraw nom-obj 3)
(setq n-ent (1+ n-ent))
)
(setq n (1+ n))
)
(prompt (strcat "\n*** "
(rtos (- num-obj n-ent))
" text(s) seleccionado(s) ***"
)
)
(if *escala*
()
(setq *escala* 1)
)
(initget 6)
(if (setq escala
(getreal (strcat "\nEnter scaling factor <"
(rtos *escala* 2 3)
">: "
)
)
)
()
(setq escala *escala*)
)
(setq *escala* escala)
(setq n 0)
(repeat num-obj
(setq nom-obj (ssname objetos n)
p-ins (cdr (assoc 10 (entget nom-obj)))
)
(if (= "TEXT" (cdr (assoc 0 (entget nom-obj))))
(command "_.scale" nom-obj "" p-ins escala)
)
(setq n (1+ n))
)
)
(prompt "\n*** no object selected ***")
)
)

(defun mtext-esc ()
(setq objetos (ssget))
(if (/= objetos nil)
(progn
(setq num-obj (sslength objetos)
n 0
n-ent 0
)
(prompt (strcat "\n*** "
(rtos num-obj)
" objects selected ***"
)
)
(repeat num-obj
(setq nom-obj (ssname objetos n))
(if (= "MTEXT" (cdr (assoc 0 (entget nom-obj))))
(redraw nom-obj 3)
(setq n-ent (1+ n-ent))
)
(setq n (1+ n))
)
(prompt (strcat "\n*** "
(rtos (- num-obj n-ent))
" text(s) m?ltiple(s) seleccionado(s) ***"
)
)
(if *escala*
()
(setq *escala* 1)
)
(initget 6)
(if (setq escala
(getreal (strcat "\nEnter scaling factor <"
(rtos *escala* 2 3)
">: "
)
)
)
()
(setq escala *escala*)
)
(setq *escala* escala)
(setq n 0)
(repeat num-obj
(setq nom-obj (ssname objetos n)
p-ins (cdr (assoc 10 (entget nom-obj)))
)
(if (= "MTEXT" (cdr (assoc 0 (entget nom-obj))))
(command "_.scale" nom-obj "" p-ins escala)
)
(setq n (1+ n))
)
)
(prompt "\n*** no object selected ***")
)
)

(defun Block-esc ()
(setq objetos (ssget))
(if (/= objetos nil)
(progn
(setq num-obj (sslength objetos)
n 0
n-ent 0
)
(prompt (strcat "\n*** "
(rtos num-obj)
" objects selected ***"
)
)
(repeat num-obj
(setq nom-obj (ssname objetos n))
(if (= "INSERT" (cdr (assoc 0 (entget nom-obj))))
(redraw nom-obj 3)
(setq n-ent (1+ n-ent))
)
(setq n (1+ n))
)
(prompt (strcat "\n*** "
(rtos (- num-obj n-ent))
" Block(s) seleccionado(s) ***"
)
)
(if *escala*
()
(setq *escala* 1)
)
(initget 6)
(if (setq escala
(getreal (strcat "\nEnter scaling factor <"
(rtos *escala* 2 3)
">: "
)
)
)
()
(setq escala *escala*)
)
(setq *escala* escala)
(setq n 0)
(repeat num-obj
(setq nom-obj (ssname objetos n)
p-ins (cdr (assoc 10 (entget nom-obj)))
)
(if (= "INSERT" (cdr (assoc 0 (entget nom-obj))))
(command "_.scale" nom-obj "" p-ins escala)
)
(setq n (1+ n))
)
)
(prompt "\n*** no object selected ***")
)
)

(defun mLine-esc ()
(setq objetos (ssget))
(if (/= objetos nil)
(progn
(setq num-obj (sslength objetos)
n 0
n-ent 0
)
(prompt (strcat "\n*** "
(rtos num-obj)
" objects selected ***"
)
)
(repeat num-obj
(setq nom-obj (ssname objetos n))
(if (= "MLINE" (cdr (assoc 0 (entget nom-obj))))
(redraw nom-obj 3)
(setq n-ent (1+ n-ent))
)
(setq n (1+ n))
)
(prompt (strcat "\n*** "
(rtos (- num-obj n-ent))
" l?nea(s) m?ltiple(s) seleccionada(s) ***"
)
)
(if *escala*
()
(setq *escala* 1)
)
(initget 6)
(if (setq escala
(getreal (strcat "\nEnter scaling factor <"
(rtos *escala* 2 3)
">: "
)
)
)
()
(setq escala *escala*)
)
(setq *escala* escala)
(setq n 0)
(repeat num-obj
(setq nom-obj (ssname objetos n)
p-ins (cdr (assoc 10 (entget nom-obj)))
)
(if (= "MLINE" (cdr (assoc 0 (entget nom-obj))))
(command "_.scale" nom-obj "" p-ins escala)
)
(setq n (1+ n))
)
)
(prompt "\n*** no object selected ***")
)
)

(defun spline-esc ()
(setq objetos (ssget))
(if (/= objetos nil)
(progn
(setq num-obj (sslength objetos)
n 0
n-ent 0
)
(prompt (strcat "\n*** "
(rtos num-obj)
" objects selected ***"
)
)
(repeat num-obj
(setq nom-obj (ssname objetos n))
(if (= "SPLINE" (cdr (assoc 0 (entget nom-obj))))
(redraw nom-obj 3)
(setq n-ent (1+ n-ent))
)
(setq n (1+ n))
)
(prompt (strcat "\n*** "
(rtos (- num-obj n-ent))
" spline(s) seleccionada(s) ***"
)
)
(if *escala*
()
(setq *escala* 1)
)
(initget 6)
(if (setq escala
(getreal (strcat "\nEnter scaling factor <"
(rtos *escala* 2 3)
">: "
)
)
)
()
(setq escala *escala*)
)
(setq *escala* escala)
(setq n 0)
(repeat num-obj
(setq nom-obj (ssname objetos n)
p-ins (cdr (assoc 10 (entget nom-obj)))
)
(if (= "SPLINE" (cdr (assoc 0 (entget nom-obj))))
(command "_.scale" nom-obj "" p-ins escala)
)
(setq n (1+ n))
)
)
(prompt "\n*** no object selected ***")
)
)

(defun elipse-esc ()
(setq objetos (ssget))
(if (/= objetos nil)
(progn
(setq num-obj (sslength objetos)
n 0
n-ent 0
)
(prompt (strcat "\n*** "
(rtos num-obj)
" objects selected ***"
)
)
(repeat num-obj
(setq nom-obj (ssname objetos n))
(if (= "ELLIPSE" (cdr (assoc 0 (entget nom-obj))))
(redraw nom-obj 3)
(setq n-ent (1+ n-ent))
)
(setq n (1+ n))
)
(prompt (strcat "\n*** "
(rtos (- num-obj n-ent))
" elipse(s) seleccionada(s) ***"
)
)
(if *escala*
()
(setq *escala* 1)
)
(initget 6)
(if (setq escala
(getreal (strcat "\nEnter scaling factor <"
(rtos *escala* 2 3)
">: "
)
)
)
()
(setq escala *escala*)
)
(setq *escala* escala)
(setq n 0)
(repeat num-obj
(setq nom-obj (ssname objetos n)
p-ins (cdr (assoc 10 (entget nom-obj)))
)
(if (= "ELLIPSE" (cdr (assoc 0 (entget nom-obj))))
(command "_.scale" nom-obj "" p-ins escala)
)
(setq n (1+ n))
)
)
(prompt "\n*** no object selected ***")
)
)

(defun hatch-esc ()
(setq objetos (ssget))
(if (/= objetos nil)
(progn
(setq num-obj (sslength objetos)
n 0
n-ent 0
)
(prompt (strcat "\n*** "
(rtos num-obj)
" objects selected ***"
)
)
(repeat num-obj
(setq nom-obj (ssname objetos n))
(if (= "HATCH" (cdr (assoc 0 (entget nom-obj))))
(redraw nom-obj 3)
(setq n-ent (1+ n-ent))
)
(setq n (1+ n))
)
(prompt (strcat "\n*** "
(rtos (- num-obj n-ent))
" sombreado(s) seleccionado(s) ***"
)
)
(if *escala*
()
(setq *escala* 1)
)
(initget 6)
(if (setq escala
(getreal (strcat "\nEnter scaling factor <"
(rtos *escala* 2 3)
">: "
)
)
)
()
(setq escala *escala*)
)
(setq *escala* escala)
(setq n 0)
(repeat num-obj
(setq nom-obj (ssname objetos n)
p-ins (cdr (assoc 10 (entget nom-obj)))
)
(if (= "HATCH" (cdr (assoc 0 (entget nom-obj))))
(command "_.scale" nom-obj "" p-ins escala)
)
(setq n (1+ n))
)
)
(prompt "\n*** no object selected ***")
)
)

(defun SOlid-esc ()
(setq objetos (ssget))
(if (/= objetos nil)
(progn
(setq num-obj (sslength objetos)
n 0
n-ent 0
)
(prompt (strcat "\n*** "
(rtos num-obj)
" objects selected ***"
)
)
(repeat num-obj
(setq nom-obj (ssname objetos n))
(if (= "SOLID" (cdr (assoc 0 (entget nom-obj))))
(redraw nom-obj 3)
(setq n-ent (1+ n-ent))
)
(setq n (1+ n))
)
(prompt (strcat "\n*** "
(rtos (- num-obj n-ent))
" solid(s) selected ***"
)
)
(if *escala*
()
(setq *escala* 1)
)
(initget 6)
(if (setq escala
(getreal (strcat "\nEnter scaling factor <"
(rtos *escala* 2 3)
">: "
)
)
)
()
(setq escala *escala*)
)
(setq *escala* escala)
(setq n 0)
(repeat num-obj
(setq nom-obj (ssname objetos n)
p-ins (cdr (assoc 10 (entget nom-obj)))
)
(if (= "SOLID" (cdr (assoc 0 (entget nom-obj))))
(command "_.scale" nom-obj "" p-ins escala)
)
(setq n (1+ n))
)
)
(prompt "\n*** no objects selected ***")
)
)

(defun c:mscale
(/ tipo-objeto objetos escala num-obj n nom-obj p-ins n-ent)
(setvar "cmdecho" 0)
(setq error_0 *error*
*error* errores
)
(command "_.undo" "_begin")
(escala-ins)
(command "_.undo" "_end")
(setq *error* error_0)
(setvar "cmdecho" 1)
(prin1)
)

(defun errores (mens)
(setq *error* error_0)
(if (= mens "quit / exit abort")
(prin1)
(princ (strcat "\nError: " mens " "))
)
(setq n 0)
(repeat num-obj
(setq nom-obj (ssname objetos n))
(redraw nom-obj 4)
(setq n (1+ n))
)
(command "_.undo" "_end")
(setvar "cmdecho" 1)
(prin1)
)

(prompt "\n*** new comand MSCALE defined ***")
(prin1)


[gorgeous]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor