<?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 Intersect objects in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/intersect-objects/m-p/13272070#M4145</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I found the LISP "foo" (2019) by Ron Perez (ronjonp) here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.cadtutor.net/forum/topic/67156-create-polygons-at-intersections/" target="_blank"&gt;https://www.cadtutor.net/forum/topic/67156-create-polygons-at-intersections/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(Compared to the original, I have already removed the deletion of the original polygon.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:foo (/ r o n s)
  ;; RJP » 2019-04-03
  (cond	((and (setq s (ssget ":L" '((0 . "circle,ellipse,lwpolyline,spline"))))
	      (setq s (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))))
	      (setq s (vl-remove-if-not '(lambda (x) (vlax-curve-isclosed x)) s))
	      (setq n (vlax-ename-&amp;gt;vla-object (cdr (assoc 330 (entget (car s))))))
	      (setq s (vl-sort (mapcar 'vlax-ename-&amp;gt;vla-object s)
			       '(lambda (a b) (&amp;gt; (vlax-curve-getarea a) (vlax-curve-getarea b)))
		      )
	      )
	 )
	 (setq r (car (vlax-invoke n 'addregion (list (car s)))))
	 (setq o (vlax-invoke n 'addregion (cdr s)))
	 (mapcar (function (lambda (x) (vla-boolean (vla-copy r) acintersection x))) o)
	)
  )
  (princ)
)
(vl-load-com)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think it's really great and would like to use it for my purposes if I may?&lt;/P&gt;&lt;P&gt;But then it would have to be changed and unfortunately I'm failing at that.&lt;/P&gt;&lt;P&gt;That's why I'm asking here in the hope that someone can help me?&lt;/P&gt;&lt;P&gt;I've attached an example file that should help you understand what I want.&lt;/P&gt;&lt;P&gt;Here's a short summary of the question:&lt;/P&gt;&lt;P&gt;I have several holding areas (layer: Flaeche)&lt;/P&gt;&lt;P&gt;Then there are road areas (Strasse) and building areas (Gebaeude)&lt;/P&gt;&lt;P&gt;In the DWG the layer is called "Gebaude", I made a typo.&lt;/P&gt;&lt;P&gt;Now I want the road and building areas to be intersected with the holding areas.&lt;/P&gt;&lt;P&gt;If possible, the newly created polygons should then be saved on a new layer:&lt;BR /&gt;Road areas = Strasse_cut&lt;BR /&gt;Building areas = Gebaeude_cut&lt;/P&gt;&lt;P&gt;Now it would be great if this Lisp could work in a loop until all the areas have been processed.&lt;BR /&gt;If that doesn't work, that wouldn't be a problem, then I would control it using Excel and VBA via the handles of the polygons.&lt;/P&gt;&lt;P&gt;I would be happy if someone could help me with this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;</description>
    <pubDate>Tue, 21 Jan 2025 07:36:46 GMT</pubDate>
    <dc:creator>t_ott</dc:creator>
    <dc:date>2025-01-21T07:36:46Z</dc:date>
    <item>
      <title>Intersect objects</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/intersect-objects/m-p/13272070#M4145</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I found the LISP "foo" (2019) by Ron Perez (ronjonp) here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.cadtutor.net/forum/topic/67156-create-polygons-at-intersections/" target="_blank"&gt;https://www.cadtutor.net/forum/topic/67156-create-polygons-at-intersections/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(Compared to the original, I have already removed the deletion of the original polygon.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:foo (/ r o n s)
  ;; RJP » 2019-04-03
  (cond	((and (setq s (ssget ":L" '((0 . "circle,ellipse,lwpolyline,spline"))))
	      (setq s (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))))
	      (setq s (vl-remove-if-not '(lambda (x) (vlax-curve-isclosed x)) s))
	      (setq n (vlax-ename-&amp;gt;vla-object (cdr (assoc 330 (entget (car s))))))
	      (setq s (vl-sort (mapcar 'vlax-ename-&amp;gt;vla-object s)
			       '(lambda (a b) (&amp;gt; (vlax-curve-getarea a) (vlax-curve-getarea b)))
		      )
	      )
	 )
	 (setq r (car (vlax-invoke n 'addregion (list (car s)))))
	 (setq o (vlax-invoke n 'addregion (cdr s)))
	 (mapcar (function (lambda (x) (vla-boolean (vla-copy r) acintersection x))) o)
	)
  )
  (princ)
)
(vl-load-com)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think it's really great and would like to use it for my purposes if I may?&lt;/P&gt;&lt;P&gt;But then it would have to be changed and unfortunately I'm failing at that.&lt;/P&gt;&lt;P&gt;That's why I'm asking here in the hope that someone can help me?&lt;/P&gt;&lt;P&gt;I've attached an example file that should help you understand what I want.&lt;/P&gt;&lt;P&gt;Here's a short summary of the question:&lt;/P&gt;&lt;P&gt;I have several holding areas (layer: Flaeche)&lt;/P&gt;&lt;P&gt;Then there are road areas (Strasse) and building areas (Gebaeude)&lt;/P&gt;&lt;P&gt;In the DWG the layer is called "Gebaude", I made a typo.&lt;/P&gt;&lt;P&gt;Now I want the road and building areas to be intersected with the holding areas.&lt;/P&gt;&lt;P&gt;If possible, the newly created polygons should then be saved on a new layer:&lt;BR /&gt;Road areas = Strasse_cut&lt;BR /&gt;Building areas = Gebaeude_cut&lt;/P&gt;&lt;P&gt;Now it would be great if this Lisp could work in a loop until all the areas have been processed.&lt;BR /&gt;If that doesn't work, that wouldn't be a problem, then I would control it using Excel and VBA via the handles of the polygons.&lt;/P&gt;&lt;P&gt;I would be happy if someone could help me with this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2025 07:36:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/intersect-objects/m-p/13272070#M4145</guid>
      <dc:creator>t_ott</dc:creator>
      <dc:date>2025-01-21T07:36:46Z</dc:date>
    </item>
  </channel>
</rss>

