If youve ever tried the DIVIDE command on a Poly Line, You know the frustration that usually follows that adventure. Here is a great Routine that allows you to easily do this task.
Note that places “Points” as the division markers like the Divide command. So set your Point size and style with the command DDPTYPE prior to running this routine. It does not actually divide the polyline but rather marks the divisions with points. Also Note that this routine asks you to pick 2 points along the poly line, so this routine only works on straight segments of polylines. Then Specify the number of segments, not the number of points.
Here’s how:
- DIVSIDE <enter>
- Specify first point along poly line
- Specify second point along poly line
- Specify number of segments between the 2 picked points.
~enjoy
;divide a side of a polyline into segments ;by Thawart found at autocad forums. (defun c:divside (/ p1 p2 v l pt) (if (and (setq p1 (getpoint "\n Specify first point :")) (setq p2 (getpoint p1 "\n Specify Second point :")) (setq v (getint "\n Specify number of segments :")); changed "division points" to "segments" ) (progn (if (eq (getvar 'pdmode) 0) (setvar 'pdmode 3) ) (setq l (/ (distance p1 p2) v)) (repeat (- v 1) (setq pt (polar p1 (angle p1 p2) l)) (entmakex (list (cons 0 "POINT") (cons 10 pt))) (setq p1 pt) ) ) (princ) ) (princ) )
How to divide multiple lines/poly lines at once. Is there any LISP that can do as I ahve to deal with thousands of lines
Try the below LISP routine. It doesn’t actually divide or break the objects. It does place points along the objects.
Adjust the size and shape of the points to be more easily seen by using the DDPTYPE command.
;; Paul Turvill
;; Divides multiple obects at once by placing Points along the object
;; TIP: Adjust the DDPTYPE to see the points better
;; http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Divide-lisp/td-p/838916
(defun C:MDIV (/ ss n segs)
(setq ss (ssget ‘((0 . “LINE,POLYLINE,LWPOLYLINE,ARC,CIRCLE”)))
n (1- (sslength ss))
segs (getint “\Number of segments per object: “)
)
(while (>= n 0)
(command “_.divide” (ssname ss n) segs)
(setq n (1- n))
)
(princ)
)
I need the lisp program for the rectangle with a slot cut