Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Macro for scales

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
M.Lindell
731 Views, 2 Replies

Macro for scales

I'm quite new to macros and LISP so I could use some help.

I made some simple macros to quickly change cannoscale and to reset default scale list (I gave these a keyboard shortcut too).
  Here's what I have now (hope someone finds them useful):
^C^C-scalelistedit;R;Y;^C^C→ Reset default scale list
^C^Ccannoscale;1:\^C^C_regenall;→ Change cannoscale and regen. Type in eg. "50" and hit enter ("1:" is there already typed). (works only for existing scales)
^C^Ccannoscale;"1:10";_regenall;→ Change cannoscale to 1:10 and regen.
I added the "regenall" so linetypes are automatically scaled (I have MSLTSCALE, PSLTSCALE and LTSCALE all set to "1")

I would like to have one more macro to add new scales quickly.
Here I need some help:
^C^C-scalelistedit;A;1:\→ Here I type eg. "50" and hit enter ("1:" is there already typed in automaticly)
Next step is to enter scale ratio WHICH IS THE SAME as the name I just typed in. So is there some way to add the "name" here automatically and finish the macro with ;^C^C

Is it possible to make with macro or do I have to use LISP?
(tips where I should start with learning LISP? I'm new to all kinds of coding)

Labels (2)
2 REPLIES 2
Message 2 of 3
ВeekeeCZ
in reply to: M.Lindell

Don't think it could be made by a macro. But it's quite simple by LISP.

 

(defun c:ScaleListAdd (/ s)

  (if (and (setq s (getint "\nNew scale 1:"))
	   (setq s (strcat "1:" (itoa s))))
    (command "_.-scalelistedit" "_add" s s "_exit"))
  (princ)
  )

HERE is how to load it. Then a macro would be just the name ^c^cScaleListAdd 

 

 

Or use this if you want to put it directly to tool palette macro.

((lambda (/ s) (if (and (setq s (getint "New scale 1:")) (setq s (strcat "1:" (itoa s)))) (command "_.-scalelistedit" "_add" s s "_exit")) (princ)))

 

Tip for your starting point: HERE 

Message 3 of 3
M.Lindell
in reply to: ВeekeeCZ

Thank you very much @ВeekeeCZ !

I modified it a little. Added "^P" to make it neat and these two: (command "_.cannoscale" s) (command "_regenall").
It sets the new scale current and regens.
Now it's perfect for me 😁 Thanks for your help!

I put it directly in tool palette macro.

^P((lambda (/ s) (if (and (setq s (getint "New scale 1:")) (setq s (strcat "1:" (itoa s)))) (command "_.-scalelistedit" "_add" s s "_exit")) (command "_.cannoscale" s) (command "_regenall") (princ)))

 
Thanks for the tips too.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Customer Advisory Groups


Autodesk Design & Make Report