nalsur8 Posted November 16, 2011 Posted November 16, 2011 (edited) i'm searcing around this forum, many ways for multiselect i found more than single pick/select to break the object(line/circle) below code from LeeMac, to break the object with 2 selection how to hack the code to change with single pick ;; Finds all Intersections between obj1 & obj2 ;; Args: obj1,obj2 ;; VLA-Objects with Intersectwith method available ;; Returns: List of Intersections (or nil) (defun GetIntersections (obj1 obj2 / GroupByNum) ;; Lee Mac ~ 16.04.10 (defun GroupByNum (lst num / rtn) (setq rtn nil) (if lst (cons (reverse (repeat num (progn (setq rtn (cons (car lst) rtn) lst (cdr lst)) rtn))) (GroupByNum lst num)))) (GroupByNum (vlax-invoke obj1 'IntersectWith obj2 acExtendNone) 3)) (defun c:test (/ e1 e2) (vl-load-com) (if (apply (function and) (mapcar (function (lambda (str sym) (set sym (car (entsel str))))) '("\nSelect First Object: " "\nSelect Second Object: ") '(e1 e2))) (print (apply (function GetIntersections) (mapcar (function vlax-ename->vla-object) (list e1 e2))))) (princ)) Edited November 18, 2011 by nalsur8 ...solve Quote
ReMark Posted November 16, 2011 Posted November 16, 2011 There are a number of lisp routines that will break a line with a single pick. My question is how many "breaks" are you making? One? More than one? Are you breaking the line by picking another object or the line itself? Quote
nalsur8 Posted November 16, 2011 Author Posted November 16, 2011 There are a number of lisp routines that will break a line with a single pick. My question is how many "breaks" are you making? One? More than one? Are you breaking the line by picking another object or the line itself? pls refer my #1 post with the picture mention break 2 point and 1 pick point Quote
ReMark Posted November 16, 2011 Posted November 16, 2011 Sure. If you have a single line, nothing else in your drawing, and you want to break that line at two points, how are you defining the break points relative to the pick point? Quote
LibertyOne Posted November 16, 2011 Posted November 16, 2011 yes, this is a tedious task. If you are just picking an object to break you would have to define a number of entities. Breaking a line is different than breaking a circle. (you would have to replace a circle with an arc). So are you just breaking lines? Or polylines, too? Quote
nalsur8 Posted November 17, 2011 Author Posted November 17, 2011 i want breaking the line only by user pick the line (maybe entsel) than find the intersection point left and right than break it Quote
Tharwat Posted November 17, 2011 Posted November 17, 2011 Hope this would meet your needs nalsur8 (defun c:test (/ l e ss i sn in ) (vl-load-com) ;; Tharwat 17. Nov. 2011 ;; (if (and (setq l (car (entsel "\n Select Line that intersect with a Circle :") ) ) (eq (cdr (assoc 0 (setq e (entget l)))) "LINE") ) (if (setq ss (ssget "_F" (list (cdr (assoc 10 e)) (cdr (assoc 11 e)))) ) (repeat (setq i (sslength ss)) (setq sn (ssname ss (setq i (1- i)))) (if (member (cdr (assoc 0 (entget sn))) '("CIRCLE" "ELLIPSE") ) (progn (setq in (vlax-safearray->list (vlax-variant-value (vla-intersectwith (vlax-ename->vla-object l) (vlax-ename->vla-object sn) acExtendNone ) ) ) ) (command "_.break" l "_non" (list (nth 0 in) (nth 1 in) (nth 2 in)) "_non" (list (nth 3 in) (nth 4 in) (nth 5 in)) ) ) ) ) ) (princ) ) (princ) ) Regards. Tharwat Quote
nalsur8 Posted November 17, 2011 Author Posted November 17, 2011 Tharwat that good, but it must have CIRCLE or ELLIPSE i need LINE break of LINE, i try to add "LINE" but return error .....nalsur8 Quote
Tharwat Posted November 17, 2011 Posted November 17, 2011 Tharwat that good, but it must have CIRCLE or ELLIPSE i need LINE break of LINE, i try to add "LINE" but return error .....nalsur8 Do you mean that you want to keep the cut line in Circles and Ellipes ? Quote
nalsur8 Posted November 17, 2011 Author Posted November 17, 2011 Do you mean that you want to keep the cut line in Circles and Ellipes ? yes, thats one of my target to keep the line after break but your code must have the CIRCLE or ELLIPSE, i only have LINE intersection with LINE no more any object ....nalsur8 note: pls ignore the yellow color as indicator of pick area Quote
Tharwat Posted November 17, 2011 Posted November 17, 2011 Why did you uploaded the same image once again ? I can't get your point of view , so finally do you mean that you want to select CIRCLE or ELLIPSE and a line and after that cut the piece of the selected line which is inside the circle/ellipse area ? Quote
ReMark Posted November 17, 2011 Posted November 17, 2011 It sounds like the OP wants to break the line where it intersects with either a circle or ellipse. The line segment that is inside the circle/ellipse is retained. Isn't this very much like a BREAK@ but at two points representing the intersection of the line with a circle/ellipse? Quote
pBe Posted November 17, 2011 Posted November 17, 2011 I believe the ellipse is just an indication where the OP wants to pick, its not really there at all Quote
Tharwat Posted November 17, 2011 Posted November 17, 2011 I believe the ellipse is just an indication where the OP wants to pick, its not really there at all If so , the use of break command would solve the issue without any code . Am I right ? Quote
ReMark Posted November 17, 2011 Posted November 17, 2011 I believe the ellipse is just an indication where the OP wants to pick, its not really there at all If that is the case then wouldn't the only method of breaking a line in TWO places using ONE pick involve the user specifying an offset (both sides) of the actual pick point? Quote
pBe Posted November 17, 2011 Posted November 17, 2011 If that is the case then wouldn't the only method of breaking a line in TWO places using ONE pick involve the user specifying an offset (both sides) of the actual pick point? Yes something like that.. a fuzz value you might say. which you already suggested a while back. or write a code to search the two nearest intersection emanating from the point selected then break the line on those two intersection.. I think its easy enough Quote
pBe Posted November 17, 2011 Posted November 17, 2011 (edited) If so , the use of break command would solve the issue without any code . Am I right ? Yes, but the trick is determining where those two points from a single pick. looking at the drawing, since there are two lines already touching the target line. trim would be a better option Commnad: Trim Select objects: Viola Edited November 17, 2011 by pBe Quote
ReMark Posted November 17, 2011 Posted November 17, 2011 In my opinion trim would not be a better option because, as I read it, the OP wants to retain the line segment that has been broken out. Quote
pBe Posted November 17, 2011 Posted November 17, 2011 In my opinion trim would not be a better option because, as I read it, the OP wants to retain the line segment that has been broken out. You know what.. you're right not really read the other posts there . it would have been nice if break command have an option like fillet where you select two objects and doesnt trim both lines well anyhoo.. back to the code, as i was saying..... the code posted by the OP uses intersectwith is the way to go. Or pick the line below and use that as reference. would that work at all? maybe .. maybe not.. i think i'll join in writing a code for this Quote
eldon Posted November 17, 2011 Posted November 17, 2011 In my opinion trim would not be a better option because, as I read it, the OP wants to retain the line segment that has been broken out. It is all to do with the way people's minds work. Instead of wondering whether a line could be broken in two places and get a lisp for it, I reckon it would be quicker to trim the line and then draw a line between the two ends. 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.