vernonlee Posted June 23, 2015 Share Posted June 23, 2015 What is the code that I can add to allow the snap to be automatically INT & revert back to previous snap profile? This is a LISP concern. It is to break lines & it does so continuously breaking lines until the command is canceled. Thanks (defun c:BB ( / oldos ent1 p1) (setq oldos (getvar "osmode")) (while (setq ent1 (entsel "\nSelect object to break... ")) (initget 1) (setq p1 (getpoint "\nPoint at which to break... ")) (setvar "osmode" 0) (command "_.BREAK" ent1 "_f" p1 "@" "") (setvar "osmode" oldos)) (princ "\nBreak at Done") (princ)) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 23, 2015 Share Posted June 23, 2015 If you set via osnaps what you want then type osmode a number will appear that is current snap setting osmode 32 is INT Quote Link to comment Share on other sites More sharing options...
vernonlee Posted June 23, 2015 Author Share Posted June 23, 2015 If you set via osnaps what you want then type osmode a number will appear that is current snap setting osmode 32 is INT Ok. But Which part of the code do i insert in 32? I tried (defun c:BB ( / oldos ent1 p1) (setq oldos (getvar "osmode" [color=red][b]32[/b][/color])) (while (setq ent1 (entsel "\nSelect object to break... ")) (initget 1) (setq p1 (getpoint "\nPoint at which to break... ")) (setvar "osmode" 0) (command "_.BREAK" ent1 "_f" p1 "@" "") (setvar "osmode" oldos)) (princ "\nBreak at Done") (princ)) But got this error Command: bb ; error: too many arguments I tried (defun c:BB ( / oldos ent1 p1) (setq oldos (getvar "osmode"[color=red][/color])) (while (setq ent1 (entsel "\nSelect object to break... ")) (initget 1) (setq p1 (getpoint "\nPoint at which to break... ")) (setvar "osmode" [color=red][b]32[/b][/color]) (command "_.BREAK" ent1 "_f" p1 "@" "") (setvar "osmode" oldos)) (princ "\nBreak at Done") (princ)) The command can continue but INT snap do not appear. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 23, 2015 Share Posted June 23, 2015 Try this . (defun c:bb (/ oldos ent1 p1) (setq oldos (getvar "osmode")) (setvar "osmode" 32) (while (and (setq ent1 (entsel "\nSelect object to break... ")) (not (initget 1)) (setq p1 (getpoint "\nPoint at which to break... ")) ) (command "_.BREAK" ent1 "_f" p1 "@" "") ) (setvar "osmode" oldos) (princ "\nBreak at Done") (princ) ) Quote Link to comment Share on other sites More sharing options...
tombu Posted June 23, 2015 Share Posted June 23, 2015 As an alternative you could use the macro *^C^C_break \_f _int \@ or *^C^C_break \_f _appint \@ and use Esc when you're done. Quote Link to comment Share on other sites More sharing options...
tombu Posted June 23, 2015 Share Posted June 23, 2015 Even better with *^C^Cbreak _appint \@ all you need is a single pick on the line you want to break near an intersection. Quote Link to comment Share on other sites More sharing options...
vernonlee Posted June 24, 2015 Author Share Posted June 24, 2015 Try this[/code] Thanks Tharwat. It worked. Quote Link to comment Share on other sites More sharing options...
vernonlee Posted June 24, 2015 Author Share Posted June 24, 2015 Even better with *^C^Cbreak _appint \@ all you need is a single pick on the line you want to break near an intersection. Interesting. I did not think macro could do this. I would use it but when i tested it,carn't really explain it well, but on breaking multiple line seems not smooth, in particular selecting the line that was previously selected as a breaking line reference. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 25, 2015 Share Posted June 25, 2015 Vernonlee read the GET as a retrieve a value and the Set as to replace a value, look at Vlisp vla-get-layer, vla-put-layer Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 25, 2015 Share Posted June 25, 2015 Thanks Tharwat. It worked. You're welcome . 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.