(defun C:convert_PolyFaceMesh_polyline (/
					curent-pline face-list flag-all flag-pl line-list list-entget list-pline number obj obj-v vertex-list
					nabor SUM
					)
  (load_global_variable)
  (vla-StartUndoMark active_document)
  (setq nabor(ssget "_X" '((0 . "POLYLINE"))))
  (setq nabor(convert_ss_to_list nabor))
  (terpri)
  (setq sum (length nabor))
  (princ (strcat"\r  1/"(itoa(length nabor))))
  (repeat sum
    (setq obj (car nabor))
    (setq nabor(cdr nabor))
    (princ (strcat"\r  "(itoa(- sum (length nabor)))"/"(itoa sum)))
    (if (= (cdr (nth 10 (entget obj))) "AcDbPolyFaceMesh")
      (progn
	(setq obj-v(entnext obj))
	(setq list-entget(entget obj-v))
	(while (not(= (cdr (assoc 0 list-entget)) "SEQEND"))
	  (if (= (cdr (nth 10 list-entget)) "AcDbVertex")
	    (setq vertex-list(append vertex-list (list (cdr (assoc 10 list-entget)))))
	    (setq face-list(append face-list (list (list (cdr (assoc 71 list-entget))
							 (cdr (assoc 72 list-entget))
							 (cdr (assoc 73 list-entget))
							 (cdr (assoc 74 list-entget))))))
	    )
	  (setq obj-v(entnext obj-v))
	  (setq list-entget(entget obj-v))
	  )
	(foreach x face-list
	  (setq line-list(append line-list (list(list (nth(1-(abs(nth 0 x)))vertex-list)(nth(1-(abs(nth 3 x)))vertex-list))
						(list (nth(1-(abs(nth 1 x)))vertex-list)(nth(1-(abs(nth 2 x)))vertex-list))
						)))
	  )
	(setq vertex-list nil
	      face-list nil)
	(gc)
	(while (not flag-all)
	  (setq number 0)
	  (setq flag-pl nil)
	  (setq curent-pline (car line-list))
	  (setq line-list(cdr line-list))
	  (if (eq line-list nil)
	    (setq flag-pl T)
	    )
	  (while (not flag-pl)
	    (cond
	      ((and (= (nth 0 (nth 0 curent-pline)) (nth 0 (nth 0 (nth number line-list))))
		    (= (nth 1 (nth 0 curent-pline)) (nth 1 (nth 0 (nth number line-list)))))
	       (setq curent-pline(cons (nth 1 (nth number line-list)) curent-pline))
	       (setq line-list(vl-remove(nth number line-list)line-list))
	       (setq number 0)
	       )
	      ((and (= (nth 0 (nth 0 curent-pline)) (nth 0 (nth 1 (nth number line-list))))
		    (= (nth 1 (nth 0 curent-pline)) (nth 1 (nth 1 (nth number line-list)))))
	       (setq curent-pline(cons (nth 0 (nth number line-list)) curent-pline))
	       (setq line-list(vl-remove(nth number line-list)line-list))
	       (setq number 0)
	       )
	      ((and (= (nth 0 (nth (1-(length curent-pline)) curent-pline)) (nth 0 (nth 0 (nth number line-list))))
		    (= (nth 1 (nth (1-(length curent-pline)) curent-pline)) (nth 1 (nth 0 (nth number line-list)))))
	       (setq curent-pline(append curent-pline(list(nth 1 (nth number line-list)))))
	       (setq line-list(vl-remove(nth number line-list)line-list))
	       (setq number 0)
	       )
	      ((and (= (nth 0 (nth (1-(length curent-pline)) curent-pline)) (nth 0 (nth 1 (nth number line-list))))
		    (= (nth 1 (nth (1-(length curent-pline)) curent-pline)) (nth 1 (nth 1 (nth number line-list)))))
	       (setq curent-pline(append curent-pline(list(nth 0 (nth number line-list)))))
	       (setq line-list(vl-remove(nth number line-list)line-list))
	       (setq number 0)
	       )
	      (T
	       (setq number (1+ number))
	       )
	      )
	    (if(or(eq line-list nil)
		  (> number(1-(length line-list)))
		  )
	      (setq flag-pl T)
	      )
	    (bump)
	    )
	  (setq list-pline(append list-pline(list curent-pline)))
	  (if (eq line-list nil)
	    (setq flag-all T)
	    )
	  )
	(foreach x list-pline
	  (draw-lwpolyline-vla-by-list-property
	    (list(cons "spece" model_spece)
		 (cons "Coordinates" x)
		 (cons "Layer" (cdr (assoc 8 (entget obj))))
		 (cons "Color" (cdr (assoc 62 (entget obj))))
		 (cons "Linetype" "Continuous")
		 ))
	  )
	(entdel obj)
	)
      )
    (setq list-pline nil
	  obj nil
	  obj-v nil
	  curent-pline nil
	  flag-all nil
	  flag-pl nil)
    )
  (vla-EndUndoMark active_document)
  (princ)
  )