Convert Double Line to Multiline

Convert Double Line to Multiline

bahaatawfiq
Participant Participant
3,414 Views
15 Replies
Message 1 of 16

Convert Double Line to Multiline

bahaatawfiq
Participant
Participant

Hello Every one,

I have Mechanical Shop Drawings Project  Which Draw all Pipes as a Double Line With Offset Equal to the Pipe Diameter, I am Looking To Lisp File convert the Double line to multiline with Mline Scale Equal to the offset, So I Could Filter the Pipes By QSelect  As Per Milne Scale and Count the Quantities For Each Pipe Size. 

0 Likes
Accepted solutions (2)
3,415 Views
15 Replies
Replies (15)
Message 2 of 16

ВeekeeCZ
Consultant
Consultant

Welcome to the forums!

Start with posting a sample dwg file.

0 Likes
Message 3 of 16

bahaatawfiq
Participant
Participant

Yes Sure , Please Find the attached Drawings For Project Sample have Water Piping i need To Convert the Double Line to MultiLine so i can Filter the Pipe As per the Sizing 

0 Likes
Message 4 of 16

bahaatawfiq
Participant
Participant

as there any way to change Change Solid hatch to Polyline with Global Width

 

0 Likes
Message 5 of 16

ВeekeeCZ
Consultant
Consultant

Well, not sure what you can see, but I see just plain lines. No double lines (if that's the thing). Even no solids.

You need to get help from someone with the SW. Nobody in this forum afaik. 

 

Z9E3zK5E_0-1635626296207.png

 

0 Likes
Message 6 of 16

bahaatawfiq
Participant
Participant

bahaatawfiq_1-1635626572308.png

is there any way to convert this solid hatch to polyline with the same Global Width 

0 Likes
Message 7 of 16

АлексЮстасу
Advisor
Advisor

If there are axes of pipes, then pl2ml.vlx - replacing polylines with active style multilines.

 

Even for multilines, the following may be useful:
- SETML.lsp - set the multiline style as active,
- ML1.lsp - replace multilines of one style with another (ML4 command),
- M_EX_P.lsp - replacing multilines with polylines.

Etc.

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

Message 8 of 16

Kent1Cooper
Consultant
Consultant

@bahaatawfiq wrote:

bahaatawfiq_1-1635626572308.png

is there any way to convert this solid hatch to polyline with the same Global Width 


Are they always plain rectangular Hatches like the image, without bends or curves, that would become single-line-segment Polylines?  If so, I can imagine a way to do it.

Kent Cooper, AIA
0 Likes
Message 9 of 16

bahaatawfiq
Participant
Participant

yes all of the hatch will be Rectangular shape, I will be glade if you help me with this 

0 Likes
Message 10 of 16

Sea-Haven
Mentor
Mentor

Count 2 parallel lines can be done by just getting all the lines say by layer, you then make a list of length of lines. Thanks to Gile is remove duplicates so get a new list of all lengths, than again thanks to Gile do a count of the lines that match the lengths, I have done this for a quantities lisp. Will have to look at it and pull the relevant parts out. In future a mline much easier to work with.

 

 

 

 

; Make a count of paralell 2 lines of same length.
; By AlanH Aug 2021
(vl-load-com)

; By Gile
(defun my-count (a L)
  (cond
   ((null L) 0)
   ((equal a (car L)) (+ 1 (my-count a (cdr L))))
   (t (my-count a (cdr L))))
)

; By Gile
(defun remove_doubles (lst)
  (if lst
    (cons (car lst) (remove_doubles (vl-remove (car lst) lst)))
  )
)

(defun c:count2lines ( / ss lst1 lst2 lst3 obj x len lname cnt)

(setq lst1 '() lst2 '() lst3 '())
(setq ss (ssget  (list (cons 0 "LINE")(cons 410 (getvar 'ctab)))))

(repeat (setq x (sslength ss))
(setq obj (vlax-ename->vla-object (ssname ss (setq x (1- x)))))
(if (= (vla-get-objectname obj ) "AcDbLine")
(progn
(setq lname (vla-get-layer obj))
(setq len (rtos (vla-get-length obj) 2 3))
(setq lst1 (cons (list lname len ) lst1))
)
)
)

(setq lst2 (remove_doubles lst1))
(foreach val lst2
(setq cnt (my-count val lst1))
(setq lst3 (cons (list  (nth 0 val) (nth 1 val)(/ cnt 2)) lst3))
)

(setq lst3 
  (vl-sort lst3 '(lambda (a b)
  (cond
    ((< (cadr a) (cadr b)))
    ((= (cadr a) (cadr b)) (< (car a) (car b)))
  )
  )
  )
)

(princ)

)

(c:count2lines)

 

 

 

 

 

0 Likes
Message 11 of 16

bahaatawfiq
Participant
Participant
The Reason Why I need to convert the Double line to mullite line or Polyline With The Same Global Width so I can make Filter For Sizing and Equal the Total Length For Each Size alone, I am Now Convert all Double line to Solid Hatch but I need To convert this Hatch To Polyline With Same Width. I didn't Find any Method to do this
0 Likes
Message 12 of 16

marko_ribar
Advisor
Advisor
Accepted solution

Have you tried HATCHEDIT command and recreate boundary option? IMHO this is the simplest way...

Marko Ribar, d.i.a. (graduated engineer of architecture)
0 Likes
Message 13 of 16

ВeekeeCZ
Consultant
Consultant
Accepted solution

There is also HATCHGENERATEBOUNDADY for multiple selection.

 

I've played with the conversion to plwidth a bit, not bulletproof, but it should work too.

Not testing whether it's really rectange... unseparated boundaries... 

 

(vl-load-com)

(defun c:Hatch2PolylineWidth ( / :midpt s i l e w)
  
  (defun :midpt (p1 p2) (mapcar '/ (mapcar '+ p1 p2) '(2 2)))
  
  (if (setq s (ssget '((0 . "HATCH") (93 . 4))))
    (repeat (setq i (sslength s))
      (setq e (ssname s (setq i (1- i))))
      (setq l (cdr (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= 10 (car x))) (entget e)))))
      (entmake (append '((0 . "LWPOLYLINE") (100 . "AcDbEntity") (100 . "AcDbPolyline") (90 . 2) (70 . 0))
		       (list (assoc 8 (entget e)))
		       (if (> (distance (car l) (nth 1 l))
			      (distance (car l) (nth 3 l)))
			 (list (cons 10 (:midpt (nth 0 l) (nth 3 l)))
			       (cons 40 (setq w (distance (nth 0 l) (nth 3 l))))
			       (cons 41 w)
			       (cons 10 (:midpt (nth 1 l) (nth 2 l)))
			       (cons 40 w)
			       (cons 41 w))
			 (list (cons 10 (:midpt (nth 0 l) (nth 3 l)))
			       (cons 40 (setq w (distance (nth 0 l) (nth 3 l))))
			       (cons 41 w)
			       (cons 10 (:midpt (nth 1 l) (nth 2 l)))
			       (cons 40 w)
			       (cons 41 w)))))
      (entdel e)))
  (princ)
  )

 

0 Likes
Message 14 of 16

bahaatawfiq
Participant
Participant
it is Work Great Thank You Very Much
0 Likes
Message 15 of 16

bahaatawfiq
Participant
Participant
it has only small issue The Length Of the Polyline became The Width Of the Pipe In need the Reverse of this Can You Help Me With This, I need the Width Of the Hatch became the same of Width Of the Polyline
0 Likes
Message 16 of 16

ВeekeeCZ
Consultant
Consultant

Post a drawing dwg with a few examples that I can later look at it. Some that go right (if any) are some that go wrong.

If you have pipes that length < diameter, those go wrong for sure.

0 Likes