Joining 3d points with 3D polyline?

Joining 3d points with 3D polyline?

lwindsor73
Participant Participant
1,415 Views
4 Replies
Message 1 of 5

Joining 3d points with 3D polyline?

lwindsor73
Participant
Participant

Hi there,

 

I am wondering if there is a way to join a set of 3D points with a 3D polyline to generate a section profile of a 3D topographical survey.

I have found a lisp file that generates points at the apparent intersection of 3D polylines and a 2d polyline denoting the "cutting plane" (see image below). If you need any more information on what I'm looking for please don't hesitate to ask.

 

any help would be greatly appreciated.

lwindsor73_0-1656930215780.png

 

0 Likes
Accepted solutions (1)
1,416 Views
4 Replies
Replies (4)
Message 2 of 5

Michiel.Valcke
Advisor
Advisor

I believe Autodesk Civil 3D has several functions that can do exactly that. In a vanilla AutoCAD you are probably stuck with a lisp function to generate the line for you, or to do it manually.

A lisp for this shouldn't be too complicated the issue is how to determine the correct order of the points. I think the lisp you already have could be expanded to generate a 3D pline in addition to creating the points. If you share it here I'll see what I can do. 

Otherwise the people at the customization forums, can also help.

0 Likes
Message 3 of 5

lwindsor73
Participant
Participant

Hi there, I've attached the lisp file that I found to generate the points, I'm relatively new to it so haveb't a clue about how the program works.

 

Here's the link to the thread of where the file came from.

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/creating-points-at-3d-polyline-inter...

 

If there's anything else you need please let me know.

0 Likes
Message 4 of 5

Kent1Cooper
Consultant
Consultant
Accepted solution

Since the Points will always be in a straight line in XY terms, no matter what their order from the order of the contours' virtual intersections with the straight guide path, it should be possible to sort them by either X or Y coordinate, and apply their coordinates to a new 3DPolyline.  The concept [not tested except most of the pieces in isolation, nor assembled into an actual routine yet]:

Add each Point's location to a list as it's created, i.e. add this:

....
    (vlax-release-object obj_point)
    (setq ptlist (cons (cdr (assoc 10 (entget (entnext)))) ptlist))
  );while Inters_list
....

 

Then after it's done making all the points, you'll have a list of all their locations.  I assume [without studying the code deeply] that the order of that list will be affected by the drawing order of the contours, in which case sort them by [arbitrarily] X coordinates:

 

    (setq ptlist (vl-sort ptlist '(lambda (a b) (< (car a) (car b))))

 

[If the guide line might ever be parallel to the Y axis so the X coordinates of the Points are all the same, a check could be added for that, and if it finds that condition, it could sort by Y coordinates instead.]

 

Then string all those coordinates together into one undifferentiated list, the way they're stored in a 3DPolyline's VLA properties:

 

  (setq ptscoords (apply 'append ptlist))

 

Have the routine draw any simple initial 3DPolyline, and make a VLA object of it:

  (command "_.3dpoly" '(0 0 0) '(1 0 0) "")

  (setq 3dp (vlax-ename->vla-object (entlast)))

 

and impose that coordinates list on it:

 

  (vlax-put 3dp 'coordinates ptscoords)

Kent Cooper, AIA
Message 5 of 5

Michiel.Valcke
Advisor
Advisor

@Kent1Cooper something similar was my idea as well.

I'm not sure that the points would always have been sortable, that's why I wanted to take a list from within the lisp routine.

 

@lwindsor73 I have added Kent's code to your lisp (untested) download it from here and try it out. All credit goes to @Kent1Cooper don't forget to thank him with a like or mark his post as a solution.