Author Topic: Order of Results From 'Intersectwith Method  (Read 1908 times)

0 Members and 1 Guest are viewing this topic.

ymg

  • Guest
Order of Results From 'Intersectwith Method
« on: February 21, 2014, 08:54:36 AM »


Am I right with the assumption that (vlax-invoke obj1 'intersectwith obj2 acExtendNone)
always gives  return ordered by distance along curve obj1 ???

So far haven't found any counter examples.

ymg

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Order of Results From 'Intersectwith Method
« Reply #1 on: February 22, 2014, 11:30:10 AM »
That may be, but I certainly wouldn't rely on that assumption when a simple vl-sort removes all doubt:

Code - Auto/Visual Lisp: [Select]
  1. (defun intersectwith ( obj1 obj2 / lst srt tmp )
  2.     (setq tmp (vlax-invoke obj1 'intersectwith obj2 acextendnone))
  3.     (repeat (/ (length tmp) 3)
  4.         (setq lst (cons (list (car tmp) (cadr tmp) (caddr tmp)) lst)
  5.               srt (cons (vlax-curve-getparamatpoint obj1 (car lst)) srt)
  6.               tmp (cdddr tmp)
  7.         )
  8.     )
  9.     (mapcar '(lambda ( n ) (nth n lst)) (vl-sort-i srt '<))
  10. )

ymg

  • Guest
Re: Order of Results From 'Intersectwith Method
« Reply #2 on: February 22, 2014, 01:34:33 PM »
Thanks Lee,

Agree we all know about the saying on assume.

Still would be interesting to know for sure..

ymg

ymg

  • Guest
Re: Order of Results From 'Intersectwith Method
« Reply #3 on: February 23, 2014, 02:03:36 AM »


To put it to rest, Self Crossing polylines will give you results that are not ordered.

ymg