Costinbos77 Posted November 7, 2012 Posted November 7, 2012 (edited) I succeeded one to write a lisp routine to build 3D terrain model (DTM = digital terrain model) using autocad 3DFACE based on a text file with coordinates: point number, x, y, z. This issue concerns me greatly. What sorting algorithm is necessary to point? Any ideas? Costin TIN Model.dwg Edited February 9, 2014 by Costinbos77 add attachment Quote
Costinbos77 Posted November 30, 2012 Author Posted November 30, 2012 Did not hit anyone with this problem? Quote
Organic Posted December 1, 2012 Posted December 1, 2012 Why not use AutoCad Civil 3D? You are trying to reinvent the wheel. Quote
BIGAL Posted December 1, 2012 Posted December 1, 2012 Dont know the theory but do know how find centre point of all points and spiral out when making a dtm Quote
Costinbos77 Posted December 1, 2012 Author Posted December 1, 2012 (edited) Thanks for your answers. BIGAL You can send a link or something starting (beginning)? Organic I did not invent the wheel, I want to make an app that can calculate and draw contour lines, calculation of volumes and sections in the 3D model. I want this application to be independent of AutoCAD ( Not everyone uses AutoCAD Civil 3D or AutoCAD Land ) . On the other side it is a challenge . Edited December 1, 2012 by Costinbos77 Quote
irneb Posted December 1, 2012 Posted December 1, 2012 It is a bit complex, and what's meant by re-inventing the wheel is you'll need to redo something very complex indeed. If you can't get Land/C3d, can you use Revit - that also has a terrain from xyz data. If you really "have" to, the principle BigAl's referring to is to find the centroid of the XY values of all points. This is similar to finding the avg of a list of numbers - just done twice (once for x and once for y); though it's possible to write it a bit more efficiently by iterating only once. Now that you have the centre in the XY plane, you spiral around using the angle / polar functions. Finding the closest points to the centre using distance. etc etc etc Another alrernative would be to take any one point, then find the closest 2 points to it in XY plane. And continue until you've paired each point with 2 others. This is the brute force method and will probably take a very long time. And those 2 methods are not necessarily the most efficient. See why it's considered very complex? Why you were asked about invention and wheels? Quote
irneb Posted December 1, 2012 Posted December 1, 2012 Here's an example extracting the triangles from a list of points. It's uses the brute force method and is extremely inefficient - even more so since it needs to check for duplicates as well - and does so by brute force yet again. (defun Make2d (pt) (mapcar '* pt '(1.0 1.0 0.0))) (defun PtClosestXY (pt points / found dist d) (setq found (car points) dist (distance (Make2d pt) (Make2d found))) (foreach pt1 (cdr points) (if (< (setq d (distance (Make2d pt) (Make2d pt1))) dist) (setq found pt1 dist d))) found) (defun PointList->Mesh (points / meshes points2 pt1 pt2) (foreach pt points (setq pt1 (PtClosestXY pt (setq points2 (vl-remove pt points))) pt2 (PtClosestXY pt (vl-remove pt1 points2)) points2 (list pt pt1 pt2)) (if (not (vl-some '(lambda (3pts) (apply 'and (mapcar '(lambda (val) (member val points2)) 3pts))) meshes)) (setq meshes (cons points2 meshes)))) meshes) Edit: And this is only doing straight line - no smoothing between measured points as most other terrain mapping programs do. Quote
Costinbos77 Posted December 1, 2012 Author Posted December 1, 2012 Thanks for the reply. And you worry about this problem or did you think right now? Quote
irneb Posted December 1, 2012 Posted December 1, 2012 No took about 5 minutes to write that. Just doing it to see if it would work as I theorized. Anyhow, I'd not use that in a production environment - unless I'm willing to let the code run overnight. Quote
Costinbos77 Posted December 1, 2012 Author Posted December 1, 2012 I understand that there is a way to sort the data (points with x, y, z) to start from one side and reach the end. Another method would be to process all points on the edge and moving spiral to reach and finish in the center. By what method can join multiple 3Dface in a single object (as in the example)? Quote
ReMark Posted December 1, 2012 Posted December 1, 2012 Take a look at this. http://www.glamsen.se/CadTools.htm Quote
Costinbos77 Posted December 1, 2012 Author Posted December 1, 2012 (edited) Good point ReMark. As always well informed and to the point. I looked at the application, makes enough. You ruined all momentum. Edited December 1, 2012 by Costinbos77 Quote
irneb Posted December 1, 2012 Posted December 1, 2012 So does CadTools sort out your predicament? I thought you wanted something "independent of AutoCAD" as per your post #5? I gave the lisp to show the principle, which you can then implement somewhere else - e.g. VB in order to make an EXE file which works outside of ACad. Quote
Costinbos77 Posted December 1, 2012 Author Posted December 1, 2012 You're right irneb, I do not let me defeated. I wonder how many people and how long they worked to make this? Quote
ReMark Posted December 2, 2012 Posted December 2, 2012 I ruined your momentum? I don't think so. I only showed you that all things are possible if you put your mind to it. Take it as a challenge to not only create your own program but to improve on what's already available. Quote
BIGAL Posted December 3, 2012 Posted December 3, 2012 You need to do some web searching the theory of how to make a DTM is out there its a mathmatical soloution. Two styles a grid answer or a 3pt triangle. Quote
Costinbos77 Posted December 4, 2012 Author Posted December 4, 2012 Precisely so I'm trying to find out with this Thread, the math or if someone started to work and the problems has encountered. The first problem encountered is how to sort the points, sort them so as to have the lowest E and also the smallest N, to search step by step to form 3DFACE or 3DPline . Quote
Costinbos77 Posted February 8, 2014 Author Posted February 8, 2014 Completion : http://www.cadtutor.net/forum/showthread.php?77580-Preparing-a-list-of-points-on-convex-hull-for-triangulation&p=578758#post578758 Quote
ymg3 Posted February 9, 2014 Posted February 9, 2014 Costinbos, For a fast one in Autolisp see this link : Triangulation Revisited Also does Contouring. ymg Quote
Sanjib Posted February 9, 2014 Posted February 9, 2014 Friends.............pls help me. I used to create surface (terrain) in Land Desktop 2009 for contour and spot levels from existing text file data (PENZD format). Now my laptop has been upgraded with 64bits OS Win 7 where the land desktop 2009 can't be loaded. I have auto cad civil 3d 2012 in my laptop but I can't create the terrain from the said text file data. It will become great hazards to me. I am a Surveyor and my work related with surface, cotour, spot level, cross section, long section, volume etc. I have also read so many suggestions from various site but still i can't understand properly. It is requested to all of you if any forum member belongs to Kolkata, India; pls help me to learn those things. pls....pls.... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.