<?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: Count solids with sizes in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/count-solids-with-sizes/m-p/9821794#M80421</link>
    <description>&lt;P&gt;Thank you very much that worked ! Would there be a way to convert an extruded object to a box given that the extruded object is just a simple box?&lt;/P&gt;</description>
    <pubDate>Sat, 24 Oct 2020 05:12:21 GMT</pubDate>
    <dc:creator>drakejest</dc:creator>
    <dc:date>2020-10-24T05:12:21Z</dc:date>
    <item>
      <title>Count solids with sizes</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/count-solids-with-sizes/m-p/9208713#M80415</link>
      <description>&lt;P&gt;Is there a way to count the solids in a selection, listed with their individual sizes.&amp;nbsp;&lt;BR /&gt;For example:&amp;nbsp;&lt;BR /&gt;180 x 38 x 2000: 10&lt;BR /&gt;160 x 38 x 2000: 5&lt;BR /&gt;etc...&lt;BR /&gt;I found the (graet) boxcount lisp but that only counts the total lenght of solids based on their section.&lt;/P&gt;&lt;P&gt;I am looking for the same routine but not the total lenght. I would like the individual lenghts...&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2019 07:23:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/count-solids-with-sizes/m-p/9208713#M80415</guid>
      <dc:creator>Rikkes</dc:creator>
      <dc:date>2019-12-18T07:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: Count solids with sizes</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/count-solids-with-sizes/m-p/9210907#M80416</link>
      <description>&lt;P&gt;Without a dwg you may be able to use Massprop as it provides the box size, you can write to file then read the file back in to get the values, the other may be using VL bounding box.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can create a list and sort it then count up the same sizes. Note though 180x200x50 is same 200x180x50 if object is rotated.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2019 02:13:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/count-solids-with-sizes/m-p/9210907#M80416</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2019-12-19T02:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: Count solids with sizes</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/count-solids-with-sizes/m-p/9212525#M80417</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/480399"&gt;@Rikkes&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This could get you on the right track. Please see my &lt;FONT color="#FF6600"&gt;NOTE&lt;/FONT&gt; about ignoring orientation..&lt;/P&gt;&lt;P&gt;This boolean value accounts for the issue that&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6254908"&gt;@Sea-Haven&lt;/a&gt;&amp;nbsp;mentions in their comment..&lt;/P&gt;&lt;P&gt;Set it to "nil" if Length MUST equal Length, Width MUST equal Width, and Height MUST equal Height..&lt;/P&gt;&lt;P&gt;Or set to "t" if shapes must only be geometrically the same regardless of orientation&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(defun c:GB ( / ignoreOrientation ss boxList cnt e len finals tmp a b)
;Get Boxes
&lt;FONT color="#FF6600"&gt;;if orientation does NOT matter (i.e. these two are equal-&amp;gt; (6x4x2) (2x4x6)) set to t, else nil&lt;/FONT&gt;
(setq ignoreOrientation nil)
(if (setq boxList '() ss (ssget '((0 . "3DSOLID"))))
  (progn
    ;check solids for boxes
    (repeat (setq cnt (sslength ss))
      (setq e (ssname ss (setq cnt (1- cnt))))
      ;if boxes, save info
      (if (eq "Box" (getpropertyvalue e "SolidType"))
	(setq boxList (cons (list (getpropertyvalue e "Length")
				  (getpropertyvalue e "Width")
				  (getpropertyvalue e "Height")) boxList));length/width/height
      );if
    );repeat
    ;if we have boxes, count equal values, then present data to user in command history
    (if (&amp;gt; (setq len (length boxList)) 0)
      (progn
	(setq finals "" tmp '())
	(while boxList
	  (setq a (car boxList) boxList (cdr boxList) cnt 1)
	  (foreach b boxList
	    (if (if ignoreOrientation (equal (vl-sort a '&amp;lt;) (vl-sort b '&amp;lt;)) (equal a b))
	      (setq cnt (1+ cnt))
	      (setq tmp (cons b tmp))
	    );if
	  );foreach
	  (if ignoreOrientation
	    (setq finals (strcat finals (rtos (car a) 2 0) "x"
				        (rtos (cadr a) 2 0) "x"
				        (rtos (caddr a) 2 0) " | "
				        "Count: " (itoa cnt)))
	    (setq finals (strcat finals "\nLength: " (rtos (car a) 2 0) " | "
				        "Width: " (rtos (cadr a) 2 0) " | "
				        "Height: " (rtos (caddr a) 2 0) " | "
				        "Count: " (itoa cnt)))
	  );if
	  (if boxList (setq boxList tmp tmp '()) (setq boxList nil))
	);while
	(prompt finals)
      );progn
    ;else
      (prompt "\n...No box solids found.")
    );if
  );progn
;else
  (prompt "\n...No 3d Solids selected.")
);if
(setq ss nil)
(prompt "\nGB Complete...")
(princ)
);defun&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;~DD&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2019 17:23:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/count-solids-with-sizes/m-p/9212525#M80417</guid>
      <dc:creator>CodeDing</dc:creator>
      <dc:date>2019-12-19T17:23:01Z</dc:date>
    </item>
    <item>
      <title>Re: Count solids with sizes</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/count-solids-with-sizes/m-p/9212658#M80418</link>
      <description>&lt;PRE&gt;English: &lt;STRIKE&gt;(if (eq "Box" (getpropertyvalue e "SolidType"))&lt;/STRIKE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;For other language packs/Versions - change this line an add your local name. &lt;A href="http://help.autodesk.com/view/ACD/2020/ENU/?guid=GUID-8B9B2875-3CA1-448D-ACF2-94C503DA54C6" target="_blank" rel="noopener"&gt;Sample English,German,Francais,Espanol,,&lt;/A&gt;&lt;/P&gt;
&lt;PRE&gt;(if (wcmatch (getpropertyvalue e "SolidType") "Box,Quader,Boite,Prismarect")&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2019 18:16:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/count-solids-with-sizes/m-p/9212658#M80418</guid>
      <dc:creator>cadffm</dc:creator>
      <dc:date>2019-12-19T18:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: Count solids with sizes</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/count-solids-with-sizes/m-p/9821035#M80419</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried using your code but i am getting ". . . No box solids found". This is my first time using lisp commands so it maybe just me doing something wrong. Here is what i did&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached the dwg file on the one im testing with and the exact lsp file i am using. The object is made with several duplicate parts and i am sure they are the same since they were made using the copy command. These objects were made from a line &amp;gt; joined &amp;gt; extruded.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When executing: gb &amp;gt; selected the whole object; The response is ". . . No box solids found"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you think you can help me with this sir ? It is greatly appreciated&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 16:40:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/count-solids-with-sizes/m-p/9821035#M80419</guid>
      <dc:creator>drakejest</dc:creator>
      <dc:date>2020-10-23T16:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: Count solids with sizes</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/count-solids-with-sizes/m-p/9821091#M80420</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/9822200"&gt;@drakejest&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;.... i am getting ". . . No box solids found".&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;...&lt;/SPAN&gt;&lt;SPAN style="font-family: inherit;"&gt;. These objects were made from a line &amp;gt; joined &amp;gt; extruded.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The "Box" type of Solid results only from the BOX &lt;EM&gt;command&lt;/EM&gt;.&amp;nbsp; Use that, and look at its Properties for the "Solid type" entry in the Geometry category.&amp;nbsp; That will have Length/Width/Height properties farther down.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something made by Extruding lists its "Solid type" as "Extrusion," and does &lt;EM&gt;not&lt;/EM&gt;&amp;nbsp; have those properties, even if it's box-shaped.&amp;nbsp; But if it's box-shaped, and orthogonally oriented, its bounding box could be used to calculate the length/width/height.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 17:08:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/count-solids-with-sizes/m-p/9821091#M80420</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2020-10-23T17:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: Count solids with sizes</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/count-solids-with-sizes/m-p/9821794#M80421</link>
      <description>&lt;P&gt;Thank you very much that worked ! Would there be a way to convert an extruded object to a box given that the extruded object is just a simple box?&lt;/P&gt;</description>
      <pubDate>Sat, 24 Oct 2020 05:12:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/count-solids-with-sizes/m-p/9821794#M80421</guid>
      <dc:creator>drakejest</dc:creator>
      <dc:date>2020-10-24T05:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: Count solids with sizes</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/count-solids-with-sizes/m-p/9823186#M80422</link>
      <description>&lt;P&gt;I having trouble making the code to ignore orientation, upon modifying the code as you instructed :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq ignoreOrientation nil)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq ignoreOrientation t)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the console was giving me these result&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dase.JPG" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/836047iC085C89C688B7AB8/image-size/large?v=v2&amp;amp;px=999" role="button" title="dase.JPG" alt="dase.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which does not makes sense to me as i dont have those dimension on the boxes.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Oct 2020 16:34:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/count-solids-with-sizes/m-p/9823186#M80422</guid>
      <dc:creator>drakejest</dc:creator>
      <dc:date>2020-10-25T16:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: Count solids with sizes</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/count-solids-with-sizes/m-p/9824646#M80423</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/9822200"&gt;@drakejest&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It appears there was a missed string in the original code..&lt;/P&gt;&lt;P&gt;This piece:&lt;/P&gt;&lt;PRE&gt;	    (setq finals (strcat finals (rtos (car a) 2 0) "x"
				        (rtos (cadr a) 2 0) "x"
				        (rtos (caddr a) 2 0) " | "
				        "Count: " (itoa cnt)))&lt;/PRE&gt;&lt;P&gt;Should be modified to include the &lt;FONT color="#FF6600"&gt;&lt;STRONG&gt;newline character&lt;/STRONG&gt;&lt;/FONT&gt;:&lt;/P&gt;&lt;PRE&gt;	    (setq finals (strcat finals &lt;FONT color="#FF6600"&gt;&lt;STRONG&gt;"\n"&lt;/STRONG&gt;&lt;/FONT&gt; (rtos (car a) 2 0) "x"
				        (rtos (cadr a) 2 0) "x"
				        (rtos (caddr a) 2 0) " | "
				        "Count: " (itoa cnt)))&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...try that and see if it helps.&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;~DD&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2020 14:18:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/count-solids-with-sizes/m-p/9824646#M80423</guid>
      <dc:creator>CodeDing</dc:creator>
      <dc:date>2020-10-26T14:18:29Z</dc:date>
    </item>
    <item>
      <title>Re: Count solids with sizes</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/count-solids-with-sizes/m-p/9824807#M80424</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/9822200"&gt;@drakejest&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;....Would there be a way to convert an extruded object to a box given that the extruded object is just a simple box?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Try this [minimally tested]:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;(defun C:BOXIFY (/ ss n oldbox minpt maxpt LL UR delta)
  (prompt "\nTo convert orthogonal box-shaped 3D Solid(s) to actual \"BOX\" objects,")
  (if (setq ss (ssget "_:L" '((0 . "3DSOLID"))))
    (repeat (setq n (sslength ss)); then
      (setq oldbox (ssname ss (setq n (1- n))))
      (vla-getboundingbox (vlax-ename-&amp;gt;vla-object oldbox) 'minpt 'maxpt)
      (setq
        LL (vlax-safearray-&amp;gt;list minpt)
        UR (vlax-safearray-&amp;gt;list maxpt)
        delta (mapcar '- UR LL)
      ); setq
      (command
        "_.box" "_none" LL "_length" (car delta) (cadr delta) (caddr delta)
        "_.chprop" "_last" "" "_layer" (cdr (assoc 8 (entget oldbox))) ""
        "_.erase" oldbox ""
      ); command
    ); repeat
  ); if
  (princ)
); defun&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's up to you to select only orthogonally-oriented box-shaped Solids -- it doesn't verify that's what you picked.&amp;nbsp; I think it would be hugely complicated, if even possible, to do that by any kind of calculation, given the inscrutability of 3DSolid entity data.&amp;nbsp; The one way that may work would be to build the new Box, SUBTRACT the original from the new one, and &lt;EM&gt;if nothing is left&lt;/EM&gt;, the original was the right kind of shape and orientation.&amp;nbsp; Then it would Undo the Subtraction, and delete the original.&amp;nbsp; Otherwise it would Undo the Subtraction &lt;EM&gt;and&lt;/EM&gt;&amp;nbsp; the building of the new Box, and leave the original.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2020 15:07:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/count-solids-with-sizes/m-p/9824807#M80424</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2020-10-26T15:07:06Z</dc:date>
    </item>
  </channel>
</rss>

