Author Topic: points on line?  (Read 3080 times)

0 Members and 1 Guest are viewing this topic.

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
points on line?
« on: October 10, 2012, 07:22:01 AM »
Hello all!

I wish to can get all polyline vertex- and intersection points on line from 3dPolyline.
First I ask the polyline if it have "VERTEX"
Code: [Select]
(setq en (car (entsel "\nSelect Polyline ")))
(while (and (setq en (entnext en))
            (setq edata (entget en))
            (=(cdr(assoc 0 edata))"VERTEX")
            )
  )

  )
Intersection points from terrain points (Gpt) to my ployline (vl-en) I get
Code: [Select]
(defun _sect ()
  (vlax-curve-getClosestPointTo vl-en Gpt)
  )

The vertex points I get with
Code: [Select]
(defun _polyV (en /)
  (cdr (assoc 10 edata))
  )

My Question: How can I get all points in a order
(pList '((vertex1 x y z) (vertex2 x y z) (section1 x y z) (section2 x y z) (vertex3 x y z) (section3 x y z) (vertex4 x y z) (section4 x y z)....))

Stefan

  • Bull Frog
  • Posts: 319
  • The most I miss IRL is the Undo button
Re: points on line?
« Reply #1 on: October 10, 2012, 08:00:53 AM »
Just a guess...
Code - Auto/Visual Lisp: [Select]
  1.   (append vertex_list section_list)
  2.     (lambda (x y)
  3.       (<
  4.         (vlax-curve-GetDistAtPoint vl-en x)
  5.         (vlax-curve-GetDistAtPoint vl-en y)
  6.       )
  7.     )
  8.   )
  9. )

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: points on line?
« Reply #2 on: October 10, 2012, 09:13:13 AM »
thanks that was answer of my question

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: points on line?
« Reply #3 on: October 10, 2012, 08:27:52 PM »

Be aware that vl-sort may remove duplicate data ... so you may have issues if you expect all points will be retained.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: points on line?
« Reply #4 on: October 16, 2012, 05:48:13 AM »
That is okay.
Now I have a problem how I build function if I have diffrent lists in section_list and vertex_list
but alway is coordinates in second position

section_list
(("S" 152747.0 6.4086e+006 72.3828) ("S" 152752.0 6.4086e+006 72.3091) ("S" 152770.0 6.40863e+006 72.1742) ("S" 152774.0 6.40863e+006 72.1143) ("S" 152786.0 6.40866e+006 71.9021))

vertex_list
(("S" 152747.0 6.4086e+006 72.3828 "A" -4.19779) ("S" 152752.0 6.4086e+006 72.3091 "A" -1.95332) ("S" 152770.0 6.40863e+006 72.1742 "A" 0.722905) ("S" 152774.0 6.40863e+006 72.1143 "A" -2.4611) ("S" 152786.0 6.40866e+006 71.9021 "A" 9.32426))


I try it with a sub-function but finally I don´t know to get a
Code: [Select]
(defun xxx (y)
   (foreach L y
     (setq D (vlax-curve-GetDistAtPoint vl-en (list (cadr L) (caddr L) (cadddr L))))
     (setq liste (cons D liste))
     )
   )

Code: [Select]
vl-sort (xxx section_list) '<

vl-sort (xxx vertex_list) '<


So I get two list with distance
But I want one list with "S"coordinates  and "A"area sort by distance D

Can somebody help me.
« Last Edit: October 16, 2012, 05:58:47 AM by cadplayer »

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: points on line?
« Reply #5 on: October 16, 2012, 06:18:56 AM »
This?

Code - Auto/Visual Lisp: [Select]
  1. (vl-sort (append section_list vertex_list)
  2.     (function
  3.         (lambda ( a b )
  4.             (< (vlax-curve-getdistatpoint vl-en (list (cadr a) (caddr a) (cadddr a)))
  5.                (vlax-curve-getdistatpoint vl-en (list (cadr b) (caddr b) (cadddr b)))
  6.             )
  7.         )
  8.     )
  9. )

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: points on line?
« Reply #6 on: October 17, 2012, 03:01:36 AM »
Thanks Lee that I was not trying to do.

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: points on line?
« Reply #7 on: October 17, 2012, 07:50:50 AM »
Thanks Lee that I was not trying to do.

Did I misunderstand? :?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: points on line?
« Reply #8 on: October 17, 2012, 08:54:43 AM »
I'm confused.  :-o
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: points on line?
« Reply #9 on: October 17, 2012, 08:57:55 AM »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: points on line?
« Reply #10 on: October 17, 2012, 02:43:00 PM »
Sorry my English is very bad, I mean it was answer to my problem. It was not easy to find a solution and Lee was very fast. Thanks for helping