nj1105nj Posted February 11, 2020 Posted February 11, 2020 This is just a lisp to draw a 6' circle on our no plot layer, set the line weight, and change the color to magenta, and finally change back all the set variables (princ) (defun C:mrs (progn (setvar "clayer" nplt) (setvar "celweight" -2) (setvar "cecolor" magenta) (command "circle" "6") (setvar "clayer" 0) (setvar "cecolor" bylayer) (setvar "celweight" bylayer) ) (princ) ) Quote
Tharwat Posted February 11, 2020 Posted February 11, 2020 You set the current layer with nil variable but if that is the name of the layer then you need to wrap it with two strings all around. eg: "nplt" Quote
nj1105nj Posted February 11, 2020 Author Posted February 11, 2020 31 minutes ago, Tharwat said: You set the current layer with nil variable but if that is the name of the layer then you need to wrap it with two strings all around. eg: "nplt" so it should be like this? It's still saying the Clayer Nil was a rejected variable (defun C:mrs (progn (setvar "clayer" "nplt") (setvar "celweight" -2) (setvar "cecolor" magenta) (command "circle" "6") (setvar "clayer" "0") (setvar "cecolor" bylayer) (setvar "celweight" bylayer) ) (princ)) Quote
Tharwat Posted February 11, 2020 Posted February 11, 2020 Is this what you are after? (defun c:mrs nil (if (tblsearch "LAYER" "nplt") (progn (setvar "clayer" "nplt") (setvar "celweight" -2) (setvar "cecolor" "6") (command "circle" "6" "\\") (setvar "clayer" "0") (setvar "cecolor" "bylayer") (setvar "celweight" -1) ) (alert "Layer name <nplt> was not found <!>") ) (princ) ) 1 Quote
nj1105nj Posted February 11, 2020 Author Posted February 11, 2020 21 minutes ago, Tharwat said: Is this what you are after? (defun c:mrs nil (if (tblsearch "LAYER" "nplt") (progn (setvar "clayer" "nplt") (setvar "celweight" -2) (setvar "cecolor" "6") (command "circle" "6" "\\") (setvar "clayer" "0") (setvar "cecolor" "bylayer") (setvar "celweight" -1) ) (alert "Layer name <nplt> was not found <!>") ) (princ) ) That seems to have done the trick, thank you! Quote
Tharwat Posted February 11, 2020 Posted February 11, 2020 You need to disable the OSNAP system variable to ensure is that the center point of the circle would be positioned in the right destination as follows. (command "circle" "_none" "6" "\\") Quote
Roy_043 Posted February 11, 2020 Posted February 11, 2020 (edited) Hmm, have the prompts of the circle command really been changed around in AutoCAD? Edited February 12, 2020 by Roy_043 Typo. Quote
BIGAL Posted February 12, 2020 Posted February 12, 2020 (edited) Note also (setvar "cecolor" magenta) magenta would be expected to be a lisp value called Magenta, hence Tharwat's code using a string number. Edited February 12, 2020 by BIGAL Quote
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.