jim78b Posted February 26, 2018 Share Posted February 26, 2018 (edited) hello i need a macro to add to a button for: make a line on layer "AM_4" with Amzigzag line and then when i finish to return on layer 0 and the color is by block is it possible? thanks ^C^C_clayer AM_4; ^C^C_color BYLAYER; ^C^C_linetype; Amzigzag;;^C^C_pline;; Edited February 26, 2018 by jim78b Quote Link to comment Share on other sites More sharing options...
jim78b Posted February 26, 2018 Author Share Posted February 26, 2018 I modified ^C^C_clayer AM_4;^C^C_color BYLAYER; ^C^C-linetype;S AMZIGZAG;; ^C^C_PLINE;\\;layerp; ^C^C_clayer 0;^C^C_color BYBLOCK;^C^C-linetype;S BYLAYER;; but is incorrect because permit to draw a single line and can not repeat the command Quote Link to comment Share on other sites More sharing options...
tombu Posted February 26, 2018 Share Posted February 26, 2018 Have you considered using lisp which could add both the layer and linetype if needed as well as being repeatable? If lisp not available it could be done in a Tool Palette. Quote Link to comment Share on other sites More sharing options...
jim78b Posted February 26, 2018 Author Share Posted February 26, 2018 Have you considered using lisp which could add both the layer and linetype if needed as well as being repeatable? If lisp not available it could be done in a Tool Palette. sorry but I'm not able. a macro will be better. can you test my macro please? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted February 27, 2018 Share Posted February 27, 2018 (edited) The macro can call a lisp ? (setvar 'clayer "AM_4") (command "_color" "BYLAYER" "-linetype" "s" "AMZIGZAG") (command "_pline") (while (= (getvar "cmdactive") 1 ) (command pause) ) (setvar 'clayer "0") Edited February 28, 2018 by BIGAL Quote Link to comment Share on other sites More sharing options...
jim78b Posted February 27, 2018 Author Share Posted February 27, 2018 The macro can call a lisp ? (setvar 'clayer "AM_4") (command "_color" "BYLAYER" "-linetype" "s" "AMZIGZAG" (command "_pline") (while (= (getvar "cmdactive") 1 ) (command pause) ) (setvar 'clayer "0") at the end i want return on layer "0" with color :byblock and linetype:bylayer hello my friend no is it possible only a macro? because i need it to associate to a button. thanks best regards Quote Link to comment Share on other sites More sharing options...
tombu Posted February 27, 2018 Share Posted February 27, 2018 at the end i want return on layer "0" with color :byblock and linetype:bylayer hello my friend no is it possible only a macro? because i need it to associate to a button. thanks best regards Unless you're running a LT version there's no reason you cannot use lisp in a macro. You may need to add a space or semicolon; at the end of the lisp for enter. Quote Link to comment Share on other sites More sharing options...
jim78b Posted February 27, 2018 Author Share Posted February 27, 2018 Unless you're running a LT version there's no reason you cannot use lisp in a macro. You may need to add a space or semicolon; at the end of the lisp for enter. Ok sorry have you right .I can use lisp.please can you put at the end of the code color by block and line bylayer i need this Thanks a lot Quote Link to comment Share on other sites More sharing options...
tombu Posted February 27, 2018 Share Posted February 27, 2018 Try: *^C^C(progn(setvar 'clayer "AM_4")(setvar 'cecolor "ByBlock")(setvar 'celtype "AMZIGZAG")(command "-linetype" "s" "AMZIGZAG" "_pline")(while (= (getvar "cmdactive") 1 ) (command pause))(setvar 'clayer "0")(setvar 'cecolor "ByLayer")(setvar 'celtype "ByLayer")(princ)) https://knowledge.autodesk.com/support/autocad/troubleshooting/caas/sfdcarticles/sfdcarticles/Repeating-commands-automatically.html Repeating commands automatically Adding an asterisk (*) before the command definition (*^C^C_Circle) will cause the command to repeat until you select another command or press the ESC key. Quote Link to comment Share on other sites More sharing options...
jim78b Posted February 27, 2018 Author Share Posted February 27, 2018 Try:*^C^C(progn(setvar 'clayer "AM_4")(setvar 'cecolor "ByBlock")(setvar 'celtype "AMZIGZAG")(command "-linetype" "s" "AMZIGZAG" "_pline")(while (= (getvar "cmdactive") 1 ) (command pause))(setvar 'clayer "0")(setvar 'cecolor "ByLayer")(setvar 'celtype "ByLayer")(princ)) https://knowledge.autodesk.com/support/autocad/troubleshooting/caas/sfdcarticles/sfdcarticles/Repeating-commands-automatically.html Repeating commands automatically Adding an asterisk (*) before the command definition (*^C^C_Circle) will cause the command to repeat until you select another command or press the ESC key. give me invalid function Quote Link to comment Share on other sites More sharing options...
tombu Posted February 27, 2018 Share Posted February 27, 2018 Can you copy and paste exactly what it says? Are you sure you're not running a LT version of Mechanical 2013? Quote Link to comment Share on other sites More sharing options...
jim78b Posted February 27, 2018 Author Share Posted February 27, 2018 give me invalid function I delete button but I remember it wrote invalid ...function and last word was pline.but can i past the code in the command bar? No i am using mechanical Quote Link to comment Share on other sites More sharing options...
jim78b Posted February 27, 2018 Author Share Posted February 27, 2018 Command: *^C^C(progn(setvar Unknown command "*^C^C(PROGN(SETVAR". Press F1 for help. Command: 'clayer Enter new value for CLAYER : "AM_4")(setvar 'cecolor "ByBlock")(setvar 'celtype "AMZIGZAG")(command "-linetype" "s" "AMZIGZAG" "_pline")(while (= (getvar "cmdactive") 1 ) (command pause))(setvar 'clayer "0")(setvar 'cecolor "ByLayer")(setvar 'celtype "ByLayer")(princ)) Cannot set CLAYER to that value. *Invalid* Quote Link to comment Share on other sites More sharing options...
BIGAL Posted February 28, 2018 Share Posted February 28, 2018 Oops missed a bracket after amzigzag anyway the 1 liner ^c^c^p(setvar 'clayer "AM_4")(command "_color" "BYLAYER" "-linetype" "s" "AMZIGZAG")(command "_pline")(while (= (getvar "cmdactive") 1 ) (command pause))(setvar 'clayer "0")(command "_color" "BYBLOCK" "-linetype" "s" "BYLAYER") Quote Link to comment Share on other sites More sharing options...
jim78b Posted February 28, 2018 Author Share Posted February 28, 2018 Oops missed a bracket after amzigzag anyway the 1 liner ^c^c^p(setvar 'clayer "AM_4")(command "_color" "BYLAYER" "-linetype" "s" "AMZIGZAG")(command "_pline")(while (= (getvar "cmdactive") 1 ) (command pause))(setvar 'clayer "0")(command "_color" "BYBLOCK" "-linetype" "s" "BYLAYER") Ok thanks Now should work Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.