exclaymation Posted October 12, 2011 Share Posted October 12, 2011 I am currently doing my thesis, and I am required to add z values to a large number of points near some polylines I drew. Each Z value has to be the distance to a specific polyline. There are hundreds of points and I have been doing it manually but it is way too slow. Is there a way to automatically assign the z values (being the distance to the polyline) by just clicking on the polyline and selecting the points? Or something remotely more efficient? Any help would be great. Edit: I should mention, that what I am doing at the moment, is to use the measuring tool to measure the distance between the point and the line, then write it down. I then click on the point and type the distance value down. Quote Link to comment Share on other sites More sharing options...
exclaymation Posted October 13, 2011 Author Share Posted October 13, 2011 Anyone? I am pretty screwed. Quote Link to comment Share on other sites More sharing options...
eldon Posted October 13, 2011 Share Posted October 13, 2011 It might stir someone's interest if you could post a drawing containing one such polyline and a few points. Saying it in words only does not convey the same image, and some of your terminology might be different Quote Link to comment Share on other sites More sharing options...
exclaymation Posted October 13, 2011 Author Share Posted October 13, 2011 Here is a picture. I am trying to assign the z values of those points to be the distance between the point and that black line in the middle. I kind of suck at autocad. Any help, and I mean any, would be dynamite. Quote Link to comment Share on other sites More sharing options...
exclaymation Posted October 13, 2011 Author Share Posted October 13, 2011 Oh, and thanks eldon for the heads up. Quote Link to comment Share on other sites More sharing options...
eldon Posted October 13, 2011 Share Posted October 13, 2011 I am afraid that your picture only serves to confuse me more. :? What you are doing is quite beyond the experience of most people, and it needs to be explained even clearer, and that is why I suggested posting a drawing file, so that people can actually get their hands on a representive bit of your data. I understand that the Z value is the third dimension, coming up out of the screen, so it would be helpful to know if you are actually working in three dimensions, or whether the picture is of a cross section. The UCS icon shows only X and Y. Your lines appear to be not horizontal. The point from where you are measuring is not overly clear, and is the length required to be perpendicular to the poylline, or the orthogonal distance? You see, it might be crystal clear in your mind, but for me to help you, you will have to explain in words that this duffer can understand what exactly you are getting at, or perhaps someone else can understand. Quote Link to comment Share on other sites More sharing options...
exclaymation Posted October 13, 2011 Author Share Posted October 13, 2011 Oh, sorry. Ok, let me see if I can explain myself. The picture is of a cross-section, and the reason why I trying to add the z-values, is because I plan on exporting the data out of CAD with the DATAEXTRACTION command. I will then use the x,y,z coordinates into a different program (called Surfer) which is used to create contour maps. The picture doesn't show it very well, but I added thousands of points which are 5m away from each other (They are faint little dots in the picture). Each point is in the appropriate x,y coordinates, which match other contour maps I have. I will then use the Z coordinates which I added into the CAD file and the Z coords from the other contour maps into this equation I made which is what my thesis is all about (My thesis is to develop a prediction model for roof failures in underground mines). The Z values are meant to be the distance of the black line in the middle to each point, hence each point will have a different Z value. The colorful lines are not used at all (They are remains of an old attempt but are kind of there just to guide me). The distance is meant to be closest as possible to the black line (as in the quickest route). The maximum distance I will require, are points which are within 35m from the line. If one point is 1m away from the black line, the point directly above it will be 6m followed by 11m and so on. The whole picture though, has 4 of those black lines. So, what I am doing at the moment, is to click on a point, then using the measuring tool, checking the distance from the black line, then I manually enter that number into the Z value window. And it is taking me ages. Thanks for taking the time to give me a hand. If there is anything else I need to explain, please let me know. Quote Link to comment Share on other sites More sharing options...
eldon Posted October 13, 2011 Share Posted October 13, 2011 As I understand it, a contour is a line joining points of equal elevation (Z value). I presume that all your points that you added have x, y and z coordinates. So to my mind, you have all the data that you need without drawing anything in AutoCAD (told you I was a duffer). All I can do is wish you luck in your endeavours to find a quicker answer. Quote Link to comment Share on other sites More sharing options...
exclaymation Posted October 13, 2011 Author Share Posted October 13, 2011 Yeah, I do have all the data, but I need to assign the Z values. Thanks for trying to give me a hand Eldon. If any one can help me out, please do. Quote Link to comment Share on other sites More sharing options...
SLW210 Posted October 13, 2011 Share Posted October 13, 2011 I will move this to the AutoLISP, Visual LISP & DCL Forum. You might get more help there. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 13, 2011 Share Posted October 13, 2011 If I have understood correctly, give this a try: (defun c:addz ( / en in pt s1 s2 ) (vl-load-com) (if (and (princ "\nSelect Points: ") (setq s1 (ssget "_:L" '((0 . "POINT")))) (princ "\nSelect Polyline: ") (setq s2 (ssget "_+.:E:S" '((0 . "*POLYLINE")))) (setq s2 (ssname s2 0)) ) (repeat (setq in (sslength s1)) (setq en (entget (ssname s1 (setq in (1- in)))) pt (cdr (assoc 10 en)) ) (entmod (subst (list 10 (car pt) (cadr pt) (distance pt (vlax-curve-getclosestpointto s2 pt))) (cons 10 pt) en ) ) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
exclaymation Posted October 13, 2011 Author Share Posted October 13, 2011 Hmmm, on the possibility of sounding like a complete novice, how do I use this code? I am quite inexperienced with CAD. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 13, 2011 Share Posted October 13, 2011 Hmmm, on the possibility of sounding like a complete novice, how do I use this code? I am quite inexperienced with CAD. Have a read of this, or my tutorial here. BTW, the above code will use the 3D distance from the point to the selected Polyline, I wasn't sure whether you wanted the 3D or 2D distance, or indeed whether the Polyline was 3D. Quote Link to comment Share on other sites More sharing options...
exclaymation Posted October 13, 2011 Author Share Posted October 13, 2011 Cool, I will give it a go right now. Quote Link to comment Share on other sites More sharing options...
exclaymation Posted October 13, 2011 Author Share Posted October 13, 2011 Holy crap!!! That worked like a charm!!!! Lee Mac I am forever in your debt. It works really really well. Thank you so much, I really appreciate it, This helps me so much. Thank you kindly. Quote Link to comment Share on other sites More sharing options...
CyberAngel Posted October 13, 2011 Share Posted October 13, 2011 Never mind, didn't refresh the thread and missed the good stuff. Quote Link to comment Share on other sites More sharing options...
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.