<?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: Help with lisp - join polylines external/internal in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-join-polylines-external-internal/m-p/13162235#M6145</link>
    <description>&lt;P&gt;Yuval hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you for that&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":flexed_biceps:"&gt;💪&lt;/span&gt;&lt;/P&gt;&lt;P&gt;i still would like to know what these plines represent?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Moshe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Nov 2024 08:14:54 GMT</pubDate>
    <dc:creator>Moshe-A</dc:creator>
    <dc:date>2024-11-20T08:14:54Z</dc:date>
    <item>
      <title>Help with lisp - join polylines external/internal</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-join-polylines-external-internal/m-p/13157925#M6141</link>
      <description>&lt;P&gt;Hi, I would be happy if someone can help me with a simple lisp.&lt;/P&gt;&lt;P&gt;I have polylines and lines in DWG - A (attached) I need to convert all the internal lines into closed polylines&amp;nbsp; in layer "internal" and&amp;nbsp; the external polyline to a closed one in layer "external". If there is an open polyline it will be in layer - "open".&amp;nbsp; so the result will be DWG -B (attached).&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much in advance&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2024 17:58:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-join-polylines-external-internal/m-p/13157925#M6141</guid>
      <dc:creator>yu85.info</dc:creator>
      <dc:date>2024-11-18T17:58:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help with lisp - join polylines external/internal</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-join-polylines-external-internal/m-p/13158446#M6142</link>
      <description>&lt;P&gt;When you say "&lt;EM&gt;help&lt;/EM&gt; with a simple lisp"...have you made attempts to write it yourself, something you could share? Or are you needing someone to write the entire routine?&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2024 22:08:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-join-polylines-external-internal/m-p/13158446#M6142</guid>
      <dc:creator>Rick_Tolleshaug_TSC</dc:creator>
      <dc:date>2024-11-18T22:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: Help with lisp - join polylines external/internal</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-join-polylines-external-internal/m-p/13158503#M6143</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3808012"&gt;@yu85.info&lt;/a&gt;&amp;nbsp;hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Check this IEP (Internal \ External Polyline) command.&lt;/P&gt;&lt;P&gt;explain what these polylines represent?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;enjoy&lt;/P&gt;&lt;P&gt;Moshe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;;; Intersections  -  Lee Mac
;; Returns a list of all points of intersection between two objects
;; for the given intersection mode.
;; ob1,ob2 - [vla] VLA-Objects
;;     mod - [int] acextendoption enum of intersectwith method

(defun LM:intersections ( ob1 ob2 mod / lst rtn )
    (if (and (vlax-method-applicable-p ob1 'intersectwith)
             (vlax-method-applicable-p ob2 'intersectwith)
             (setq lst (vlax-invoke ob1 'intersectwith ob2 mod))
        )
        (repeat (/ (length lst) 3)
            (setq rtn (cons (list (car lst) (cadr lst) (caddr lst)) rtn)
                  lst (cdddr lst)
            )
        )
    )
    (reverse rtn)
); LM:intersections


; Internal External Polylines

(defun c:IEP (/ _clwp _areas _midpt _3d-&amp;gt;2d _isexist  ; local function
	        ss1 ss2 ss3 ss4 ename data^ exAcDbPline inAcDbPline item AcDbRegion AcDbRay c0 c1 ang o1 o2 area lst)

 (defun _clwp (ename / elist)
  (setq elist (entget ename))
  (cond
   ((= (logand (cdr (assoc '70 elist)) 1) 1) ; closed pline
    t
   ); case
   ((and
      (= (logand (cdr (assoc '70 elist)) 0) 0) ; open pline
      (equal (distance (vlax-curve-getEndPoint ename) (vlax-curve-getStartPoint ename)) 0.0 1e-3)
    )
    (command "._pedit" ename "_close" "")
    t
   ); case
  ); cond
 ); _clwp
  
 (defun _areas (ss0)
  (vl-sort
   (vl-remove-if
     'not
     (mapcar
       (function
         (lambda (ename / area)
	   (if (&amp;gt; (setq area (vlax-curve-getArea ename)) 0.0)
	    (cons (vlax-curve-getArea ename) ename)
	   )
         ); lambda
       ); function
       (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss0)))
     ); mapcar
   ); vl-remove-if
   (function (lambda (e0 e1) (&amp;gt; (car e0) (car e1))))
  ); vl-sort
 ); _areas

 (setq _midpt (lambda (p0 p1) (mapcar (function (lambda (x0 x1) (/ (+ x0 x1) 2))) p0 p1)))
 (setq _3d-&amp;gt;2d (lambda (pt) (reverse (cdr (reverse pt)))))
 (setq _isexist (lambda (a l) (vl-some (function (lambda (itm) (= a (car itm)))) l)))

  
 ; here start c:iep
 (setvar "cmdecho" 0)
 (command "._undo" "_begin")
 
 (if (setq ss1 (ssget '((0 . "line,polyline,lwpolyline"))))
  (progn
   (setq ss2 (ssadd) ss3 (ssadd) ss4 (ssadd))
   (foreach ename (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss1)))
    (if (eq (cdr (assoc '0 (entget ename))) "LINE")
     (ssadd ename ss4)
     (cond
      ((_clwp ename)
       (ssadd ename ss2)
      ); case
      ((&amp;gt; (vlax-curve-getArea ename) 0.0)
       (ssadd ename ss3)
      ); case
      ( t
       (ssadd ename ss4)
      ); case
     ); cond
    ); if
   ); foreach

   (command "._layer" "_new" "open" "_color" 2 "open" "_off" "open" "")
   (command "._chprop" "_si" ss3 "_layer" "open" "")

   (setq data^ (_areas ss2))
   (setq exAcDbPline (vlax-ename-&amp;gt;vla-object (cdar data^)))

   (command "._layer" "_new" "external" "_color" 1 "external" "")
   (command "._chprop" "_si" (cdar data^) "_layer" "external" "")
   (ssdel (cdar data^) ss2)

   (foreach item (cdr data^)
    (setq inAcDbPline (vlax-ename-&amp;gt;vla-object (cdr item)))

    (command "._copy" "_si" (cdr item) "0,0,0" "0,0,0")
    (command "._region" "_si" (entlast))
    (setq AcDbRegion (vlax-ename-&amp;gt;vla-object (entlast)))
    (setq c0 (vlax-safearray-&amp;gt;list (vlax-variant-value (vla-get-centroid AcDbRegion))))
    (vla-delete AcDbRegion)
    (vlax-release-object AcDbRegion)

    (setq ang 0.0)
    (repeat 4
     (command "._ray" "_None" c0 "_None" (polar c0 ang 1.0) "")
     (setq AcDbRay (vlax-ename-&amp;gt;vla-object (entlast)))

     (if (and
	  (setq o1 (LM:intersections inAcDbPline AcDbRay acExtendNone))
	  (= (vl-list-length o1) 1)
          (setq o2 (LM:intersections exAcDbPline AcDbRay acExtendNone))
	  (= (vl-list-length o2) 1)
	 )
      (progn
       (vla-delete AcDbRay)
       (command "._boundary" "_None" (setq c1 (_3d-&amp;gt;2d (_midpt (car o1) (car o2)))) "")
       (setq area (vlax-curve-getArea (entlast)))

       (if (not (_isexist area lst))
        (setq lst (cons (list area c1) lst))
       )

       (entdel (entlast)) ; delete boundary
      ); progn
      (vla-delete AcDbRay)
     ); if
      
     (setq ang (+ ang (/ pi 2)))
     (vlax-release-object AcDbRay)
    ); repeat
     
    (vlax-release-object inAcDbPline) 
   ); foreach

   (vlax-release-object exAcDbPline)

   (command "._layer" "_new" "internal" "_color" 6 "internal" "")
   (command "._chprop" "_si" ss2 "_layer" "internal" "")

   ; draw polylines
   (foreach item lst
    (command "._boundary" "_None" (cadr item) "")
    (command "._chprop" "_si" "_Last" "_layer" "internal" "")
    (command "._draworder" "_si" "_Last" "_Front")    
   ); foreach

   (command "._layer" "_on" "open" "")
   (command "._erase" "_si" ss4)
  ); progn
 ); if

 (command "._undo" "_end")
 (setvar "cmdecho" 1)
  
 (princ)
); c:iep&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2024 22:43:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-join-polylines-external-internal/m-p/13158503#M6143</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2024-11-18T22:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: Help with lisp - join polylines external/internal</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-join-polylines-external-internal/m-p/13162182#M6144</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/52747"&gt;@Moshe-A&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;&lt;P&gt;You've done it again.&lt;/P&gt;&lt;P&gt;amazing&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 07:46:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-join-polylines-external-internal/m-p/13162182#M6144</guid>
      <dc:creator>yu85.info</dc:creator>
      <dc:date>2024-11-20T07:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: Help with lisp - join polylines external/internal</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-join-polylines-external-internal/m-p/13162235#M6145</link>
      <description>&lt;P&gt;Yuval hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you for that&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":flexed_biceps:"&gt;💪&lt;/span&gt;&lt;/P&gt;&lt;P&gt;i still would like to know what these plines represent?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Moshe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 08:14:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-join-polylines-external-internal/m-p/13162235#M6145</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2024-11-20T08:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: Help with lisp - join polylines external/internal</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-join-polylines-external-internal/m-p/13162339#M6146</link>
      <description>&lt;P&gt;The DWG I attached was just a sketch. The main purpose is converting 3D polylines from field survey into polygons in order to use them in GIS.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 09:15:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-join-polylines-external-internal/m-p/13162339#M6146</guid>
      <dc:creator>yu85.info</dc:creator>
      <dc:date>2024-11-20T09:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: Help with lisp - join polylines external/internal</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-join-polylines-external-internal/m-p/13163090#M6147</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/52747"&gt;@Moshe-A&lt;/a&gt;&amp;nbsp;Is there a way please to modify the lisp&amp;nbsp; for 3D polylines?&lt;/P&gt;&lt;P&gt;So I can go from A to B like in the DWG file "C" I attached&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 14:14:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-lisp-join-polylines-external-internal/m-p/13163090#M6147</guid>
      <dc:creator>yu85.info</dc:creator>
      <dc:date>2024-11-20T14:14:24Z</dc:date>
    </item>
  </channel>
</rss>

