bsimpson Posted January 17, 2009 Share Posted January 17, 2009 Hi, For the new year see if you can have a go at. The widths of multiple lines drawn at a spacing x along a polyline that interesect another line that runs in the same direction. The distance measured from the perpendiclar snap of the interesection to the polyline to the intersection of the other line must be placed in an ascii file along with the cumulative spacing increment. thanks B Simpson. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 17, 2009 Share Posted January 17, 2009 Is this purely a 2D problem? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 17, 2009 Share Posted January 17, 2009 Perhaps this? ; Incremental Measurement Between Two Lines/Polylines ; by Lee McDonnell ~ 17.01.2009 ; [Assumes Polylines have only 2 Vertices] (defun c:mspc (/ oFile cCurve cCurvel dCurve dCurvel mSpc sPt ePt cAng nlist dis i pdis pt wpt wDis) (vl-load-com) (if (setq oFile (open (getfiled "Create a Text File" "C:\\" "txt" 9) "w")) (progn (if (and (setq cCurve (car (entsel "\nSelect First Curve > "))) (member (cdr (assoc 0 (setq cCurvel (entget cCurve)))) '("LINE" "LWPOLYLINE")) (setq dCurve (car (entsel "\nSelect Curve to Measure To > "))) (member (cdr (assoc 0 (setq dCurvel (entget cCurve)))) '("LINE" "LWPOLYLINE"))) (progn (initget 7) (setq mSpc (getreal "\nSpecify Measurement Increment: ")) (cond ((= "LINE" (cdr (assoc 0 cCurvel))) (setq sPt (cdr (assoc 10 cCurvel)) ePt (cdr (assoc 11 cCurvel)) cAng (angle sPt ePt))) ((= "LWPOLYLINE" (cdr (assoc 0 cCurvel))) (foreach x cCurvel (if (eq 10 (car x)) (setq nlist (cons (cdr x) nlist)))) (setq nlist (reverse nlist) sPt (nth 0 nlist) ePt (nth 1 nlist) cAng (angle sPt ePt)))) (setq dis (distance sPt ePt) i 0 pdis 0) (while (<= pdis dis) (setq pdis (* i mSpc) pt (polar sPt cAng pdis) wpt (vlax-curve-getClosestPointTo dCurve pt T) wDis (distance wpt pt)) (write-line (strcat (rtos (car pt) 2 2) "," (rtos (cadr pt) 2 2) "\t" (rtos wDis 2 2)) oFile) (setq i (1+ i))) (close oFile)) (princ "\n<!> No Curve Selected, or this isn't a Line/Polyline <!> "))) (princ "\n<!> No File Selected <!> ")) (princ)) Quote Link to comment Share on other sites More sharing options...
bsimpson Posted January 20, 2009 Author Share Posted January 20, 2009 Thanks Lee, This is a 2D situation. The lisp routine written gave an error with my computer the error was *cancel* I would presume that it is the version of AutoCAD. The version I am using is AutoCAD 14. Hopefully the routine can be edited to suite. regards bsimpson Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 20, 2009 Share Posted January 20, 2009 Ahh the dreaded R14... not VL commands allowed then Thats a shame, the routine would be so much easier with VL. I'll see what I can do. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 20, 2009 Share Posted January 20, 2009 Its annoying, because I only use one VL function: vlax-curve-getClosestPointTo.. And I can't think of an equivalent method in Common LISP.. Quote Link to comment Share on other sites More sharing options...
bsimpson Posted January 28, 2009 Author Share Posted January 28, 2009 Thanks for the effort Lee, any suggestions of what I can do about it? bSimpson Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 28, 2009 Share Posted January 28, 2009 Well there probably is a work-around without using VL commands, but obviously, when you have the VL commands at your disposal, I have never really opted for the Common LISP approach. I used the Vlax-Curve-GetClosestPointTo, as, in a 2D problem with two straight lines, the closest point will always be the perpendicular to one of the lines, but to make this happen in Common LISP is somewhat more of a challenge. Quote Link to comment Share on other sites More sharing options...
iztok13 Posted January 28, 2009 Share Posted January 28, 2009 thx for info Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 28, 2009 Share Posted January 28, 2009 thx for info Your Welcome. 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.