<?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: Closing a polyline in AutoCAD Forum</title>
    <link>https://forums.autodesk.com/t5/autocad-forum/closing-a-polyline/m-p/6530197#M263359</link>
    <description>&lt;P&gt;Welcome to these Forums!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can't explain that behavior, though there is a certain predictability about it, most of the time.&amp;nbsp; When you&amp;nbsp;draw one that ends with an arc segment &lt;EM&gt;without&lt;/EM&gt; closing it, the final vertex's bulge factor entry in entity data&amp;nbsp;seems to be&amp;nbsp;the complement of the last segment [the factor that gives the rest of the circle of which that arc segment is a part], so when you close it in the Properties box, the closing arc segment&amp;nbsp;has that bulge factor.&amp;nbsp; And when you do it with PEDIT, it closes with&amp;nbsp;an arc segment that's a&amp;nbsp;tangent continuation, as it would be if you had used the CLose option in drawing it.&amp;nbsp; But &lt;EM&gt;not always&lt;/EM&gt; -- it seems to be affected by editing.&amp;nbsp; For instance, if you draw one closed with a &lt;EM&gt;line&lt;/EM&gt; segment&amp;nbsp;but with the last segment before that being an arc, and &lt;EM&gt;then un-close it&lt;/EM&gt; in Properties, its final-vertex bulge factor&amp;nbsp;&lt;EM&gt;remains&lt;/EM&gt;&amp;nbsp;0.0 as&amp;nbsp;it was for the original closing line segment, so if you close it again [in Properties, not via PEDIT], it will&amp;nbsp;close with&amp;nbsp;a line segment again.&amp;nbsp; Or if you drag a grip on that last arc segment, it seems the bulge factor for the last vertex doesn't end up with the same relationship to that of the last segment.&amp;nbsp; Or if you build a Polyline by PEDIT-Joining some Lines and Arcs, then even if the last resulting segment is an arc, closing in Properties will be with a line segment.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But here's a simple [minimally tested] routine to do it with a line segment &lt;EM&gt;regardless&lt;/EM&gt; of initial conditions or subsequent editing:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(vl-load-com); if needed
(defun C:PLCL ; = PolyLine Close, always with Line segment
  (/ plsel pl)
  (if
    (and
      (setq plsel (entsel "\nSelect open Polyline to close with line segment: "))
      (setq pl (car plsel))
      (= (cdr (assoc 0 (entget pl))) "LWPOLYLINE")
      (not (vlax-curve-isClosed pl))
    ); and
    (command ; then
      "_.line" (vlax-curve-getStartPoint pl) (vlax-curve-getEndPoint pl) ""
      "_.pedit" pl "_join" (entlast) "" ""
    ); command
    (prompt "\nNot an open lightweight Polyline."); else
  ); if
  (princ)
); defun&lt;/PRE&gt;
&lt;P&gt;With a little more code, it could be made to allow "heavy" 2D Polylines, but would need to forbid &lt;EM&gt;3D&lt;/EM&gt; ones under this approach, because even though PEDIT &lt;EM&gt;offers&lt;/EM&gt; the Join option for them, for some reason it seems you can't join a Line to one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 30 Aug 2016 02:03:20 GMT</pubDate>
    <dc:creator>Kent1Cooper</dc:creator>
    <dc:date>2016-08-30T02:03:20Z</dc:date>
    <item>
      <title>Closing a polyline</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/closing-a-polyline/m-p/6529868#M263358</link>
      <description>&lt;P&gt;Depending on the shape of&amp;nbsp; polyline, the Close command in PEDIT will close the polyline with and arc or with a line.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to always close the polyline with a line (not and arc, no matter what the polyline looks like)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, it seems that given the same polyline, the result of closing using the PEDIT is different than using the property bar close path. Is this normal?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(Using Autocad 2014)&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 21:13:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/closing-a-polyline/m-p/6529868#M263358</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-08-29T21:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: Closing a polyline</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/closing-a-polyline/m-p/6530197#M263359</link>
      <description>&lt;P&gt;Welcome to these Forums!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can't explain that behavior, though there is a certain predictability about it, most of the time.&amp;nbsp; When you&amp;nbsp;draw one that ends with an arc segment &lt;EM&gt;without&lt;/EM&gt; closing it, the final vertex's bulge factor entry in entity data&amp;nbsp;seems to be&amp;nbsp;the complement of the last segment [the factor that gives the rest of the circle of which that arc segment is a part], so when you close it in the Properties box, the closing arc segment&amp;nbsp;has that bulge factor.&amp;nbsp; And when you do it with PEDIT, it closes with&amp;nbsp;an arc segment that's a&amp;nbsp;tangent continuation, as it would be if you had used the CLose option in drawing it.&amp;nbsp; But &lt;EM&gt;not always&lt;/EM&gt; -- it seems to be affected by editing.&amp;nbsp; For instance, if you draw one closed with a &lt;EM&gt;line&lt;/EM&gt; segment&amp;nbsp;but with the last segment before that being an arc, and &lt;EM&gt;then un-close it&lt;/EM&gt; in Properties, its final-vertex bulge factor&amp;nbsp;&lt;EM&gt;remains&lt;/EM&gt;&amp;nbsp;0.0 as&amp;nbsp;it was for the original closing line segment, so if you close it again [in Properties, not via PEDIT], it will&amp;nbsp;close with&amp;nbsp;a line segment again.&amp;nbsp; Or if you drag a grip on that last arc segment, it seems the bulge factor for the last vertex doesn't end up with the same relationship to that of the last segment.&amp;nbsp; Or if you build a Polyline by PEDIT-Joining some Lines and Arcs, then even if the last resulting segment is an arc, closing in Properties will be with a line segment.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But here's a simple [minimally tested] routine to do it with a line segment &lt;EM&gt;regardless&lt;/EM&gt; of initial conditions or subsequent editing:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(vl-load-com); if needed
(defun C:PLCL ; = PolyLine Close, always with Line segment
  (/ plsel pl)
  (if
    (and
      (setq plsel (entsel "\nSelect open Polyline to close with line segment: "))
      (setq pl (car plsel))
      (= (cdr (assoc 0 (entget pl))) "LWPOLYLINE")
      (not (vlax-curve-isClosed pl))
    ); and
    (command ; then
      "_.line" (vlax-curve-getStartPoint pl) (vlax-curve-getEndPoint pl) ""
      "_.pedit" pl "_join" (entlast) "" ""
    ); command
    (prompt "\nNot an open lightweight Polyline."); else
  ); if
  (princ)
); defun&lt;/PRE&gt;
&lt;P&gt;With a little more code, it could be made to allow "heavy" 2D Polylines, but would need to forbid &lt;EM&gt;3D&lt;/EM&gt; ones under this approach, because even though PEDIT &lt;EM&gt;offers&lt;/EM&gt; the Join option for them, for some reason it seems you can't join a Line to one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2016 02:03:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/closing-a-polyline/m-p/6530197#M263359</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2016-08-30T02:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: Closing a polyline</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/closing-a-polyline/m-p/6532154#M263360</link>
      <description>&lt;P&gt;Thank you, works very well.&lt;/P&gt;&lt;P&gt;I wonder if is possible to extend it so multiple polylines can be selected and closed in the same way with a line.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2016 19:28:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/closing-a-polyline/m-p/6532154#M263360</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-08-30T19:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: Closing a polyline</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/closing-a-polyline/m-p/6532205#M263361</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;
&lt;P&gt;Thank you, works very well.&lt;/P&gt;
&lt;P&gt;I wonder if is possible to extend it so multiple polylines can be selected and closed in the same way with a line.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Certainly.&amp;nbsp; Give this a shot [again, minimally tested, and it could be enhanced in several ways]:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(vl-load-com); if needed
(defun C:PLCL ; = PolyLine(s) Close, always with Line segment
  (/ ss n pl)
  (prompt "\nTo Close open Polylines, always with line segments,")
  (if (setq ss (ssget "_:L" '((0 . "LWPOLYLINE"))))
    (repeat (setq n (sslength ss))
      (setq pl (ssname ss (setq n (1- n))))
      (if (not (vlax-curve-isClosed pl))
        (command ; then
          "_.line" (vlax-curve-getStartPoint pl) (vlax-curve-getEndPoint pl) ""
          "_.pedit" pl "_join" (entlast) "" ""
        ); command
      ); if
    ); repeat
  ); if
  (princ)
); defun&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Aug 2016 19:52:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/closing-a-polyline/m-p/6532205#M263361</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2016-08-30T19:52:17Z</dc:date>
    </item>
    <item>
      <title>Re: Closing a polyline</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/closing-a-polyline/m-p/6533449#M263362</link>
      <description>Thank you, it is exactly what I needed.</description>
      <pubDate>Wed, 31 Aug 2016 11:07:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/closing-a-polyline/m-p/6533449#M263362</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-08-31T11:07:51Z</dc:date>
    </item>
  </channel>
</rss>

