<?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: Extracting binary occupancy map from Autocad in AutoCAD Forum</title>
    <link>https://forums.autodesk.com/t5/autocad-forum/extracting-binary-occupancy-map-from-autocad/m-p/9258842#M116621</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#333399"&gt;&lt;EM&gt;&amp;gt;&amp;gt; I want to build a 3D matrix whose elements are either 0 or 1&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;So you create an array of points and for each point you want to know if it's inside a 3D-Solid or outside .. did I understand this correct?&lt;/P&gt;
&lt;P&gt;If so ... programming is needed, there does not exist any OOTB function in AutoCAD.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- alfred -&lt;/P&gt;</description>
    <pubDate>Sat, 18 Jan 2020 09:24:57 GMT</pubDate>
    <dc:creator>Alfred.NESWADBA</dc:creator>
    <dc:date>2020-01-18T09:24:57Z</dc:date>
    <item>
      <title>Extracting binary occupancy map from Autocad</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/extracting-binary-occupancy-map-from-autocad/m-p/9258727#M116620</link>
      <description>&lt;P&gt;I have a very dummy question. I am a newbie in Autocad.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- I have a 3D drawing of indoor / outdoor environment. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- From this drawing, I want to build &amp;nbsp;a 3D matrix whose elements are either 0 or 1. I refer this matrix as "binary occupancy matrix" . So, for given (x,y,z) coordinate in the 3D drawing, binary occupancy matrix has either 0 or 1 value, where 0 represents empty/vacant volume, and 1 represents that solid volume.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- My goal is to reduce a detailed 3D drawing into a simple matrix consisting of 0s and 1s. Is there any way to do this in Autocad?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- I appreciate your answers/comments&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jan 2020 05:01:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/extracting-binary-occupancy-map-from-autocad/m-p/9258727#M116620</guid>
      <dc:creator>celebihaluk36</dc:creator>
      <dc:date>2020-01-18T05:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting binary occupancy map from Autocad</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/extracting-binary-occupancy-map-from-autocad/m-p/9258842#M116621</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#333399"&gt;&lt;EM&gt;&amp;gt;&amp;gt; I want to build a 3D matrix whose elements are either 0 or 1&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;So you create an array of points and for each point you want to know if it's inside a 3D-Solid or outside .. did I understand this correct?&lt;/P&gt;
&lt;P&gt;If so ... programming is needed, there does not exist any OOTB function in AutoCAD.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- alfred -&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jan 2020 09:24:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/extracting-binary-occupancy-map-from-autocad/m-p/9258842#M116621</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2020-01-18T09:24:57Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting binary occupancy map from Autocad</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/extracting-binary-occupancy-map-from-autocad/m-p/9259050#M116622</link>
      <description>&lt;P&gt;One approach would be to write a program that does a Boolean intersect of an object smaller than the grid resolution of the array of points with the solid model of the full object.&amp;nbsp; If the result is positive then the "point" is inside the shape.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another approach would be to send a ray out from the point under consideration and count the number of intersections with the object's surfaces.&amp;nbsp; If the number is odd then the point is inside otherwise it is outside.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jan 2020 14:24:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/extracting-binary-occupancy-map-from-autocad/m-p/9259050#M116622</guid>
      <dc:creator>leeminardi</dc:creator>
      <dc:date>2020-01-18T14:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting binary occupancy map from Autocad</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/extracting-binary-occupancy-map-from-autocad/m-p/9259273#M116623</link>
      <description>&lt;P&gt;Similar to array but actually, it will be 3 dimensional matrix. For example, if total volume of drawing has dimensions of 3m x 5m x2 m in x, y, z plane. My binary occupancy matrix will have 3 x 5 x 2 = 30 elements (either 0 or 1). This is for 1m x1m x1m unit volume resolution. Resolution is not actually important for now. I am just giving an example.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If programming is needed, what would be your approach? thanks for the comment by the way&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jan 2020 18:38:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/extracting-binary-occupancy-map-from-autocad/m-p/9259273#M116623</guid>
      <dc:creator>celebihaluk36</dc:creator>
      <dc:date>2020-01-18T18:38:06Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting binary occupancy map from Autocad</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/extracting-binary-occupancy-map-from-autocad/m-p/9259403#M116624</link>
      <description>&lt;P&gt;Check out&amp;nbsp;&lt;A href="http://help.autodesk.com/view/ACD/2015/ENU/?guid=GUID-D22E6F22-B774-48B1-8A85-01F81F1C80E4" target="_blank" rel="noopener"&gt;vla-CheckInterference.&lt;/A&gt;&amp;nbsp; You could use it in a triple nested loop to move a box (1m per side as in your example) within the bounds of the subject object. The most inner loop would move the box in x, the next outer loop in y and the outside loop in Z.&lt;/P&gt;&lt;P&gt;A check interference would be done inside the inner most loop.&amp;nbsp; If the result is not nil then you have a 1 for that element of your 3D array and you can record the location in your matrix.&amp;nbsp; You would then do an undo before moving the box to the next location to be checked.&amp;nbsp; After the three loops have run through their range of values you would have the 3D "binary map".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jan 2020 20:55:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/extracting-binary-occupancy-map-from-autocad/m-p/9259403#M116624</guid>
      <dc:creator>leeminardi</dc:creator>
      <dc:date>2020-01-18T20:55:20Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting binary occupancy map from Autocad</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/extracting-binary-occupancy-map-from-autocad/m-p/9259439#M116625</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;nbsp;From my understanding in the function should take following inputs:&lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;RetVal = object.CheckInterference(&lt;EM&gt;Object&lt;/EM&gt;, &lt;EM&gt;CreateInterferenceSolid&lt;/EM&gt;, &lt;EM&gt;SolidsInterfere&lt;/EM&gt;)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;EM&gt;Object: original drawing from which binary map to be extracted&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;EM&gt;CreateInterferenceSolid: a cubic volume (i.e. 1mx1mx1m) placed on particular x,y,z.&amp;nbsp;&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;EM&gt;&lt;EM&gt;SolidsInterfere: 'true'&lt;/EM&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;EM&gt;&lt;EM&gt;Retval: interference object: (1) non-empty; (0) void, no-object&lt;/EM&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;EM&gt;&lt;EM&gt;And &amp;nbsp;iterate this function over all x,y,z in loop?&lt;/EM&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jan 2020 21:45:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/extracting-binary-occupancy-map-from-autocad/m-p/9259439#M116625</guid>
      <dc:creator>celebihaluk36</dc:creator>
      <dc:date>2020-01-18T21:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting binary occupancy map from Autocad</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/extracting-binary-occupancy-map-from-autocad/m-p/9259637#M116626</link>
      <description>&lt;P&gt;I have limited vlisp experience but took a stab at creating the program.&lt;/P&gt;&lt;P&gt;The following is a work-in-progress but it does create an ASCII file of 1's, and 0's for one pass in the x direction.&lt;/P&gt;&lt;P&gt;To use it create a box of desired size (e.g., one unit square) and an object to analyze .&amp;nbsp; Place the box outside of the object being analyzed such that when it moves in the x direction it will pass through the object.&amp;nbsp; The program runs one pass in x.&amp;nbsp; &amp;nbsp;It could be expanded with additional loops to index in the y and z direction.&amp;nbsp; I stopped here to see if this is on the right track.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a sample output of one row for passing the red box through the white shape.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 456px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/718433iC90DBC3323B33AD4/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;(defun c:bin (/ fname s i n v c cx cy cz)
; lrm version 1.0 1/18/2020
; steps a box sequentially through a solid and creates a file
; noting when the box and solid overlap
; - limited to one row in x 
  (vl-load-com)
  (setq fname (getfiled "Filename" "" "txt" 1))
  (setq fname (open fname "w"))
  (write-line "row 1" fname)
  (setq obj (car (entsel "\nSelect object for analysis.")))
  (setq box (car (entsel "\nSelect box.")))
  (setq delta (getreal "\nEnter step size."))
  (setq nstepsx (getint "\nEnter number of steps in x"))
  (setq aline "")
  (setq	obj1 (vlax-ename-&amp;gt;vla-object obj)
	box1 (vlax-ename-&amp;gt;vla-object box)
  )
  (setq i 0)
  (setq	p1 '(0 0 0)
	p2 (list delta 0 0)
  )
	(while (&amp;lt; i nstepsx)
	  (setq
	    solidObj
	     (vla-CheckInterference obj1 box1 :vlax-false :vlax-false)
	  )
	  (if solidObj
	    (setq aline (strcat aline "1"))	; yes, intersection
	    (setq aline (strcat aline "0"))	; no intersection
	  )
	  (setq i (+ i 1))
	  (vla-move box1 (vlax-3D-point p1) (vlax-3D-point p2))
	)					; end while
  (write-line aline fname)
  (close fname)
  (princ)
)&lt;/PRE&gt;&lt;P&gt;The program creates solids for each of the checks which you probably don't want.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jan 2020 02:49:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/extracting-binary-occupancy-map-from-autocad/m-p/9259637#M116626</guid>
      <dc:creator>leeminardi</dc:creator>
      <dc:date>2020-01-19T02:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting binary occupancy map from Autocad</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/extracting-binary-occupancy-map-from-autocad/m-p/9259658#M116627</link>
      <description>&lt;P&gt;plenty of useful information. Thank you very much.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jan 2020 03:14:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/extracting-binary-occupancy-map-from-autocad/m-p/9259658#M116627</guid>
      <dc:creator>celebihaluk36</dc:creator>
      <dc:date>2020-01-19T03:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting binary occupancy map from Autocad</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/extracting-binary-occupancy-map-from-autocad/m-p/12118542#M116628</link>
      <description>&lt;P&gt;Hello &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8513717"&gt;@celebihaluk36&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did you figure out how to do this along all 3 dimensions? If so, can you share your script?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2023 22:51:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/extracting-binary-occupancy-map-from-autocad/m-p/12118542#M116628</guid>
      <dc:creator>f20150458</dc:creator>
      <dc:date>2023-07-21T22:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting binary occupancy map from Autocad</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/extracting-binary-occupancy-map-from-autocad/m-p/12135043#M116629</link>
      <description>I did the project in Rhinoceros. It is useful for large maps.&lt;BR /&gt;&lt;BR /&gt;However approach is almost the same except&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;import rhinoscriptsyntax as rs&lt;BR /&gt;Arr_1_0 = rs.BooleanIntersection(obj, BoxID, False)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;intead of vla-CheckInterference obj1 box1 :vlax-false :vlax-false in&lt;BR /&gt;Autocad</description>
      <pubDate>Sat, 29 Jul 2023 07:00:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/extracting-binary-occupancy-map-from-autocad/m-p/12135043#M116629</guid>
      <dc:creator>celebihaluk36</dc:creator>
      <dc:date>2023-07-29T07:00:18Z</dc:date>
    </item>
  </channel>
</rss>

