I've been following this thread for quite some time and amazed by the progress and usefulness if this tool.
An improvement for me would be that Triangulation be broken down into separate functions that can be utilized/called within new routines. For example, I would like to return the elevation at a given point...
I've attached a rework of the latest Triangulation and divided/added the following routines:
(TIN:GETPOINTSLIST <entset>) ;; Returns a list of points
(setq PLIST (TIN:GETPOINTSLIST (ssget)))
(TIN:GETBREAKLINELIST <entset>) ;; Returns a list of point pairs
(setq BLIST (TIN:GETBREAKLINELIST (ssget)))
(TIN:TRIANGULATE <plist> <blist>) ;; Returns a list of triangles
(setq TLIST (TIN:TRIANGULATE PLIST BLIST))
(TIN:DRAW <tlist>) ;; Creates an anonymous block on the current layer with the 3DFace triangles
(TIN:DRAW TLIST)
(TIN:GET <ent>) ;; Returns the list of triangles for the selected block drawn by TIN:DRAW
(setq TLIST (TIN:GET (car (entsel)))
(TIN:READ <filename>) ;; Returns the list of triangles as read from the file name provided
(setq TLIST (TIN:READ FILENAME))
(TIN:WRITE <filename> <tlist>) ;; Writes the triangle list to file name provided
(TIN:WRITE FILENAME TLIST)
(TIN:ELEVATIONATPOINT <point> <tlist>) ;; Returns the elevation of the point on the provided triangles
(setq Z (TIN:ELEVATIONATPOINT (getpoint) TLIST)
The last was a bit of a brute force to try to get what my thoughts are. I've tried to keep all variables local. There is so much time spent on this and so I'm sure this can be improved on.
Next steps would be to define a routine to return a section between two points, generate contours, include some of the other features that have been included in the original (such as boundaries).
If I'm way off base with what I've done here please let me know - if anyone agrees with this direction please also comment.
Edit - Link to updated file:
https://www.theswamp.org/index.php?topic=9042.msg564291#msg564291(fixed issue reported/solved by rw2691)