Jump to content

Recommended Posts

Posted (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

 

break.JPG

 

;; 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 by nalsur8
...solve
  • Replies 40
  • Created
  • Last Reply

Top Posters In This Topic

  • nalsur8

    12

  • ReMark

    11

  • pBe

    11

  • Tharwat

    4

Top Posters In This Topic

Posted Images

Posted

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?

Posted
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

Posted

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?

Posted

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?

Posted

i want breaking the line only by user pick the line (maybe entsel)

than find the intersection point left and right than break it

Posted

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

Posted

Tharwat

 

that good, but it must have CIRCLE or ELLIPSE

i need LINE break of LINE, i try to add "LINE" but return error :D

 

 

.....nalsur8

Posted
Tharwat

 

that good, but it must have CIRCLE or ELLIPSE

i need LINE break of LINE, i try to add "LINE" but return error :D

 

 

.....nalsur8

 

Do you mean that you want to keep the cut line in Circles and Ellipes ?

Posted
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

break.JPG

Posted

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 ?

Posted

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?

Posted

I believe the ellipse is just an indication where the OP wants to pick, its not really there at all

Posted
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 ? :unsure:

Posted
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?

Posted
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 :)

Posted (edited)
If so , the use of break command would solve the issue without any code .

 

Am I right ? :unsure:

 

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 :D

Commnad: Trim

Select objects: Viola

Edited by pBe
Posted

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.

Posted
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 :lol: 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 :)

Posted
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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...