Jump to content

How to put distance favorite points on a polyline ?


termal007

Recommended Posts

hi

i have a polyline 1254.85 meters ; i want insert point on polyline intervals 15 meters and 15 meters .

how can i do that is simple ?

this polyline is alignment road .

Link to comment
Share on other sites

oh yes but when distance is 125.63 and u want to 30 intervals u should 4.187666666667 divided so u should type in command is 4 or 5 dived in Autocad !! so betweens points are not 30 because u divide 4 or 5 used not intervales likes!!

 

for example :

polyline is 125.63 ; i like divide between length of points are 30 so i divide 125.63/30 = 4.1876666666666666666666666666667 ;;

ok !! but i should type in autocad command divide and number use 4 or 5 so when i use 4 or 5 raen't correct between points are 30 and 30 !! lenghth betwwen points are 25.126 for 5 divide

Link to comment
Share on other sites

Assuming the profile is correct --> [ATTACH=CONFIG]42568[/ATTACH]

 

Up until recently I was using 2007 and it had the array command. (assuming that's what you were alluding to. I could be missing something though.)

Link to comment
Share on other sites

Up until recently I was using 2007 and it had the array command. (assuming that's what you were alluding to. I could be missing something though.)

 

Array can not do the trick since that it is not walking along the distance of line segments , so try the measure command as Nestly 's suggested to see the differences .

Link to comment
Share on other sites

The polyline is probably not a single straight length so array won't work. Measure should be the way to go, using a block.

Link to comment
Share on other sites

The polyline is probably not a single straight length so array won't work. Measure should be the way to go, using a block.

 

that's right ! i accept :thumbsup:

Link to comment
Share on other sites

I have this lisp to do this...

(defun c:cmeasure ( / *error* _StartUndo _EndUndo _SelectIf _IsCurveObject acdoc al bl d0 di en mx nm pt )

 (defun *error* ( msg )
   (if acdoc (_EndUndo acdoc))
   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
       (princ (strcat "\n** Error: " msg " **")))
   (princ)
 )

 (defun _StartUndo ( doc ) (_EndUndo doc)
   (vla-StartUndoMark doc)
 )

 (defun _EndUndo ( doc )
   (if (= 8 (logand 8 (getvar 'UNDOCTL)))
     (vla-EndUndoMark doc)
   )
 )

 (defun _SelectIf ( msg pred func / sel ) (setq pred (eval pred))  
   (while
     (progn (setvar 'ERRNO 0) (setq sel (car (func msg)))
       (cond
         ( (= 7 (getvar 'ERRNO))
           (princ "\nMissed, Try again.")
         )
         ( (eq 'ENAME (type sel))
           (if (and pred (not (pred sel)))
             (princ "\nInvalid Object Selected.")
           )
         )
       )
     )
   )
   sel
 )

 (defun _IsCurveObject ( entity / param )
   (and
     (not
       (vl-catch-all-error-p
         (setq param
           (vl-catch-all-apply 'vlax-curve-getendparam (list entity))
         )
       )
     )
     param
   )
 )

 (setq acdoc (vla-get-activedocument (vlax-get-acad-object))
       nm    (trans '(0. 0. 1.) 1 0 t)
 )
 (if (setq en (_SelectIf "\nSelect Object to Measure: " '_isCurveObject entsel))
   (progn
     (initget 7 "Block")
     (setq di (getdist "\nSpecify length of segment or [block]: "))
     
     (if (eq "Block" di)
       (progn
         (while
           (progn (setq bl (getstring t "\nEnter name of block to insert: "))
             (cond
               ( (not (snvalid bl))
                 (princ "\nInvalid block name.")
               )
               ( (not (tblsearch "BLOCK" bl))
                 (princ (strcat "\nCannot find block \"" bl "\"."))
               )
             )
           )
         )
         (initget "Yes No")
         (setq al (not (eq "No" (getkword "\nAlign block with object? [Yes/No] <Y>: "))))
         (initget 7)
         (setq di (getdist "\nSpecify length of segment: "))
       )
     )
     (setq mx (vlax-curve-getdistatparam en (vlax-curve-getendparam en))
           d0 (- (/ (- mx (* di (fix (/ mx di)))) 2.) di)
     )
     (_StartUndo acdoc)
     (while (and (<= (setq d0 (+ d0 di)) mx) (setq pt (vlax-curve-getpointatdist en d0)))
       (if bl
         (entmakex
           (list
             (cons 0 "INSERT")
             (cons 2 bl)
             (cons 10 (trans pt 0 nm))
             (cons 50
               (if al
                 (angle '(0. 0. 0.)
                   (trans
                     (vlax-curve-getfirstderiv en (vlax-curve-getparamatpoint en pt)) 0 nm
                   )
                 )
                 0.
               )
             )
             (cons 210 nm)
           )
         )
         (entmakex (list (cons 0 "POINT") (cons 10 pt)))
       )
     )
     (_EndUndo acdoc)
   )
   (princ "\n*Cancel*")
 )
 (princ)
)
(vl-load-com) (princ)

;;------------------------------------------------------------;;
;;                         End of File                        ;;
;;------------------------------------------------------------;;

 

cheers :beer:

Link to comment
Share on other sites

I have this lisp to do this...

(defun c:cmeasure ( / *error* _StartUndo _EndUndo _SelectIf _IsCurveObject acdoc al bl d0 di en mx nm pt )

 (defun *error* ( msg )
   (if acdoc (_EndUndo acdoc))
   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
       (princ (strcat "\n** Error: " msg " **")))
   (princ)
 )

 (defun _StartUndo ( doc ) (_EndUndo doc)
   (vla-StartUndoMark doc)
 )

 (defun _EndUndo ( doc )
   (if (= 8 (logand 8 (getvar 'UNDOCTL)))
     (vla-EndUndoMark doc)
   )
 )

 (defun _SelectIf ( msg pred func / sel ) (setq pred (eval pred))  
   (while
     (progn (setvar 'ERRNO 0) (setq sel (car (func msg)))
       (cond
         ( (= 7 (getvar 'ERRNO))
           (princ "\nMissed, Try again.")
         )
         ( (eq 'ENAME (type sel))
           (if (and pred (not (pred sel)))
             (princ "\nInvalid Object Selected.")
           )
         )
       )
     )
   )
   sel
 )

 (defun _IsCurveObject ( entity / param )
   (and
     (not
       (vl-catch-all-error-p
         (setq param
           (vl-catch-all-apply 'vlax-curve-getendparam (list entity))
         )
       )
     )
     param
   )
 )

 (setq acdoc (vla-get-activedocument (vlax-get-acad-object))
       nm    (trans '(0. 0. 1.) 1 0 t)
 )
 (if (setq en (_SelectIf "\nSelect Object to Measure: " '_isCurveObject entsel))
   (progn
     (initget 7 "Block")
     (setq di (getdist "\nSpecify length of segment or [block]: "))
     
     (if (eq "Block" di)
       (progn
         (while
           (progn (setq bl (getstring t "\nEnter name of block to insert: "))
             (cond
               ( (not (snvalid bl))
                 (princ "\nInvalid block name.")
               )
               ( (not (tblsearch "BLOCK" bl))
                 (princ (strcat "\nCannot find block \"" bl "\"."))
               )
             )
           )
         )
         (initget "Yes No")
         (setq al (not (eq "No" (getkword "\nAlign block with object? [Yes/No] <Y>: "))))
         (initget 7)
         (setq di (getdist "\nSpecify length of segment: "))
       )
     )
     (setq mx (vlax-curve-getdistatparam en (vlax-curve-getendparam en))
           d0 (- (/ (- mx (* di (fix (/ mx di)))) 2.) di)
     )
     (_StartUndo acdoc)
     (while (and (<= (setq d0 (+ d0 di)) mx) (setq pt (vlax-curve-getpointatdist en d0)))
       (if bl
         (entmakex
           (list
             (cons 0 "INSERT")
             (cons 2 bl)
             (cons 10 (trans pt 0 nm))
             (cons 50
               (if al
                 (angle '(0. 0. 0.)
                   (trans
                     (vlax-curve-getfirstderiv en (vlax-curve-getparamatpoint en pt)) 0 nm
                   )
                 )
                 0.
               )
             )
             (cons 210 nm)
           )
         )
         (entmakex (list (cons 0 "POINT") (cons 10 pt)))
       )
     )
     (_EndUndo acdoc)
   )
   (princ "\n*Cancel*")
 )
 (princ)
)
(vl-load-com) (princ)

;;------------------------------------------------------------;;
;;                         End of File                        ;;
;;------------------------------------------------------------;;

 

cheers :beer:

 

Where did you get that lisp from ? it has an end without a header :D

Link to comment
Share on other sites

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