Mohamed Haytham Posted 5 hours ago Posted 5 hours ago Hi, It would be great if you can help me with the following. I have multiple polylines where they have different widths (Originally creating by fillet a line with width 1 and a line with width 2). Is there a way to split them to the original state where the are 2 lines and each has it's actual widths? I am attaching a file with the issue, and the expected solution, but this is only file with 2 polylines as an example, but this issue is happening with a file having more than 1000 polyline. Break Polyline at different depth.dwg Quote
Nikon Posted 1 hour ago Posted 1 hour ago Try this code ;; author ::Jaifl:: ;; divides polylines into separate segments, preserving thickness, color, layer (defun c:SplitPlSeg ( / ss i ent elist points widths bulges n j p1 p2 w1 w2 bulge color layer ltype lweight transp) (setq ss (ssget '((0 . "LWPOLYLINE")))) (if ss (progn (setq i 0) (while (< i (sslength ss)) (setq ent (ssname ss i)) (setq elist (entget ent)) (setq color (assoc 62 elist)) (setq layer (assoc 8 elist)) (setq ltype (assoc 6 elist)) (setq lweight (assoc 370 elist)) (setq transp (assoc 440 elist)) (setq points '() widths '() bulges '()) (foreach x elist (cond ((= (car x) 10) (setq points (append points (list (cdr x))))) ((= (car x) 40) (setq widths (append widths (list (cdr x))))) ((= (car x) 41) (setq widths (append widths (list (cdr x))))) ((= (car x) 42) (setq bulges (append bulges (list (cdr x))))) ) ) (setq n (length points)) (setq j 0) (while (< j (1- n)) (setq p1 (nth j points)) (setq p2 (nth (+ j 1) points)) (setq w1 (nth (* j 2) widths)) ; Start width (setq w2 (nth (1+ (* j 2)) widths)) ; End width (setq bulge (if (< j (length bulges)) (nth j bulges) 0.0)) (setq newent (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") layer ) (if color (list color) '()) (if ltype (list ltype) '()) (if lweight (list lweight) '()) (if transp (list transp) '()) (list (cons 100 "AcDbPolyline") (cons 90 2) (cons 70 0) (list 10 (car p1) (cadr p1)) (cons 40 w1) (cons 41 w2) (cons 42 bulge) (list 10 (car p2) (cadr p2)) (cons 40 w2) (cons 41 w2) ) ) ) (entmake newent) (setq j (1+ j)) ) (entdel ent) ; delete the original polyline (setq i (1+ i)) ) ) (princ "There are no selected polylines.") ) (princ) ) 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.