Scale to a reference value

Scale to a reference value

murmanator
Advocate Advocate
1,572 Views
2 Replies
Message 1 of 3

Scale to a reference value

murmanator
Advocate
Advocate

Hello, I have this program which does a scale function by picking two reference points in the object being scaled, then you pick a new reference point and it scales the object to that. I would like to modify this so that after you pick the two reference points, you then enter a new value instead of a new reference point. I figure this involves changing the (setq Pt4 (getpoint Pt2 "\n Select new reference point: ")) line but Im not sure how. Any help is appreciated. 

 

(defun c:ScaleRef (/ ss Pt1 Pt2 Pt3 Pt4)
(if
(and
(setq ss (ssget))
(setq Pt1 (getpoint "\n Select base point: "))
(setq Pt2 (getpoint "\n Select first reference point: "))
(setq Pt3 (getpoint Pt2 "\n Select second reference point: "))
(setq Pt4 (getpoint Pt2 "\n Select new reference point: "))
)
(command "_.scale" ss "" Pt1 "_reference" Pt2 Pt3 Pt4)
)
(princ)
)

0 Likes
Accepted solutions (1)
1,573 Views
2 Replies
Replies (2)
Message 2 of 3

Kent1Cooper
Consultant
Consultant
Accepted solution

@murmanator wrote:

.... I would like to modify this so that after you pick the two reference points, you then enter a new value instead of a new reference point. ....


 

One way:  simply omit the Pt4 variable entirely, and change the command to:

  (command "_.scale" ss "" Pt1 "_reference" Pt2 Pt3 pause)

 

at which the User will have the option to either type in a value or  pick a point.

 

[But I do kind of wonder....  The whole thing, whether the original or this modification, does only one little thing for you compared to just using the basic SCALE command itself -- it spares you the trouble of typing in or picking on the Reference option.  Everything else you still have to do just as in the ordinary command.  And without the modification, it has the drawback  that you don't get to see the stuff Scaling dynamically as you go for the new distance, the way you do in ordinary SCALE.  Maybe you can do without it...?]

Kent Cooper, AIA
0 Likes
Message 3 of 3

murmanator
Advocate
Advocate

Thanks Kent, this works well. Yes, I realize this is basically the same as the standard SCALE command. I am trying to simplify the standard command as much as possible for some beginner users. In this case the LISP function will serve us well. Thanks again

0 Likes