<?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[Union on multi-color imported obj file lose colors]]></title><description><![CDATA[<p dir="auto">Hello, I'm trying to work with a multi-color obj file. It has 7 parts for a total of 312 triangles, and when I join them (with union), there are only 258 triangles which is explained by the fact that if the 7 parts had only 3 vertices polygons, the joined version had both 3 and 4 vertices polygons. This is not a big deal, but apparently as soon as a 4 vertices polygons appear, colors are lost for all remaining polygons. Is it a bug ? For the moment I can use a specific union function.<br />
<img src="/assets/uploads/files/1642795270550-capture-d-%C3%A9cran-de-2022-01-21-20-40-10.png" alt="Capture d’écran de 2022-01-21 20-40-10.png" class=" img-responsive img-markdown" /></p>
]]></description><link>https://openjscad.nodebb.com/topic/337/union-on-multi-color-imported-obj-file-lose-colors</link><generator>RSS for Node</generator><lastBuildDate>Sat, 07 Mar 2026 12:28:30 GMT</lastBuildDate><atom:link href="https://openjscad.nodebb.com/topic/337.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 21 Jan 2022 20:01:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Union on multi-color imported obj file lose colors on Sun, 23 Jan 2022 09:08:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://openjscad.nodebb.com/uid/1">@z3dev</a> Sadly, lines already have a color (red for cuts, maroon for mountain fold and green for valley fold).<br />
<img src="/assets/uploads/files/1642928915791-capture-d-%C3%A9cran-de-2022-01-23-10-07-15.png" alt="Capture d’écran de 2022-01-23 10-07-15.png" class=" img-responsive img-markdown" /></p>
]]></description><link>https://openjscad.nodebb.com/post/1087</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/1087</guid><dc:creator><![CDATA[gilboonet]]></dc:creator><pubDate>Sun, 23 Jan 2022 09:08:53 GMT</pubDate></item><item><title><![CDATA[Reply to Union on multi-color imported obj file lose colors on Sun, 23 Jan 2022 08:12:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://openjscad.nodebb.com/uid/5">@gilboonet</a> is it possible to add color to each of the unfolded pieces, i.e. add color to the lines?</p>
]]></description><link>https://openjscad.nodebb.com/post/1085</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/1085</guid><dc:creator><![CDATA[z3dev]]></dc:creator><pubDate>Sun, 23 Jan 2022 08:12:50 GMT</pubDate></item><item><title><![CDATA[Reply to Union on multi-color imported obj file lose colors on Sun, 23 Jan 2022 05:46:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://openjscad.nodebb.com/uid/1">@z3dev</a> As you said, I'm keeping track of the colors from the original polygons and the unfolding works fine among those colors, but now my problem is that I didn't find a way to render the unfolded pieces with this color (imagine one of the colored 3d polygon on the volume unfolded with its color).</p>
]]></description><link>https://openjscad.nodebb.com/post/1084</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/1084</guid><dc:creator><![CDATA[gilboonet]]></dc:creator><pubDate>Sun, 23 Jan 2022 05:46:44 GMT</pubDate></item><item><title><![CDATA[Reply to Union on multi-color imported obj file lose colors on Sun, 23 Jan 2022 04:20:25 GMT]]></title><description><![CDATA[<p dir="auto">I’m not sure as the ability to track the original polygon colors will depend on the unfolding algorithm. Maybe the algorithm can keep a map to the original polygon, and use the original color when creating the 2D paths</p>
]]></description><link>https://openjscad.nodebb.com/post/1083</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/1083</guid><dc:creator><![CDATA[z3dev]]></dc:creator><pubDate>Sun, 23 Jan 2022 04:20:25 GMT</pubDate></item><item><title><![CDATA[Reply to Union on multi-color imported obj file lose colors on Sun, 23 Jan 2022 04:15:31 GMT]]></title><description><![CDATA[<p dir="auto">The Boolean functions always return a new solid, without colors. This makes the results easy to understand.</p>
<p dir="auto">For designs that want to use colors, the colors should be applied as the last step of a design. This allows designs to control the colors when exporting, e.g. exporting to OBJ with colors.</p>
]]></description><link>https://openjscad.nodebb.com/post/1082</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/1082</guid><dc:creator><![CDATA[z3dev]]></dc:creator><pubDate>Sun, 23 Jan 2022 04:15:31 GMT</pubDate></item><item><title><![CDATA[Reply to Union on multi-color imported obj file lose colors on Sat, 22 Jan 2022 23:35:33 GMT]]></title><description><![CDATA[<p dir="auto">It only took :</p>
<pre><code>let vf = require('./' + fileName)
var vf2 = vf[0]
if (vf.length &gt; 1) {
	for (var i = 1; i &lt; vf.length; i++){
		vf[i].polygons.forEach(function(p){ vf2.polygons.push(p) })
	}
}
var V = toPolyhedron(vf2)
</code></pre>
<p dir="auto">But now as my script handles multi-color obj files and can unfold them as separate pieces, is there a way to render (in 2d) those pieces in color (if possible the same that is used on the 3d model) ? For the moment it's not easy to see which unfolded piece correspond a 3d piece.<br />
<img src="/assets/uploads/files/1642894528148-capture-deplieur-couleurs.png" alt="capture DEPLIEUR COULEURS.png" class=" img-responsive img-markdown" /></p>
]]></description><link>https://openjscad.nodebb.com/post/1081</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/1081</guid><dc:creator><![CDATA[gilboonet]]></dc:creator><pubDate>Sat, 22 Jan 2022 23:35:33 GMT</pubDate></item></channel></rss>