Scaling macro help

Scaling macro help

Anonymous
Not applicable
1,608 Views
4 Replies
Message 1 of 5

Scaling macro help

Anonymous
Not applicable

Hi. I'd like some help with a scaling macro. We get dxf and dwg files from customers that we typically have to scale from metric to imperial so we can send them to our CNC plasma cutter. I've created and been using a scaling macro, but I've been having some trouble with window selecting

 

The macro: ^C^Cscale;\0.03937007874015748031496062992126;

 

The way it works now: I select everything I want to scale before I click the custom macro button.

 

Is there a way this macro can be written so I can click the button first, then click a polyline or window select multiple objects.

 

If I could get the macro so that it works both ways, either selecting the objects first or clicking the button first, that would be great. If not, I'll just keep doing it the way I have been

 

Screencast attached. I don't have a mic, so no audio

 

0 Likes
Accepted solutions (1)
1,609 Views
4 Replies
Replies (4)
Message 2 of 5

Kent1Cooper
Consultant
Consultant

I'm not sure that can be done purely as a command macro.  At least I haven't found a viable way to work in a test on whether there's a prior selection and to get one if there isn't, that works in macro syntax.  Do you have full AutoCAD [not LT]?  If so, it could be done with a defined command in AutoLisp, and the macro button would call that command.

 

By the way, your screencast didn't attach.

 

[And that's a ludicrously enormous number of decimal places in your scale factor.  AutoCAD can only work with 16 significant figures, but even that must be more than would make any discernible difference to what you're doing.]

Kent Cooper, AIA
0 Likes
Message 3 of 5

Anonymous
Not applicable
@Kent1Cooperwrote:

I'm not sure that can be done purely as a command macro.  At least I haven't found a viable way to work in a test on whether there's a prior selection and to get one if there isn't, that works in macro syntax.  Do you have full AutoCAD [not LT]?  If so, it could be done with a defined command in AutoLisp, and the macro button would call that command.

 

Thanks. I had a feeling that I wouldn't be able to do anything to fancy with macros.  I have AutoCAD 2019.

 


 [And that's a ludicrously enormous number of decimal places in your scale factor.  AutoCAD can only work with 16 significant figures, but even that must be more than would make any discernible difference to what you're doing.]


I know it's way to many. I used the windows calculator to get 1/25.4 and just copied and pasted the result in my macro and didn't bother to trim down the number.


0 Likes
Message 4 of 5

Kent1Cooper
Consultant
Consultant
Accepted solution

@Anonymous wrote:
....  I have AutoCAD 2019.

Then you can use an AutoLisp routine, such as this:

(defun C:M2I (/ ss) ; = Metric {to} Imperial
  (command "_.scale" (cond ((ssget "_I")) ((ssget))) "" pause (/ 1 25.4))
)

With that loaded, put just plain M2I into a macro button.

Kent Cooper, AIA
0 Likes
Message 5 of 5

Anonymous
Not applicable

Thank you for all your help. This is exactly what I was looking for.

0 Likes