Discus84 Posted Thursday at 03:07 PM Posted Thursday at 03:07 PM (edited) Hi, (defun c:x () (setq cl (getvar "clayer")) (command "-layer" "s" "help" "") (command "xline") (setvar "clayer" cl) );defun Why does the he layer remain the same while drawing? How to modify it to draw a horizontal (x) or a vertical (xx)? The basic idea is to invoke x (or xx) have it change layer to help, draw an xline and then go back to previous layer. Thanks! Edited 14 hours ago by SLW210 Added Code Tags! Quote
BIGAL Posted Thursday at 10:23 PM Posted Thursday at 10:23 PM A few comments X is the shortcut for Explode I always type a shortcut like this to see if it exists. Use say "XX" & "YY". I would use '"Layer" "M" as it makes the layer if it does not exist, also sets it current. Use Comand-s for the xline it will ask for more details or just make your command correct by completing the requests when running XLINE. (command "xline" "H" (getpoint "\nPick point ") "") (command "xline" "V" (getpoint "\nPick point ") "") When making a lisp always look at the manual version, write the prompts down on a bit of paper. 1 Quote
mhupp Posted Thursday at 11:47 PM Posted Thursday at 11:47 PM (edited) Helping out SLW210 @Discus84 Use <> when posting code Edited 22 hours ago by mhupp Quote
Discus84 Posted yesterday at 01:51 AM Author Posted yesterday at 01:51 AM (defun C:x (/ pt) (setq cl (getvar "clayer")) (command "-layer" "s" "help" "") (setq pt (getpoint)) (command "_.Xline" "_ver" "_none" pt "") (setvar "clayer" cl) (princ) ) (defun C:xx (/ pt) (setq cl (getvar "clayer")) (command "-layer" "s" "help" "") (setq pt (getpoint)) (command "_.Xline" "_hor" "_none" pt "") (setvar "clayer" cl) (princ) ) This works. How to combine it into one function to skip all the double code? Quote
LanloyLisp Posted 17 hours ago Posted 17 hours ago (defun c:xh (/ bp) (prompt "\nXLINE HORIZONTAL") (setq bp (getpoint "\nSpecify basepoint: ")) (entmake (list (cons 0 "XLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbXline") (cons 8 "help");; update your layer here (cons 10 (trans bp 1 0)) (cons 11 (getvar 'ucsxdir)) ) ) (princ) ) (defun c:xv (/ bp) (prompt "\nXLINE VERTICAL") (setq bp (getpoint "\nSpecify basepoint: ")) (entmake (list (cons 0 "XLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbXline") (cons 8 "help");; update your layer here (cons 10 (trans bp 1 0)) (cons 11 (getvar 'ucsydir)) ) ) (princ) ) here you go without using the "command" function. Quote
Lee Mac Posted 13 hours ago Posted 13 hours ago (edited) You might be interested in the program I posted here. Edited 13 hours ago by Lee Mac Quote
BIGAL Posted 4 hours ago Posted 4 hours ago A couple of comments. Like Lee's solution can do a front end using Multi radio buttons.lsp so pick direction. Example code is in top of the attached. You can make an extra defun that holds the entmake code as the only difference in the code by Lanloylisp is to pass the UCSXDIR or YDIR, (cons 11 ucsdirXY) so set UCSDIRXY in the XH & XV. A good idea defun name, XV & XH & XA. Remember X is shortcut for EXPLODE. Multi radio buttons.lsp 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.