vlax-invoke 'intersectwith

vlax-invoke 'intersectwith

john.uhden
Mentor Mentor
1,644 Views
2 Replies
Message 1 of 3

vlax-invoke 'intersectwith

john.uhden
Mentor
Mentor

DO NOT USE THE FOLLOWING CONSTRUCT...

;; (setq Ints (cons (vlax-invoke Obj 'intersectwith Obj1 1) Ints))
;; It turns out that vlax-invoke 'intersectwith returns a flat list of the
;; intersection points, e.g. (x1 y1 z1 x2 y2 z2),
;; so they must be grouped in 3s

(setq Ints (append (@group (vlax-invoke Obj 'intersectwith Obj1 1) 3) Ints))

where

  (defun @group (old n / item new)
    (while old
      (while (< (length item) n)
        (setq item (cons (car old) item) old (cdr old))
      )
      (setq new (cons (reverse item) new) item nil)
    )
    (reverse new)
  )

What I am doing is creating a list of intersection points between one polyline and multiple lines.

I will then sort them in CCW order as part of a new pool deep end routine.  Right now the techs have to split and rotate and join all the various panel pieces by hand, to the point that drafting can become the bottleneck in production on any given day.  Since there is always a shortage of qualified techs and they have many other duties, I have to get them to be more efficient.  Of course the real fun is that I am busy producing something for which I actually get paid.  Yay!

John F. Uhden

0 Likes
Accepted solutions (1)
1,645 Views
2 Replies
Replies (2)
Message 2 of 3

_Tharwat
Advisor
Advisor

Hi,

 

This is another way of reaching the same goal of the function although that I do prefer to use the recursive way with such a task but let's keep it simple. lol

 

(while old
  (setq new (cons (list (car old) (cadr old) (caddr old)) new)
        old (cdddr old)
        )
  )
(reverse new)
0 Likes
Message 3 of 3

john.uhden
Mentor
Mentor
Accepted solution

That's pretty much the way I used to do it, but then I needed two functions, one for 2D and one for 3D, whereas my @group function takes an argument for 2 or 3 or actually any positive number, though I can't think of a 4D or 5D situation.

John F. Uhden

0 Likes