vernonlee Posted March 30, 2015 Share Posted March 30, 2015 Currently using the below LISP to break lines. The selection of lines is picking 1 line at a time. As some polylines are overlapped, i may need to repeat the command 2 or 3 times. If someone could advise on how to include a code to select the lines through a cross window selection that would be great time saver (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)) To clarify further I also tried Charles Alan Butler LISP, but there were some issues:- 1) I can select line to be break but my breaking object is an xref, therefore it cannot be selected. 2) i bind the xref into the drawing so now can be selected but the lines to break & breaking object criss cross each other & break point is only at selected points of the lines. 3) Since it is only at selected points, i also try to instead draw a line connecting each desired break point. So then this line can be now a breaking object. But now it take me twice as long to break this lines since i have to draw additional lines for very break point (i time myself) So would appreciate if someone can help me to amend the LISP to allow cross window selection. Thanks Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted March 30, 2015 Share Posted March 30, 2015 did you try command: ncopy before runing lisp? Quote Link to comment Share on other sites More sharing options...
vernonlee Posted March 30, 2015 Author Share Posted March 30, 2015 did you try command: ncopy before runing lisp? If you mean to run ncopy & select the desired lines from the xref as breaking objects before running the Charles Alan Butler LISP command, it does not work. That would not help as the breaking object criss cross with the lines that need to break. And to clarify further, if you mean to use the posted break LISP after ncopy, that is unnecessary steps since I can select "point" to break on the xref object. So The main issue is the first posted BREAK lisp cannot select multiple lines that I want to break. And although Charles Alan Butler LISP can select multiple lines that I want to break, it does not work on "points" as a break but instead on whole lines as a break Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted March 30, 2015 Share Posted March 30, 2015 (edited) Maybe, untested... (defun c:BB ( / *error* el ss p i ent ) (vl-load-com) (defun *error* ( msg ) (vla-endundomark (vla-get-activedocument (vlax-get-acad-object))) (if msg (prompt msg)) (princ) ) (vla-startundomark (vla-get-activedocument (vlax-get-acad-object))) (setq el (entlast)) (if (null el) (progn (alert "DWG has no entities... Add some curve entities and restart routine...") (exit) ) ) (prompt "\nSelect curve entities you want to apply break at point to...") (setq ss (ssget "_:L")) (while (not ss) (if (and ss (not (vl-every '(lambda ( x ) (eq x t)) (mapcar '(lambda ( x ) (not (vl-catch-all-error-p (vl-catch-all-apply 'vlax-curve-getstartparam (list x))))) (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))))) (progn (prompt "\nSome of selected entities doesn't belong to curves... Try selecting exlusively curve entities again...") (setq ss (ssget "_:L")) ) (if (not ss) (progn (prompt "\nEmpty sel.set... Try selecting curve entities again...") (setq ss (ssget "_:L")) ) ) ) ) (setq p t) (while p (setq p (getpoint "\nPick or specify point at which you want to break multiple curve entities - ENTER to finish : ")) (if p (repeat (setq i (sslength ss)) (setq ent (ssname ss (setq i (1- i)))) (if (vlax-curve-getparamatpoint ent p) (command "_.BREAK" ent "_non" p "_non" p)) (if (not (eq el (entlast))) (ssadd (entlast) ss)) ) ) ) (*error* nil) ) M.R. Edited March 31, 2015 by marko_ribar code updated... Quote Link to comment Share on other sites More sharing options...
vernonlee Posted March 30, 2015 Author Share Posted March 30, 2015 Thanks marko. Will test it immediately when I reach office. Quote Link to comment Share on other sites More sharing options...
vernonlee Posted March 31, 2015 Author Share Posted March 31, 2015 Hi marko. Tested & does not seem to work. 1)when i select 2 lines, both seems highlighted. 2)But when i click the break point (Base on only 1 break point) it gave me an error Invalid point.Function cancelled 3) So i continue clicking the same break point (it seem to ask for 2 point regardless of how many lines I selected) 4) Command ends. Only 1 line is broken. Command: BBNSelect curve entities you want to apply break at point to... Select objects: Specify opposite corner: 1 found Select objects: Specify opposite corner: 1 found, 2 total Select objects: Pick or specify point at which you want to break multiple curve entities - ENTER to finish : _.BREAK Select object: Specify first break point: _F Invalid point. Function cancelled Specify first break point: Specify second break point: Point or option keyword required. Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted March 31, 2015 Share Posted March 31, 2015 Code updated, retest it... M.R. Quote Link to comment Share on other sites More sharing options...
vernonlee Posted March 31, 2015 Author Share Posted March 31, 2015 Just tested it marko. No error but lines did not break. Command: BBBSelect curve entities you want to apply break at point to... Select objects: Specify opposite corner: 2 found Select objects: Pick or specify point at which you want to break multiple curve entities - ENTER to finish : Pick or specify point at which you want to break multiple curve entities - ENTER to finish : Command: Command: *Cancel* Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted March 31, 2015 Share Posted March 31, 2015 Have you turned OSNAP on... You should pick "int" between curves or "nea" on just single curve... I had no problems with A2014... Regards, try to debug - I think that there may be differences in line (command "_.BREAK"...), but it's just a hunch... Quote Link to comment Share on other sites More sharing options...
vernonlee Posted March 31, 2015 Author Share Posted March 31, 2015 (edited) Hi marko. Yes the osnap was turn on. i also did base on INT for the break point but still no avail. I am not sure what is wrong. edit I tried on autocad architecture 2014 & it works. But why my office's AutoCAD 2014 do not? Edited March 31, 2015 by vernonlee Quote Link to comment Share on other sites More sharing options...
vernonlee Posted March 31, 2015 Author Share Posted March 31, 2015 Regards, try to debug - I think that there may be differences in line (command "_.BREAK"...), but it's just a hunch... How do i go about debugging? edit Do you mean change "_.BREAK" to "BREAK"? But weird, the original LISP is also using "_.BREAK". I will try this in the office tomorrow. Thanks Quote Link to comment Share on other sites More sharing options...
vernonlee Posted April 1, 2015 Author Share Posted April 1, 2015 How do i go about debugging? edit Do you mean change "_.BREAK" to "BREAK"? But weird, the original LISP is also using "_.BREAK". I will try this in the office tomorrow. Thanks changing the code from "_.BREAK" to "BREAK" did not help. Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted April 1, 2015 Share Posted April 1, 2015 Have you experimented with all options BREAK command supports... "_F" - first point,...,etc... If it's the same in A2015 and it works as it should, then type in Command: prompt (command "_.BREAK" ... arguments...) and look if it will break curves with supplied arguments... Then if it works in Command: prompt, it should work and inside lisp... If it don't work as expected, you also have few extra possibilities : change (command "_.BREAK" ...) to (command-s "_.BREAK" ...)... You can also try with (vl-cmdf "_.BREAK" ...), and if nothing of all this isn't working either search for VLISP solution (vla-break ??? - I think it doesn't exist), and if VLISP don't have this addition then I'd suggest you to try using lower versions of ACADs or maybe the best try ACAD2016 codename Memento... Quote Link to comment Share on other sites More sharing options...
vernonlee Posted April 1, 2015 Author Share Posted April 1, 2015 Have you experimented with all options BREAK command supports... "_F" - first point,...,etc... If it's the same in A2015 and it works as it should, then type in Command: prompt (command "_.BREAK" ... arguments...) and look if it will break curves with supplied arguments... Then if it works in Command: prompt, it should work and inside lisp... If it don't work as expected, you also have few extra possibilities : change (command "_.BREAK" ...) to (command-s "_.BREAK" ...)... You can also try with (vl-cmdf "_.BREAK" ...), and if nothing of all this isn't working either search for VLISP solution (vla-break ??? - I think it doesn't exist), and if VLISP don't have this addition then I'd suggest you to try using lower versions of ACADs or maybe the best try ACAD2016 codename Memento... still do not work. Are you using Autodesk AutoCAD 2014? I tried my friend's AutoCAD Architecture 2014 & it works. Weird. Quote Link to comment Share on other sites More sharing options...
vernonlee Posted April 2, 2015 Author Share Posted April 2, 2015 Anyone can advise how to get it to work on Autodesk AutoCAD 2014? Thanks Quote Link to comment Share on other sites More sharing options...
vernonlee Posted April 23, 2015 Author Share Posted April 23, 2015 Bumpz up for help. 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.