Grrr Posted April 18, 2014 Share Posted April 18, 2014 (edited) Hi everyone! Could somebody modify this lisp for me so I could repeat the command multiple times? This code is not mine and I don't know the author. I have base knowledge about lisp and I've tried something to make it work using MULTIPLE command or WHILE function - but I'm not good at coding (when I try to run MULTIPLE command from lisp - it does not recognize my lisp command "BA" - I don't know why, and I have no idea how to set this code up with WHILE function) Thanks. ;-------------------------------------------------------------------------- ;The AutoCAD built-in Break at Point does not work well because of AutoSnap. AutoSnap has to be temporarily turned off (important!!). I've written the following Lisp which allows user to select and object, and followed by picking a break point, command will be sent out with AutoSnap turned off temporarily. (defun c:ba (/ obj pt1 osmode cmdecho) (setq obj (car (entsel))) (setq pt1 (getpoint "\nSpecify break point: ")) (setq osmode (getvar "osmode")) (setq cmdecho (getvar "cmdecho")) (setvar "osmode" 0) (setvar "cmdecho" 0) (command "break" obj pt1 pt1) (setvar "osmode" osmode) (setvar "cmdecho" cmdecho) (princ) ) ;------------------------------------------------------------------------- Edited April 21, 2014 by SLW210 Quote Link to comment Share on other sites More sharing options...
ymg3 Posted April 18, 2014 Share Posted April 18, 2014 (defun c:ba (/ obj pt1 osmode cmdecho) (setq osmode (getvar "osmode")) (setq cmdecho (getvar "cmdecho")) (setvar "osmode" 512) ; nearest (setvar "cmdecho" 0) (while (setq pt1 (getpoint "\nSpecify break point: ")) (command "break" pt1 pt1 pt1) ) (setvar "osmode" osmode) (setvar "cmdecho" cmdecho) (princ) ) Set your osmode to 512 which is nearest. Your point can be used to select the entity. ymg Quote Link to comment Share on other sites More sharing options...
MSasu Posted April 18, 2014 Share Posted April 18, 2014 A quick-and-dirty adjustment: (defun c:ba(/ obj pt1 osmode cmdecho) (setq osmode (getvar "osmode")) (setq cmdecho (getvar "cmdecho")) (setq obj (car (entsel))) (while (and (setq pt1 (getpoint "\nSpecify break point: ")) (setq obj (ssget pt1))) (setq obj (ssname obj 0)) (setvar "osmode" 0) (setvar "cmdecho" 0) (command "break" obj pt1 pt1) (setvar "osmode" osmode) ) (setvar "cmdecho" cmdecho) (princ) ) Please edit your post and add required code tags. Quote Link to comment Share on other sites More sharing options...
Grrr Posted April 18, 2014 Author Share Posted April 18, 2014 Thank you so much, guys! it works perfectly with osmode set to 544 (intersection and nearest) Quote Link to comment Share on other sites More sharing options...
SLW210 Posted April 21, 2014 Share Posted April 21, 2014 Grrr, Please read the Code Posting Guidelines and use Code Tags for your Code in the future. 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.