Jump to content

i am in desperate need of help (subdivide a line & arc into multiple points )


apachiee
 Share

Recommended Posts

hello to all,

 

could anyone post me a lisp file which can subdivide a line & arc into multiple points as i want, means if a line has a length of 100m i can subdivide it into 10m interval without breaking points, making a line of 100m with 11 points in it... same as with arc too..

 

i would really appreciate, ur efforts...

 

thanks...

Link to comment
Share on other sites

Not sure if this is what you are looking for?

 

One from my archive...

 

;;------------------------=={ Segs }==------------------------;;
;;                                                            ;;
;;  Divides selected objects into an LWPolyline with a        ;;
;;  specified number of segments                              ;;
;;------------------------------------------------------------;;
;;  Author: Lee McDonnell, 2010                               ;;
;;                                                            ;;
;;  Copyright © 2010 by Lee McDonnell, All Rights Reserved.   ;;
;;  Contact: Lee Mac @ TheSwamp.org, CADTutor.net             ;;
;;------------------------------------------------------------;;

(defun c:Segs ( / *error* _StartUndo _EndUndo doc ss )
 (vl-load-com)
 ;; © Lee Mac 2010

 (defun *error* ( msg ) (and doc (_EndUndo doc))
   (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)
   )
 )

 (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)) *segs (cond ( *segs ) ( 10 )))

 (if
   (and
     (setq ss (ssget "_:L" '((0 . "ARC,CIRCLE,LWPOLYLINE,SPLINE,LINE,ELLIPSE"))))
     (progn (initget 6)
       (setq *segs (cond ((getint (strcat "\nSpecify Number of Segments <" (itoa *segs) "> : "))) ( *segs )))
     )
   )
   (
     (lambda ( j / e inc i pts ) (_StartUndo doc)
       
       (while (setq e (ssname ss (setq j (1+ j))))
         (
           (lambda ( inc i / pts )
             
             (repeat (1+ *segs)
               (setq pts (cons (trans (vlax-curve-getPointatDist e (* (setq i (1+ i)) inc)) 0 e) pts))
             )

             (if
               (entmake
                 (append
                   (list
                     (cons 0   "LWPOLYLINE")
                     (cons 100 "AcDbEntity")
                     (cons 100 "AcDbPolyline")
                     (cons 90 (length pts))
                     (cons 38 (caddar pts))
                     (cons 70 0)
                   )
                   (vl-remove-if 'null
                     (mapcar
                       (function (lambda ( d ) (assoc d (entget e)))) '(6 8 39 48 210)
                     )
                   )
                   (mapcar (function (lambda ( a ) (cons 10 a))) pts)
                 )
               )
               (entdel e)
             )
           )
           (/ (vlax-curve-getDistatParam e (vlax-curve-getEndParam e)) (float *segs)) -1
         )
       )
       (_EndUndo doc)
     )
     -1
   )
 )
 (princ)
)

Link to comment
Share on other sites

thank u very much Lee, it really has helped me alot only thing i have to do is to edit the drawing entity into polyline & rest it is working fine, thank u very much again... bro ... :):):D

Link to comment
Share on other sites

I'm also a bit confused. From your OP it doesn't sound as if you want a segmented pline. Maybe I'm just missing something.

 

Otherwise I'd also state: use Measure or Divide. It places point entities along the line / arc / circle / pline / etc. Changing PDMode to something else than 0 makes the points visible as other figures (e.g. PDMode=3 means a point looks like a X) Or you can tell it to place a block instead, rotated along the path or not - usually how I'd have marked chainage points.

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

 Share

×
×
  • Create New...