PDA

View Full Version : auto-scaling?


jkleinowski
2005-06-01, 10:23 PM
Hello all,
i am trying to write a code that when run would ask the user to select an object and a reference point then scale the object down by 1/96th on that point and then move onto the next object. i know its a weird one but its a small step for a system i have in drawing risers and i have to do it over 100 times in each job.

can anyone help me with it? here is what i have, i cant figure out why it isnt working.

(defun-q ScaleDown ()
;get object points
(setq ent1 (car (entsel "\nSelect object: ")))

(setq pnt1 (getpoint "\nselect endpoint: "))
;execute command
(command "scale" ent1 pnt1 "1/96")
)

RobertB
2005-06-01, 11:11 PM
Looks to me like you are attempting to pass the point during the "Select objects" prompt. (Missing an enter.)

kennet.sjoberg
2005-06-02, 12:05 AM
Hi jkleinowski !

(defun c:SD (/ ent1 pnt1) ;; declare ent1 and pnt1 as local variables
(if ;; simple error handler that check-
(and ;; if you select and pick a point
(setq ent1 (car (entsel "\nSelect object: "))) ;; get object
(setq pnt1 (getpoint "\nselect endpoint: ")) ;; get point
) ; end and
(command "._scale" ent1 "" pnt1 "1/96" ) ;; execute, if the if statement is true
(princ "You must pick an object and a point !" ) ;; if then
) ; end if
(princ) ; silent end
) ; end func

: ) Happy Computing !

kennet

fixo
2005-06-02, 07:45 AM
Maybe this helps you too...

(defun c:SD (/ ent1 pnt1)
(while
(setq ent1 (car (entsel "\nSelect object: ")))
(if ent1
(progn
(setq pnt1 (getpoint "\nSelect endpoint: "))
(command "._scale" ent1 "" pnt1 "1/96")
)
(princ "You missed. Please click right button and try again!")
)
)
(princ)
)

Thanx