bsimpson Posted November 7, 2008 Posted November 7, 2008 Hi Mr lispy, I need a lisp file that will measure the perpendicular width between two polylines. The principle polyline must measure the widths from increments say of 10 units (nice to have this as an input). The output of measured widths would be best sent to an ascii file but otherwise the text screen is cool. Neat if the principle polyline could choose the left or the right side or both to determine the widths of the space between the other polylines. Maybe a selection option for the polyline to measure the perpendicular width from. This will save a load of time. Quote
ReMark Posted November 7, 2008 Posted November 7, 2008 You need a lisp routine to do this because....? I'm not sure what you are trying to accomplish. Could you elaborate? Thank you. Quote
Lee Mac Posted November 7, 2008 Posted November 7, 2008 Not sure really what you are after, possibly this? Distance between two polylines? Quote
bsimpson Posted November 9, 2008 Author Posted November 9, 2008 Not sure really what you are after, possibly this? Distance between two polylines? Hi Lee, yes exactly, I have a large number of iterations which are proving to be time consuming. I am measuring by manual methods as you have pointed out but this is in need of improvement. A lisp file is needed to measure the perpendicular distance between two polylines. The two polylines do not have the same directions so the perpendicular measurement is on one them, the principle line. The principle line is staked at 10 units say and another distance measurement is taken and so on.... idealy an option for selecting the unit spacing and an ascii file out put would be great. hope this clarify's the issue. bsimpson Quote
bsimpson Posted November 10, 2008 Author Posted November 10, 2008 Hi Remark, I am using a seperate design program called Civildesigner for designing roads. The main design work we have is with upgrades to intersections with widening the road edges. This means that each time I coordinate a centre line along the road I have to pick up the road edges using a width dimension which is input into Civildesigner in order to produce the relavant quantities and presentations for the road widening. I hope I will be able to get this lisp file as this will save me measuring up the road edges countless times. I need to cut back on time for design. Regards bsimpson Quote
Lee Mac Posted November 10, 2008 Posted November 10, 2008 Hi bsimpson, I have quickly typed this LISP, but I am not sure if it completely suits your needs, but give it a go all the same. It will dimension a set of lines all from the selection of a first line, and will always dimension the lines to one side. Let me know if this helps at all. (defun c:ldist (/ l1 l2 pt1s pt1e pt1 pt2s pt2e pt2) (setvar "cmdecho" 0) (if (setq l1 (car (entsel "\nSelect First Line: "))) (progn (while (setq l2 (car (entsel "\nSelect Second Line: "))) (setq pt1s (cdr (assoc 10 (entget l1)))) (setq pt1e (cdr (assoc 11 (entget l1)))) (if (> (car pt1s)(car pt1e)) (setq pt1 (cdr (assoc 10 (entget l1)))) (setq pt1 (cdr (assoc 11 (entget l1)))) ) ; end if (setq pt2s (cdr (assoc 10 (entget l2))) ) ; end setq (setq pt2e (cdr (assoc 11 (entget l2))) ) ; end setq (if (> (car pt2s)(car pt2e)) (setq pt2 (cdr (assoc 10 (entget l2)))) (setq pt2 (cdr (assoc 11 (entget l2)))) ) ; end if (command "_dimlinear" pt1 pt2 pause ) ; end dim ) ; end while ) ; end progn (alert "No Line Selected") ) ; end if (setvar "cmdecho" 1) (princ "\nFunction Complete.") (princ) ) ; end function Quote
bsimpson Posted November 12, 2008 Author Posted November 12, 2008 Hi Lee, I had a look at the lisp routine and see that it is on the right track but I am in need of something more. The routine allows a first and second line to be selected which is correct, however the output is not correct. The routine needs to take perpendicular distance measurements at inturvals of say 10units, best to have an input of "what is the spacing along the first line" to the second line. The result need not have a dimension line drawn but best output in a text screen or ascii file. typically with two columns as shown below; SV dist 0 12.5 10 12.25 20 12.8 30 12.05 30.125 12.00 SV= stake value (spacing along first line) dist = perpendicular distance from the first line to the second line The dist measured from the first line to the second line is measured at the perpendicular to the first line and then the intersect of the second line. I anticipate the routine could be improved. bsimpson Quote
Lee Mac Posted November 12, 2008 Posted November 12, 2008 Ahhh.... I understand now, thanks. I'll see what I can do Quote
ReMark Posted November 12, 2008 Posted November 12, 2008 "I anticipate the routine could be improved." Indeed? How thoughtful of you. Quote
bsimpson Posted November 12, 2008 Author Posted November 12, 2008 Exactly, you have understood the question. I am looking forward to what you can do. Quote
Lee Mac Posted November 12, 2008 Posted November 12, 2008 ** I have had a think about the routine ** I could create a routine that requests two line selections and retrieves the angle of one of the lines, and then possibly using a "while" command, the LISP could consecutively draw lines perpendicular to one of the selected lines, (at a predetermined spacing defined by the user). Then, using the "inters" function with "onseg" set to "nil" (assumes lines are infinite), one could retrieve the intersection between the perpendicular lines and the other selected line. And then the perpendicular distance could easily be calculated using a "distance" function between the two points. The problem I am having however, is how to extract the calculated distance from the LISP and into a text/excel file. But I expect someone else will be able to cope with this issue (I expect ASMI will know a thing or two ) Quote
bsimpson Posted November 12, 2008 Author Posted November 12, 2008 Thanks for trying, It is quite a task. The routine sounds solid and if ASMI can't win then maybe we could put the text into AutoCad in a text table? Lets wait to here from ASMI I am sure he is around. thanks bsimpson Quote
BIGAL Posted November 13, 2008 Posted November 13, 2008 Search for batters & vba here its all done you will need to hack it a bit but it does exactly what you want perpendicular lines to two different polylines. Found it "Batter ticks" Quote
bsimpson Posted November 13, 2008 Author Posted November 13, 2008 Hi Bigal, I tried the routines on my computer. there was an evolution of about 5 of them. I only managed to get one to partly work, it goes through the routine and correctly asks for the selection of two lines and then the input for the step. Alas the output is *cancel* I don't know Y. bsimpson Quote
bsimpson Posted November 15, 2008 Author Posted November 15, 2008 Hi Lee, I found the following routine that sends coordinates to a txt file maybe we could take the code and use it to resolve the problem you have; "The problem I am having however, is how to extract the calculated distance from the LISP and into a text/excel file". ;export old style polyline vertex coords to a text file ; mfuccaro@hotmail.com (defun c:pl2tx( / en ask i a file) (while (not ask) (setq en (car (entsel))) (if en (setq ask (= "POLYLINE" (cdr (assoc 0 (entget en)))))) ) (setq file (open (getfiled "Output file" (strcat (getvar "dwgprefix") (substr (getvar "DWGNAME") 1 (- (strlen (getvar "dwgname")) 4))) "txt" ;file type 1) "w")) (setq i 0 sep ";") ;sep=separator (while (or (zerop i) a) (setq a (mapcar 'rtos (cdr (assoc 10 (entget (setq en (entnext en))))))) (if a (write-line (strcat (car a) sep (cadr a) sep (caddr a)) file)) (setq i (1+ i)) ) (close file) (princ (strcat "\n" (itoa (1- i)) " points exported")) (princ) ) bsimpson Quote
CAB Posted November 16, 2008 Posted November 16, 2008 No trick to file output. Use the following sub. Note that the list must contain strings!!! You must convert the following: SV dist '(0 12.5 10 12.25 20 12.8 30 12.05 30.125 12.00) to this: '("0 12.5" "10 12.25" "20 12.8" "30 12.05" "30.125 12.00") (defun FileWrite (fn lst / fd) (if (setq fd (open fn "w")) (progn (foreach itm (layoutlist) (write-line itm fd) ) (close fd) ) ) ) Quote
bsimpson Posted November 17, 2008 Author Posted November 17, 2008 Hi CAB, thanks for the comment, however I would need the whole routine. bsimpson 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.