Jump to content

Recommended Posts

Posted (edited)

In another post there was questions about changing Mline styles for existing Mlines.

 

So answered that and thought what about adding fillets to a mline. Wel as we know you can not do that, so did it this way. Converting the individual mlines to plines then filleting the plines produced. The fillet radius changing matching the offsets.

 

; Convert mline to plines and add a rdius.
; By AlanH Aug 2026

(defun LWPoly (lst cls)
          (entmakex (append (list (cons 0 "LWPOLYLINE")
          (cons 100 "AcDbEntity")
          (cons 100 "AcDbPolyline")
          (cons 90 (length lst))
        (cons 70 cls))
    (mapcar (function (lambda (p) (cons 10 p))) lst)))
)

(defun c:ml2plrad ( / oldsnap pt1 pt2 ent obj obj2 co-ords dict col lst x)

  (setq oldsnap (getvar 'osmode))
  (setvar 'osmode 0)
  
  (setq pt1 (getpoint "\nPick 1st point for drag "))
  (setq pt2 (getpoint pt1 "\nPick 2nd point "))
  
  (setq pts (list pt1 pt2))
  (setq ent (ssname (ssget "F" pts (list (cons 0 "Mline"))) 0))
  (setq obj (vlax-ename->vla-object ent))
  (setq styleName (vla-get-StyleName obj))
  (setq lay (vlax-get obj 'layer))
  (setvar 'clayer lay)
  (setq co-ords (vlax-get obj 'coordinates))
  (vla-delete obj)
  (setq pts2 '() x 0)
  (repeat (/ (length co-ords) 3)
    (setq pts2 (cons (list (nth x co-ords)(nth (1+ x) co-ords)) pts2))
    (setq x (+ x 3))
  )
  (setq dict (dictsearch (cdr (assoc -1 (dictsearch (namedobjdict) "ACAD_MLINESTYLE"))) styleName))
  (setq offsets (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 49)) dict)))
  (setq col (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 62)) dict)))
  (setq col (cdr col))  ; ignore 1st color 
  (setq lst '() x 0)
    (repeat (length col)
    (setq lst (cons (list (nth x offsets)(nth x col)) lst))
    (setq x (1+ x))
  )
  
  (LWPoly pts2 0)
  
  (setvar 'filletrad (getreal "\nEnter Fillet radius for most outside offset "))
  (command "fillet"  "P" (entlast))
  
  (setq x 1)
  (repeat (- (length col) 1)
    (setq obj2 (vlax-ename->vla-object (entlast)))
    (vlax-put obj2 'color (nth (1- x) col))
    (vla-offset (vlax-ename->vla-object (entlast)) (- (nth  x offsets)(nth (1- x) offsets)))
    (setq x (1+ x))
  )
  
  (setq obj2 (vlax-ename->vla-object (entlast)))
  (vlax-put obj2 'color (nth (1- x) col))
  
  (setvar 'osmode oldsnap)
  (princ)
)
(c:ml2plrad)

 

image.png.4be7d04fc7edb5a0eba4202203ebd8d9.png

Edited by BIGAL
Added image
  • Like 3
Posted

I Had a lisp that adds radius to polylines ignoring larger radius then what you where setting. Used it to adjust for CNC permitter routing to avoid share edges. 

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