Circle Command which is then scaled by 25.4 - Lisp

Circle Command which is then scaled by 25.4 - Lisp

dany_rochefort
Collaborator Collaborator
814 Views
5 Replies
Message 1 of 6

Circle Command which is then scaled by 25.4 - Lisp

dany_rochefort
Collaborator
Collaborator

Hi everyone,  i would like to make a very crude Lisp command whereby any circle i draw is then Scaled by 25.4. Using either the Circle Center as Basepoint or even Pause for user input to select Basepoint. Either Or would be fine...

 

I usually draft in millimeters, however if i need a 3.125'' dia imperial circle, i need to convert that value to MM, which is 79.375mm. And this ''conversion'' is what i want to bypass simply by inputing the imperial value for my circle in MM and then scaling by 25.4.  

 

I have this done so far... And it doenst work! Can someone please advise ?

Thanks

 

(defun c:CC1 (/)
(command "circle")
(command "scale" "last" "" pause "25.4" "") ; scales last circle by 25.4 using the same basepoint or pauses for user input of basepoint
(princ)
)  

 

 

0 Likes
Accepted solutions (2)
815 Views
5 Replies
Replies (5)
Message 2 of 6

devitg
Advisor
Advisor

erased

 

0 Likes
Message 3 of 6

Kent1Cooper
Consultant
Consultant
Accepted solution

@dany_rochefort wrote:
....

(command "circle")
(command "scale" "last" "" pause "25.4" "")

....


You haven't allowed for completing the drawing of the Circle.  That (command) function will be left at the prompt for the center [or options].  If you have a new-enough version to have the (command-s) function, you can just change that:

(command-s "_.circle")

 

and it will let you finish drawing it before going on to the Scale command.  [If that doesn't work, there's another way with a little more code.]

 

And in your Scale command, giving it the scale factor completes the command -- lose the final Enter "".

 

If you want it to use the center of the Circle as the base point instead of asking you for one, and if you always draw the Circle giving the center point, that becomes the "last" point in the process, so you can have it use that:

 

(command "_.scale" "_last" "" "@" "25.4")

Kent Cooper, AIA
Message 4 of 6

Sea-Haven
Mentor
Mentor
Accepted solution

My $0.05

 

(defun c:cmm ()
(command "Circle" (getpoint "pick point") (* (getreal "enter value") 25.4))
)
Message 5 of 6

dany_rochefort
Collaborator
Collaborator

Thank you very much for that bit of knowledge!  Everything works fine now 🙂

 

I will ba applying this knowledge to a whole series of geometric commands for Imperial / Metric conversion...

 

Best Regards !

0 Likes
Message 6 of 6

dany_rochefort
Collaborator
Collaborator
Thanks very much ! Best regards
0 Likes