Jump to content

Recommended Posts

Posted

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

Posted

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)
)

Posted

Sweet! That rocks! It's perfect, exactly what I needed.

Thanks so much Alan.

Posted
Sweet! That rocks! It's perfect, exactly what I needed.

Thanks so much Alan.

You're very welcome. I find it quite useful myself. :)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...