<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Boolean: how do I  &#x27;outershell&#x27; multiple groups&#x2F;components?]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">I have a question about the Boolean functions 'outer_shell' and 'union'.<br />
See attached file.<br />
If I select all (6 groups ) and use the mouse to 'outershell' I get the 3 single groups plus the new united group.</p>
<p dir="auto">How do I mimic this behavior in code??<br />
All I could imagine is this rather brute force technique:</p>
<pre><code>&lt;span class="syntaxdefault"&gt;entlength &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;=&lt;/span&gt;&lt;span class="syntaxdefault"&gt; entities&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;.&lt;/span&gt;&lt;span class="syntaxdefault"&gt;length &lt;br /&gt;            for f in 0&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;...&lt;/span&gt;&lt;span class="syntaxdefault"&gt;entlength&lt;br /&gt;                for g in 0&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;...&lt;/span&gt;&lt;span class="syntaxdefault"&gt;entlength&lt;br /&gt;                    begin&lt;br /&gt;                    entities&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;[&lt;/span&gt;&lt;span class="syntaxdefault"&gt;f&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;].&lt;/span&gt;&lt;span class="syntaxdefault"&gt;outer_shell&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;(&lt;/span&gt;&lt;span class="syntaxdefault"&gt;entities&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;[&lt;/span&gt;&lt;span class="syntaxdefault"&gt;g&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;])&lt;br /&gt;&lt;/span&gt;&lt;span class="syntaxdefault"&gt;                    rescue&lt;br /&gt;                    end&lt;br /&gt;                end    &lt;br /&gt;            end&lt;/span&gt;
</code></pre>
<p dir="auto">any ideas are appreciated!</p>
<p dir="auto">Thnx , liquid</p>
<p dir="auto"><a href="/uploads/imported_attachments/7Bby_question.skp">question.skp</a></p>
]]></description><link>https://community.sketchucation.com/topic/133820/boolean-how-do-i-outershell-multiple-groups-components</link><generator>RSS for Node</generator><lastBuildDate>Tue, 19 May 2026 10:31:46 GMT</lastBuildDate><atom:link href="https://community.sketchucation.com/topic/133820.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 12 Mar 2012 16:29:16 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Boolean: how do I  &#x27;outershell&#x27; multiple groups&#x2F;components? on Wed, 21 Mar 2012 08:15:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/liquid98" aria-label="Profile: liquid98">@<bdi>liquid98</bdi></a> said:</p>
<blockquote>
<p dir="auto">good guess! that's the plan indeed.</p>
</blockquote>
<p dir="auto">I did not guess ... I can read your mind (scary music: [Oooo ooOOooo ooooo])</p>
<p dir="auto">No actually, I read your sample code in the post of 17 MAR ... the first two lines you are opening a skp file, within the code.</p>
<p dir="auto">In that post, you wrote:</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/liquid98" aria-label="Profile: liquid98">@<bdi>liquid98</bdi></a> said:</p>
<blockquote>
<p dir="auto">But the script I'm writing is for internal use.</p>
</blockquote>
<p dir="auto">Is this to be used within a commercial setting (for commercial work.) ??</p>
]]></description><link>https://community.sketchucation.com/post/1317254</link><guid isPermaLink="true">https://community.sketchucation.com/post/1317254</guid><dc:creator><![CDATA[Dan Rathbun]]></dc:creator><pubDate>Wed, 21 Mar 2012 08:15:45 GMT</pubDate></item><item><title><![CDATA[Reply to Boolean: how do I  &#x27;outershell&#x27; multiple groups&#x2F;components? on Tue, 20 Mar 2012 17:11:33 GMT]]></title><description><![CDATA[<p dir="auto">good guess! that's the plan indeed.</p>
]]></description><link>https://community.sketchucation.com/post/1317131</link><guid isPermaLink="true">https://community.sketchucation.com/post/1317131</guid><dc:creator><![CDATA[liquid98]]></dc:creator><pubDate>Tue, 20 Mar 2012 17:11:33 GMT</pubDate></item><item><title><![CDATA[Reply to Boolean: how do I  &#x27;outershell&#x27; multiple groups&#x2F;components? on Tue, 20 Mar 2012 15:03:44 GMT]]></title><description><![CDATA[<p dir="auto">Are you wishing to run this in batch-mode ??</p>
<p dir="auto">As in: Pick a folder of SKP files, and open them one after the other, union the intersecting groups, save the model under a "differed" filename, ... loop until all files in directory have been "converted" ??</p>
]]></description><link>https://community.sketchucation.com/post/1317107</link><guid isPermaLink="true">https://community.sketchucation.com/post/1317107</guid><dc:creator><![CDATA[Dan Rathbun]]></dc:creator><pubDate>Tue, 20 Mar 2012 15:03:44 GMT</pubDate></item><item><title><![CDATA[Reply to Boolean: how do I  &#x27;outershell&#x27; multiple groups&#x2F;components? on Tue, 20 Mar 2012 14:48:19 GMT]]></title><description><![CDATA[<p dir="auto">Is it smart at all to test for intersecting geometry before attempting a Boolean operation??</p>
]]></description><link>https://community.sketchucation.com/post/1317104</link><guid isPermaLink="true">https://community.sketchucation.com/post/1317104</guid><dc:creator><![CDATA[liquid98]]></dc:creator><pubDate>Tue, 20 Mar 2012 14:48:19 GMT</pubDate></item><item><title><![CDATA[Reply to Boolean: how do I  &#x27;outershell&#x27; multiple groups&#x2F;components? on Tue, 20 Mar 2012 09:18:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dan" aria-label="Profile: dan">@<bdi>dan</bdi></a> rathbun said:</p>
<blockquote>
<p dir="auto">If you are going to use <code> for</code> .. <code> in</code>, you must subtract <code> 1</code> from the length of the array/set/collection.</p>
</blockquote>
<p dir="auto">He did, because he used <code> ...</code> instead of <code> ..</code> in the Range.</p>
]]></description><link>https://community.sketchucation.com/post/1317052</link><guid isPermaLink="true">https://community.sketchucation.com/post/1317052</guid><dc:creator><![CDATA[thomthom]]></dc:creator><pubDate>Tue, 20 Mar 2012 09:18:16 GMT</pubDate></item><item><title><![CDATA[Reply to Boolean: how do I  &#x27;outershell&#x27; multiple groups&#x2F;components? on Mon, 19 Mar 2012 20:37:38 GMT]]></title><description><![CDATA[<p dir="auto">Hi Dan,</p>
<p dir="auto">I think the <code> Boundingbox.intersect</code> method is not really suitable for testing whether geometry is intersecting..<br />
It is true that <code> Boundingbox.intersect</code> returns an empty boundingbox if there is no 'intersection'.<br />
So we can test for that, but it is not reliable..</p>
<p dir="auto">Furthermore the <code> Group.intersect</code> method is just a Boolean method, it is not intended for testing intersection of solids..</p>
<p dir="auto">I feel the loop class can clarify things..</p>
]]></description><link>https://community.sketchucation.com/post/1316988</link><guid isPermaLink="true">https://community.sketchucation.com/post/1316988</guid><dc:creator><![CDATA[liquid98]]></dc:creator><pubDate>Mon, 19 Mar 2012 20:37:38 GMT</pubDate></item><item><title><![CDATA[Reply to Boolean: how do I  &#x27;outershell&#x27; multiple groups&#x2F;components? on Sat, 17 Mar 2012 20:50:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/liquid98" aria-label="Profile: liquid98">@<bdi>liquid98</bdi></a> said:</p>
<blockquote>
<p dir="auto">I tried <code> BoundingBox.intersect</code> but it gives me false positives in cases of close<br />
proximity.</p>
</blockquote>
<p dir="auto"><code> BoundingBox.intersect</code> always returns a <code> BoundingBox</code> object.</p>
<p dir="auto">From memory.. either one of these Happen:</p>
<p dir="auto"><strong>(1)</strong> If it really is a 3D method: (I think,) you may have to test the result for dimension. In other words if there is no intersection, the result <code> BoundingBox</code> would have <code> 0</code> for depth, width and height.</p>
<p dir="auto"><strong>(2)</strong> (<strong>And I think this is the case</strong>,) it's not a 3D method, it is a planar method. (I remember Jim explaining this in another topic, some time ago.) It sort of like the "projections" of each BB are cast onto the 3 axis planes. If there is no "interference" between the cast rectangles, then we consider there not to be an intersect. It is weird and confusing, and two groups that do not even touch each other, can have "projections" that intersect.</p>
<p dir="auto">So anyway.. IF your groups ARE manifold solids... why not use <code> Group.intersect</code> instead ??</p>
]]></description><link>https://community.sketchucation.com/post/1316676</link><guid isPermaLink="true">https://community.sketchucation.com/post/1316676</guid><dc:creator><![CDATA[Dan Rathbun]]></dc:creator><pubDate>Sat, 17 Mar 2012 20:50:39 GMT</pubDate></item><item><title><![CDATA[Reply to Boolean: how do I  &#x27;outershell&#x27; multiple groups&#x2F;components? on Sat, 17 Mar 2012 19:35:18 GMT]]></title><description><![CDATA[<p dir="auto">Hi Dan,</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dan" aria-label="Profile: dan">@<bdi>dan</bdi></a> rathbun said:</p>
<blockquote>
<p dir="auto">Yes they are.. you just do not realize it yet.</p>
</blockquote>
<p dir="auto">I do realize that. But the script I'm writing is for internal use. So everything<br />
this script will process meets the criteria already.  But you couldn't know that..   <img src="https://community.sketchucation.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f612.png?v=e3ff0b7518f" class="not-responsive emoji emoji-android emoji--unamused" style="height:23px;width:auto;vertical-align:middle" title=":unamused:" alt="😒" /><br />
By the way '<code> outer_shell</code>' is also available in free version, I think.</p>
<p dir="auto">The reason for adding the groups to an array is also clear to me now, otherwise the iteration process is not going well and SU could skip a few items.</p>
<p dir="auto">Now for the real problem:</p>
<p dir="auto">First I need to add all the candidates for the boolean unite operation to an array. In other words: only group-entities that <strong>intersect</strong> will be processed.</p>
<p dir="auto">I tried <code> BoundingBox.intersect</code> but it gives me false positives in cases of close<br />
proximity. So I've done some more reading and I ended up in the loops section of the SU API. Can the loop class help me here tot detect if groups really intersect??</p>
<p dir="auto">This is the only problem left, the boolean problem I solved by my self.  <img src="https://community.sketchucation.com/assets/plugins/nodebb-plugin-emoji/emoji/android/2600.png?v=e3ff0b7518f" class="not-responsive emoji emoji-android emoji--sunny" style="height:23px;width:auto;vertical-align:middle" title=":sunny:" alt="☀" />  <img src="https://community.sketchucation.com/assets/plugins/nodebb-plugin-emoji/emoji/android/2600.png?v=e3ff0b7518f" class="not-responsive emoji emoji-android emoji--sunny" style="height:23px;width:auto;vertical-align:middle" title=":sunny:" alt="☀" /> This script unifies all intersecting groups to one solid:</p>
<pre><code>&lt;span class="syntaxdefault"&gt;                file &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;=&lt;/span&gt;&lt;span class="syntaxstring"&gt;"D;\\Desktop\\bool.skp"&lt;br /&gt;&lt;/span&gt;&lt;span class="syntaxdefault"&gt;            Sketchup&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;.&lt;/span&gt;&lt;span class="syntaxdefault"&gt;open_file&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;(&lt;/span&gt;&lt;span class="syntaxdefault"&gt;file&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span class="syntaxdefault"&gt;            &lt;br /&gt;            model &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;=&lt;/span&gt;&lt;span class="syntaxdefault"&gt; Sketchup&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;.&lt;/span&gt;&lt;span class="syntaxdefault"&gt;active_model&lt;br /&gt;            entities &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;=&lt;/span&gt;&lt;span class="syntaxdefault"&gt; model&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;.&lt;/span&gt;&lt;span class="syntaxdefault"&gt;active_entities &lt;br /&gt;            &lt;br /&gt;            foo&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;,&lt;/span&gt;&lt;span class="syntaxdefault"&gt; nonfoo &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;=&lt;/span&gt;&lt;span class="syntaxdefault"&gt; &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;[],&lt;/span&gt;&lt;span class="syntaxdefault"&gt; &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;[]&lt;br /&gt;&lt;/span&gt;&lt;span class="syntaxdefault"&gt;            grps &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;=&lt;/span&gt;&lt;span class="syntaxdefault"&gt; model&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;.&lt;/span&gt;&lt;span class="syntaxdefault"&gt;entities&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;.&lt;/span&gt;&lt;span class="syntaxdefault"&gt;find_all &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;{|&lt;/span&gt;&lt;span class="syntaxdefault"&gt;ent&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;|&lt;/span&gt;&lt;span class="syntaxdefault"&gt; ent&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;.&lt;/span&gt;&lt;span class="syntaxdefault"&gt;is_a&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;?(&lt;/span&gt;&lt;span class="syntaxdefault"&gt;Sketchup&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;;;&lt;/span&gt;&lt;span class="syntaxdefault"&gt;Group&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;)&lt;/span&gt;&lt;span class="syntaxdefault"&gt; &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span class="syntaxdefault"&gt;            &lt;br /&gt;            grps&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;.&lt;/span&gt;&lt;span class="syntaxdefault"&gt;each &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;{&lt;/span&gt;&lt;span class="syntaxdefault"&gt; &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;|&lt;/span&gt;&lt;span class="syntaxdefault"&gt;a&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;|&lt;/span&gt;&lt;span class="syntaxdefault"&gt; unless a &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;==&lt;/span&gt;&lt;span class="syntaxdefault"&gt; grps&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;.&lt;/span&gt;&lt;span class="syntaxdefault"&gt;last &lt;br /&gt;                            a&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;.&lt;/span&gt;&lt;span class="syntaxdefault"&gt;name &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;=&lt;/span&gt;&lt;span class="syntaxdefault"&gt; &lt;/span&gt;&lt;span class="syntaxstring"&gt;'foo'&lt;/span&gt;&lt;span class="syntaxdefault"&gt; &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;;&lt;/span&gt;&lt;span class="syntaxdefault"&gt; foo&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;.&lt;/span&gt;&lt;span class="syntaxdefault"&gt;push a&lt;br /&gt;                        else&lt;br /&gt;                            a&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;.&lt;/span&gt;&lt;span class="syntaxdefault"&gt;name &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;=&lt;/span&gt;&lt;span class="syntaxdefault"&gt; &lt;/span&gt;&lt;span class="syntaxstring"&gt;'nonfoo'&lt;/span&gt;&lt;span class="syntaxdefault"&gt; &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;;&lt;/span&gt;&lt;span class="syntaxdefault"&gt; nonfoo&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;.&lt;/span&gt;&lt;span class="syntaxdefault"&gt;push a&lt;br /&gt;                        end &lt;br /&gt;                        &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span class="syntaxdefault"&gt;            &lt;br /&gt;            until foo&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;[&lt;/span&gt;&lt;span class="syntaxdefault"&gt;0&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;]&lt;/span&gt;&lt;span class="syntaxdefault"&gt; &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;==&lt;/span&gt;&lt;span class="syntaxdefault"&gt; nil&lt;br /&gt;                foo&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;.&lt;/span&gt;&lt;span class="syntaxdefault"&gt;each     &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;{&lt;/span&gt;&lt;span class="syntaxdefault"&gt; &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;|&lt;/span&gt;&lt;span class="syntaxdefault"&gt;ff&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;|&lt;/span&gt;&lt;span class="syntaxdefault"&gt; &lt;br /&gt;                                if  &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;((&lt;/span&gt;&lt;span class="syntaxdefault"&gt;ff&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;.&lt;/span&gt;&lt;span class="syntaxdefault"&gt;bounds&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;).&lt;/span&gt;&lt;span class="syntaxdefault"&gt;intersect&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;(&lt;/span&gt;&lt;span class="syntaxdefault"&gt;nonfoo&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;[&lt;/span&gt;&lt;span class="syntaxdefault"&gt;0&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;].&lt;/span&gt;&lt;span class="syntaxdefault"&gt;bounds&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;)).empty?&lt;/span&gt;&lt;span class="syntaxdefault"&gt; &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;==&lt;/span&gt;&lt;span class="syntaxdefault"&gt; false&lt;br /&gt;                                    &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;(&lt;/span&gt;&lt;span class="syntaxdefault"&gt;ff&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;.&lt;/span&gt;&lt;span class="syntaxdefault"&gt;outer_shell&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;(&lt;/span&gt;&lt;span class="syntaxdefault"&gt;nonfoo&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;[&lt;/span&gt;&lt;span class="syntaxdefault"&gt;0&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;])).&lt;/span&gt;&lt;span class="syntaxdefault"&gt;name &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;=&lt;/span&gt;&lt;span class="syntaxdefault"&gt; &lt;/span&gt;&lt;span class="syntaxstring"&gt;'nonfoo'&lt;br /&gt;&lt;/span&gt;&lt;span class="syntaxdefault"&gt;                                end&lt;br /&gt;                                 &lt;br /&gt;                        &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span class="syntaxdefault"&gt;                foo &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;=&lt;/span&gt;&lt;span class="syntaxdefault"&gt; model&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;.&lt;/span&gt;&lt;span class="syntaxdefault"&gt;entities&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;.&lt;/span&gt;&lt;span class="syntaxdefault"&gt;find_all &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;{|&lt;/span&gt;&lt;span class="syntaxdefault"&gt;ent&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;|&lt;/span&gt;&lt;span class="syntaxdefault"&gt; ent&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;.&lt;/span&gt;&lt;span class="syntaxdefault"&gt;name &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;==&lt;/span&gt;&lt;span class="syntaxdefault"&gt; &lt;/span&gt;&lt;span class="syntaxstring"&gt;'foo'&lt;/span&gt;&lt;span class="syntaxdefault"&gt; &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;}&lt;/span&gt;&lt;span class="syntaxdefault"&gt;    &lt;br /&gt;                nonfoo &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;=&lt;/span&gt;&lt;span class="syntaxdefault"&gt; model&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;.&lt;/span&gt;&lt;span class="syntaxdefault"&gt;entities&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;.&lt;/span&gt;&lt;span class="syntaxdefault"&gt;find_all &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;{|&lt;/span&gt;&lt;span class="syntaxdefault"&gt;ent&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;|&lt;/span&gt;&lt;span class="syntaxdefault"&gt; ent&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;.&lt;/span&gt;&lt;span class="syntaxdefault"&gt;name &lt;/span&gt;&lt;span class="syntaxkeyword"&gt;==&lt;/span&gt;&lt;span class="syntaxdefault"&gt; &lt;/span&gt;&lt;span class="syntaxstring"&gt;'nonfoo'&lt;/span&gt;&lt;span class="syntaxkeyword"&gt;}&lt;/span&gt;&lt;span class="syntaxdefault"&gt;     &lt;br /&gt;            end&lt;/span&gt;
</code></pre>
<hr />
<p dir="auto"><a href="/uploads/imported_attachments/CaY6_bool.skp">bool.skp</a></p>
]]></description><link>https://community.sketchucation.com/post/1316664</link><guid isPermaLink="true">https://community.sketchucation.com/post/1316664</guid><dc:creator><![CDATA[liquid98]]></dc:creator><pubDate>Sat, 17 Mar 2012 19:35:18 GMT</pubDate></item><item><title><![CDATA[Reply to Boolean: how do I  &#x27;outershell&#x27; multiple groups&#x2F;components? on Wed, 14 Mar 2012 23:09:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/liquid98" aria-label="Profile: liquid98">@<bdi>liquid98</bdi></a> said:</p>
<blockquote>
<p dir="auto">The tree tests (right class?, manifold? and pro) aren't relevant in my situation.</p>
</blockquote>
<p dir="auto">Yes they are.. you just do not realize it yet.<br />
You cannot call <code> outer_shell()</code> or <code> manifold?</code> on an entity, unless it is either a <code> Sketchup::Group</code> or <code> Sketchup::ComponentInstance</code> instance object.<br />
IF you call <code> outer_shell()</code> when <code> Sketchup.is_pro?</code> is false (Free edition,) an Error will be raised.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/liquid98" aria-label="Profile: liquid98">@<bdi>liquid98</bdi></a> said:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dan" aria-label="Profile: dan">@<bdi>dan</bdi></a> rathbun said:</p>
<blockquote>
<p dir="auto">Secondly, you must make an Array copy, of the entities (or any C++ collection,) if you will be making model changes during the iteration.<br />
This is the part I don't get.</p>
</blockquote>
</blockquote>
<p dir="auto">Because when changes are made to the model on the C++ side, the objects in the C++ collections are shuffled around. Your iterator will "lose it's way," and miss processing some entities, and process others multiple times.</p>
<p dir="auto">So use the <code> to_a</code> method, to make an <code> Array</code>, of ONLY the groups in the C++ collection, like this:</p>
<pre><code>grps = []
model.entities.to_a.each {|ent|
  grps &lt;&lt; ent if ent.is_a?(Sketchup;;Group)
}
</code></pre>
<p dir="auto">Or use the <code> find_all</code> method (which always returns an array.):</p>
<pre><code>grps = model.entities.find_all {|ent| ent.is_a?(Sketchup;;Group) }

</code></pre>
<p dir="auto">Then you can safely iterate using the members of the <code> grps</code> array (and when the entities collection rehashes itself, it will not effect your iteration.)</p>
<pre><code>unless grps.empty?
  grps.each {|grp|
    # process each group, one at a time
  }
end
</code></pre>
]]></description><link>https://community.sketchucation.com/post/1316110</link><guid isPermaLink="true">https://community.sketchucation.com/post/1316110</guid><dc:creator><![CDATA[Dan Rathbun]]></dc:creator><pubDate>Wed, 14 Mar 2012 23:09:22 GMT</pubDate></item><item><title><![CDATA[Reply to Boolean: how do I  &#x27;outershell&#x27; multiple groups&#x2F;components? on Wed, 14 Mar 2012 20:41:08 GMT]]></title><description><![CDATA[<p dir="auto">Hi Dan,</p>
<p dir="auto">Thanx for your input. Used to post my questions in the 'plugins' section, my apologies for that.<br />
First thanx for pointing me out, the code snippet section was totally new for me, so that's a good one!</p>
<p dir="auto">I realize I was to quick posting my code. Indeed, the iteration range was not ok. The tree tests (right class?,<br />
manifold? and pro) aren't relevant in my situation.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dan" aria-label="Profile: dan">@<bdi>dan</bdi></a> rathbun said:</p>
<blockquote>
<p dir="auto">Secondly, you must make an Array copy, of the entities (or any C++ collection,) if you will be making model changes during the iteration.<br />
This is the part I don't get. You say TIG wrote a lot about this subject..<br />
I'will look for it then, and come back here if I still don't get it.</p>
</blockquote>
<p dir="auto">Thank you!</p>
]]></description><link>https://community.sketchucation.com/post/1316089</link><guid isPermaLink="true">https://community.sketchucation.com/post/1316089</guid><dc:creator><![CDATA[liquid98]]></dc:creator><pubDate>Wed, 14 Mar 2012 20:41:08 GMT</pubDate></item><item><title><![CDATA[Reply to Boolean: how do I  &#x27;outershell&#x27; multiple groups&#x2F;components? on Wed, 14 Mar 2012 06:33:18 GMT]]></title><description><![CDATA[<p dir="auto">Your code will fail for several reasons. If you are going to use <code> for</code> .. <code> in</code>, you must subtract <code> 1</code> from the length of the array/set/collection. (It's better to use the <code> each</code> iterators, to avoid "fence post" errors.)</p>
<p dir="auto">Secondly, you must make an <code> Array</code> copy, of the <code> entities</code> (or any C++ collection,) if you will be making model changes during the iteration.</p>
<p dir="auto">Third you need to test the objects for class <code> Sketchup::ComponentInstance</code> or <code> Sketchup::Group</code>, etc., before doing something that you can only do to those class objects, and it's also safer to test if they are manifold, via <code> ent.manifold?</code>, before attempting boolean operations on them.</p>
<p dir="auto">Fourth, boolean methods are pro only, so a conditional to test <code> Sketchup.is_pro?</code> is also needed.</p>
<p dir="auto">Have you checked the <strong>[ Code Snippets ]</strong> Index in the Developers Forum ??<br />
Or searched the Developers Forum ?? (TIG has explained both basic and advanced entities iteration many times over.)</p>
]]></description><link>https://community.sketchucation.com/post/1315957</link><guid isPermaLink="true">https://community.sketchucation.com/post/1315957</guid><dc:creator><![CDATA[Dan Rathbun]]></dc:creator><pubDate>Wed, 14 Mar 2012 06:33:18 GMT</pubDate></item></channel></rss>