<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Lisp routine to convert 2d Polyline to polyline in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7124679#M119554</link>
    <description>&lt;P&gt;The CONVERT and CONVERTPOLY commands won't work with splined or fitted 2d polylines, the code I posted does.&lt;/P&gt;
&lt;P&gt;This may be why it's "such a big code" (only 50 lines).&lt;/P&gt;</description>
    <pubDate>Fri, 02 Jun 2017 08:42:19 GMT</pubDate>
    <dc:creator>_gile</dc:creator>
    <dc:date>2017-06-02T08:42:19Z</dc:date>
    <item>
      <title>Lisp routine to convert 2d Polyline to polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7124499#M119546</link>
      <description>&lt;P&gt;HI&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just need to convert 2D Polylines to Polylines in a lisp routine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PEDIT would work, but not in a lisp routine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks...&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2017 07:03:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7124499#M119546</guid>
      <dc:creator>C.Utzinger</dc:creator>
      <dc:date>2017-06-02T07:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to convert 2d Polyline to polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7124580#M119547</link>
      <description>&lt;P&gt;You mean the CONVERTPOLY command? Or 3D Polylines?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Vladimir Michl, &lt;A href="http://www.cadstudio.cz" target="_blank"&gt;www.cadstudio.cz&lt;/A&gt; &amp;nbsp;&lt;A href="http://www.cadforum.cz" target="_blank"&gt;www.cadforum.cz&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2017 07:53:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7124580#M119547</guid>
      <dc:creator>vladimir_michl</dc:creator>
      <dc:date>2017-06-02T07:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to convert 2d Polyline to polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7124592#M119548</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try this old one:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;;; OldStyle2LwPolyline (2008/03/31)
;; Replace a 2d polyline with a light weight polyline
;;
;; Argument : 2d polyline (ename)
;; Return : light weight polyline (ename)

(defun OldStyle2LwPolyline (pl / plst xdata vtx vlst elst)
  (setq	plst  (entget pl '("*"))
	xdata (assoc -3 plst)
	vtx   (entnext pl)
  )
  (while (= (cdr (assoc 0 (setq vlst (entget vtx)))) "VERTEX")
    (if	(zerop (logand (cdr (assoc 70 vlst)) 16))
      (setq elst (cons (vl-remove-if-not
			 (function
			   (lambda (x)
			     (member (car x) '(10 40 41 42))
			   )
			 )
			 vlst
		       )
		       elst
		 )
      )
    )
    (setq vtx (entnext vtx))
  )
  (if (setq new
	     (entmakex
	       (append
		 (list
		   '(0 . "LWPOLYLINE")
		   '(100 . "AcDbEntity")
		   (assoc 410 plst)
		   (assoc 8 plst)
		   (cond
		     ((assoc 39 plst))
		     (T '(39 . 0))
		   )
		   '(100 . "AcDbPolyline")
		   (cons 90 (length elst))
		   (cons 70 (logand 129 (cdr (assoc 70 plst))))
		   (cons 38 (last (caar elst)))
		   (assoc 210 plst)
		 )
		 (apply 'append (reverse elst))
		 (if xdata
		   (list xdata)
		 )
	       )
	     )
      )
    (entdel pl)
  )
  new
)&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Jun 2017 07:58:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7124592#M119548</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2017-06-02T07:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to convert 2d Polyline to polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7124599#M119549</link>
      <description>&lt;P&gt;This command CONVERTPOLY would work also, but not in a Lisp Routine...&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2017 08:04:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7124599#M119549</guid>
      <dc:creator>C.Utzinger</dc:creator>
      <dc:date>2017-06-02T08:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to convert 2d Polyline to polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7124621#M119550</link>
      <description>&lt;P&gt;I just not could made it work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But such a big code? Is there not an easier way, like an easy command, witch works in Lisp?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2017 08:13:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7124621#M119550</guid>
      <dc:creator>C.Utzinger</dc:creator>
      <dc:date>2017-06-02T08:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to convert 2d Polyline to polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7124661#M119551</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;c.utzinger a écrit&amp;nbsp;:&lt;BR /&gt;
&lt;P&gt;I just not could made it work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But such a big code? Is there not an easier way, like an easy command, witch works in Lisp?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;OldStyle2LwPolyline is a sub routine or user defined LISP function which can be used as a built-in function:&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;PRE&gt;(defun c:2DTOLW (/ s i)
  (if (setq s (ssget '((0 . "POLYLINE") (-4 . "&amp;lt;not") (-4 . "&amp;amp;") (70 . 120) (-4 . "not&amp;gt;"))))
    (repeat (setq i (sslength s))
      (OldStyle2LwPolyline (ssname s (setq i (1- i))))
    )
  )
  (princ)
)&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Fri, 02 Jun 2017 08:29:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7124661#M119551</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2017-06-02T08:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to convert 2d Polyline to polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7124667#M119552</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@c.utzinger wrote:&lt;BR /&gt;
&lt;P&gt;&lt;EM&gt;This command CONVERTPOLY would work also, but not in a Lisp Routine...&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;PEDIT would work, but not in a lisp routine.&lt;/EM&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What do you mean, why not?&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2017 08:32:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7124667#M119552</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2017-06-02T08:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to convert 2d Polyline to polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7124672#M119553</link>
      <description>&lt;P&gt;OK, i just find out there is another Problem in the code, i just have to find out why...&lt;/P&gt;
&lt;P&gt;If i don´t, i will write again &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2017 08:33:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7124672#M119553</guid>
      <dc:creator>C.Utzinger</dc:creator>
      <dc:date>2017-06-02T08:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to convert 2d Polyline to polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7124679#M119554</link>
      <description>&lt;P&gt;The CONVERT and CONVERTPOLY commands won't work with splined or fitted 2d polylines, the code I posted does.&lt;/P&gt;
&lt;P&gt;This may be why it's "such a big code" (only 50 lines).&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2017 08:42:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7124679#M119554</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2017-06-02T08:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to convert 2d Polyline to polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7124688#M119555</link>
      <description>&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I found the Problem. Convert works perfect in my case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2017 08:46:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7124688#M119555</guid>
      <dc:creator>C.Utzinger</dc:creator>
      <dc:date>2017-06-02T08:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to convert 2d Polyline to polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7127445#M119556</link>
      <description>&lt;P&gt;Yay, UTZ! &amp;nbsp;I think I found that you can accept your own solution. &amp;nbsp;:]&lt;/P&gt;</description>
      <pubDate>Sat, 03 Jun 2017 23:39:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7127445#M119556</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2017-06-03T23:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to convert 2d Polyline to polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7127949#M119557</link>
      <description>&lt;P&gt;LOL&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps in another place and another time &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Sun, 04 Jun 2017 18:31:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7127949#M119557</guid>
      <dc:creator>C.Utzinger</dc:creator>
      <dc:date>2017-06-04T18:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp routine to convert 2d Polyline to polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7127975#M119558</link>
      <description>&lt;P&gt;I just stumbled on this, which you might find to be fun...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;  ;;------------------------------------------------------------
  ;; Function created (06-10-02) to convert a complex 2dPolyline
  ;; (Type 1 = Fit curved, Type 2,3 = Splined)
  ;; into a Type 0 = Simple
  ;; while retaining all geometry.
  ;; Revised (07-06-02) to handle 3D polylines as well.
  ;;
  (defun @cv_simplify (e0 / Object e ent Visible Param Done P Sw Ew Bulge
                            Vlist Blist Wlist Width Werror 2D)
    (cond
      ((= (type e0) 'VLA-Object)
        (setq Object e0 e0 (vlax-vla-object-&amp;gt;ename Object))
      )
      ((= (type e0) 'ENAME)
        (setq Object (vlax-ename-&amp;gt;vla-object e0))
      )
    )
    (setq Visible (vla-get-Visible Object)
          Width   (vl-catch-all-apply 'vla-get-ConstantWidth (list Object))
          Werror  (vl-catch-all-error-p Width)
          2D      (= (vla-get-ObjectName Object) "AcDb2dPolyline")
          e       e0
    )
    (while (not Done)
      (and
        (setq e (entnext e))
        (setq ent (entget e))
        (or (= (cdr (assoc 0 ent)) "VERTEX")
            (not (setq Done 1))
        )
        (/= (logand 16 (cdr (assoc 70 ent))) 16) ; spline control point
        (setq P (cdr (assoc 10 ent)))
        (setq Vlist (cons P Vlist))
        2D
        (or
          (not Werror)
          (setq Sw    (cdr (assoc 40 ent))
                Ew    (cdr (assoc 41 ent))
                Wlist (cons (cons Sw Ew) Wlist)
          )
        )
        (setq Bulge (cdr (assoc 42 ent)))
        (setq Blist (cons Bulge Blist))
      )
    )
    (setq Blist (reverse Blist)
          Wlist (reverse Wlist)
    )
    (if (= Visible :vlax-true)
      (vla-put-visible Object :vlax-false)
    )
    (vla-put-type Object 0)
    (vlax-release-object Object)
    (setq Object (vlax-ename-&amp;gt;vla-object e0))
    (vlax-put Object "Coordinates" (apply 'append (reverse Vlist)))
    (setq Param 0)
    (repeat (length Blist)
      (vla-setbulge Object Param (nth Param Blist))
      (and
        Werror
        (setq Width (nth Param Wlist))
        (vla-setwidth Object Param (car Width)(cdr Width))
      )
      (setq Param (1+ Param))
    )
    (if (not Werror)
      (vla-put-ConstantWidth Object Width)
    )
    (vla-put-visible Object Visible)
  )
&lt;/PRE&gt;</description>
      <pubDate>Sun, 04 Jun 2017 19:02:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-routine-to-convert-2d-polyline-to-polyline/m-p/7127975#M119558</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2017-06-04T19:02:12Z</dc:date>
    </item>
  </channel>
</rss>

