Discus84 Posted January 16 Posted January 16 (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 January 17 by SLW210 Added Code Tags! Quote
BIGAL Posted January 16 Posted January 16 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 January 16 Posted January 16 (edited) Helping out SLW210 @Discus84 Use <> when posting code Edited January 17 by mhupp Quote
Discus84 Posted January 17 Author Posted January 17 (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 January 17 Posted January 17 (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 January 17 Posted January 17 (edited) You might be interested in the program I posted here. Edited January 17 by Lee Mac Quote
BIGAL Posted January 17 Posted January 17 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.lspUnavailable Quote
Lee Mac Posted January 18 Posted January 18 On 1/17/2025 at 12:46 PM, Lee Mac said: You might be interested in the program I posted here. I've now updated this program and added it to my site here. 1 Quote
marko_ribar Posted January 18 Posted January 18 @Lee Mac (c:x) will override built-in pgp setting for EXPLODE command... If you are still present, I suggest that instead of "X" you use something like (c:xx)... I believe this makes some sense... Quote
Lee Mac Posted January 18 Posted January 18 (edited) On 1/18/2025 at 6:17 PM, marko_ribar said: @Lee Mac (c:x) will override built-in pgp setting for EXPLODE command... If you are still present, I suggest that instead of "X" you use something like (c:xx)... I believe this makes some sense... I use xlines more often than explode, so this works for me But perhaps a two character syntax for all commands would be more consistent - I'll tweak it. Edited January 18 by Lee Mac Quote
Discus84 Posted January 20 Author Posted January 20 Quote I use xlines more often than explode, so this works for me Same here. Incidentally , another topic comes up and I wonder what is the procedure for checking frequency of commands used over a period of time. This would be helpful in organizing a concise set of most frequent commands(single character) and a convention for the other, less used ones (two character). Quote
Lee Mac Posted January 20 Posted January 20 On 1/20/2025 at 6:18 PM, Discus84 said: Same here. Incidentally , another topic comes up and I wonder what is the procedure for checking frequency of commands used over a period of time. This would be helpful in organizing a concise set of most frequent commands(single character) and a convention for the other, less used ones (two character). This old program could potentially be adapted to apply to all commands and aggregrate the counts independent of the drawings in which they were used. Quote
BIGAL Posted January 21 Posted January 21 (edited) Another logger. I have used this to log multiple users and write a file for each user. You can (getvar 'username) so have a cond where the name is compared to the output file name. I removed some of the details to make reports shorter. Productivity_Analysis_Tool.lspFetching info... Edited January 21 by BIGAL Quote
Discus84 Posted January 29 Author Posted January 29 Lots of good stuff, thanks! One more thing related here : 1) I would like to be able to exclude the xline from stretch (stretch affects the objects in drawing , not xline) 2) Is there a way to have an xline that is not affected by stretch but affected by erase, copy etc Objective would be : -creating an xline (moving it to help layer) -returning to drawing layer -stretching objects to reference lines without moving the reference lines. -deleting xlines 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.