Author Topic: Merge all mlines  (Read 1437 times)

0 Members and 1 Guest are viewing this topic.

mbrandt5

  • Newt
  • Posts: 44
Merge all mlines
« on: September 01, 2017, 04:20:58 PM »
After scrolling the web...I can't seem to find a command to Merge all Mlines intersecting.  Anyone ever here of a code like that...seems hard to believe that isn't a standard autocad function.  :crazy2::uglystupid2:

mbrandt5

  • Newt
  • Posts: 44
Re: Merge all mlines
« Reply #1 on: September 01, 2017, 04:24:44 PM »
Seems like you could make a list, do an MLEDIT and have every item be the first and second choosen line...but that'd be alot of work for autocad
« Last Edit: September 01, 2017, 04:53:29 PM by mbrandt5 »

mbrandt5

  • Newt
  • Posts: 44
Re: Merge all mlines
« Reply #2 on: October 02, 2017, 09:53:52 AM »
I think it'd be cool maybe I'll dabble with it sometime...If someone else does first please let me know.  Thanks

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Merge all mlines
« Reply #3 on: October 02, 2017, 07:49:31 PM »
Ah, mlines one of the most promising features in AutoCAD, yet one of the most lacking in needed features.

mbrandt5

  • Newt
  • Posts: 44
Re: Merge all mlines
« Reply #4 on: October 16, 2017, 05:51:24 PM »
Agreed Revit it up autodesk

mbrandt5

  • Newt
  • Posts: 44
Re: Merge all mlines
« Reply #5 on: November 07, 2017, 03:39:26 PM »
I found a code lee mac made poking around...though I found it to confuse types of intersections when lines touch at more than one point.

Has anyone seen a lisp that trims everything between to parallel plines on the same layer that are a give distance apart 6", 8", 10", 12", 14"
So that only overlapping lines would be trimmed? 


Code: [Select]
(defun c:mlfix ( / cm e1 e2 i1 i2 il m1 m2 o1 o2 p1 ss )
    (if (setq ss (ssget "_:L" '((0 . "MLINE"))))                                                                           
        (progn
            (setq cm (getvar 'cmdecho))    
            (setvar 'cmdecho 0)    
            (repeat (setq i1 (sslength ss))    
                (setq e1 (ssname ss (setq i1 (1- i1)))    
                      o1 (vlax-ename->vla-object e1)    
                )
                (repeat (setq i2 i1)    
                    (setq e2 (ssname ss (setq i2 (1- i2)))    
                          o2 (vlax-ename->vla-object e2)    
                          il (group3 (vlax-invoke o1 'intersectwith o2 acextendnone))    
                    )
                    (cond
                        (   (= 1 (length il))    
                            (command "_.-mledit" "_CJ" (list e1 (car il)) (list e2 (car il)) "")    
                        )
                        (   (= 4 (length il))    
                            (command "_.-mledit" "_OC" (list e1 (car il)) (list e2 (cadr il)) "")    
                        )
                        (   (= 2 (length il))                                                                       
                            (setq p1 (car il)    
                                  m1 (group3 (vlax-get o1 'coordinates))    
                                  m2 (group3 (vlax-get o2 'coordinates))    
                            )
                            (if (<  (min (distance p1 (car m1)) (distance p1 (last m1)))    
                                    (min (distance p1 (car m2)) (distance p1 (last m2)))    
                                )
                                (command "_.-mledit" "_OT" (list e1 (car il)) (list e2 (cadr il)) "")    
                                (command "_.-mledit" "_OT" (list e2 (car il)) (list e1 (cadr il)) "")    
                            )
                        )
                    )
                )
            )
            (setvar 'cmdecho cm)
        )
    )
    (princ)
)
 
(defun group3 ( l / r )
    (repeat (/ (length l) 3)
        (setq r (cons (list (car l) (cadr l) (caddr l)) r)  
              l (cdddr l)  
        )
    )  
    (reverse r)  
)
(vl-load-com) (princ)