Arizona Posted April 19, 2011 Posted April 19, 2011 Looking for a routine that will place a point node on a polyline at a specified distance (along the winding polyline) from a specified point on the same polyline. I'm sure sombody has already written a routine for this. Thanks for any help I can get, Jeff Quote
alanjt Posted April 19, 2011 Posted April 19, 2011 Quick modification to one I use (I like to have it place a circle)... (defun c:MAC (/ *error* pt ent dap dist pad) ;; Measure Along Curve (place circle(s) at specified distance(s) ;; Alan J. Thompson, 10.28.10 (vl-load-com) (defun *error* (msg) (redraw) (and ent (redraw ent 4)) (if (and msg (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*QUIT*,"))) (princ (strcat "\nError: " msg)) ) ) (if (setq pt (getpoint "\nSpecify measure base point on curve: ")) (if (vl-catch-all-error-p (vl-catch-all-apply (function (lambda (/) (vlax-curve-getEndParam (setq ent (ssname (ssget pt) 0))))) ) ) (alert "Point must be on curve!") ((lambda (total 2ten) (redraw ent 3) (while (progn (initget 2) (setq dist (getdist pt (strcat "\n[Total length: " (rtos total) "] [Positive length: " (rtos (- total (setq dap (vlax-curve-getDistAtPoint ent (trans pt 1 0))))) "] [Negative length: " (rtos dap) "]\nSpecify distance along curve to label: " ) ) ) ) (if (setq pad (vlax-curve-getPointAtDist ent (+ dap dist))) (entmakex ;;(list '(0 . "CIRCLE") (cons 10 pad) (cons 40 (fix (* 0.1 (getvar 'viewsize)))) 2ten) (list '(0 . "POINT") (cons 10 pad) 2ten) ) (alert "Point outside of curve limits!") ) ) ) (vlax-curve-getDistAtParam ent (vlax-curve-getEndParam ent)) (assoc 210 (entget ent)) ) ) ) (*error* nil) (princ) ) Quote
Arizona Posted April 19, 2011 Author Posted April 19, 2011 Sweet! That rocks! It's perfect, exactly what I needed. Thanks so much Alan. Quote
alanjt Posted April 19, 2011 Posted April 19, 2011 Sweet! That rocks! It's perfect, exactly what I needed.Thanks so much Alan. You're very welcome. I find it quite useful myself. 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.