Jump to content

macro linetype


jim78b

Recommended Posts

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 by jim78b
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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 by BIGAL
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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*

Link to comment
Share on other sites

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")

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...