<?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[how to create a multicolor polyhedron ?]]></title><description><![CDATA[<p dir="auto">Hello, to unfold my volumes I usually use a graphical editor (Wings 3d) and split it into pieces by painting each piece faces of the same color. I am wondering if there is a way to code that. Basically I have two splitting  techniques, first one is to choose a number of pieces (N) then split the model into pieces having each (model faces count / N) faces. And second one is to make as many faces path as needed, it is hard to explain in few words. I am aware that is not something that JSCAD is made for but it is something that I'm willing to try for some time.<br />
<img src="/assets/uploads/files/1648292533645-capture-d-%C3%A9cran-de-2022-03-26-11-46-45.png" alt="Capture d’écran de 2022-03-26 11-46-45.png" class=" img-responsive img-markdown" /></p>
]]></description><link>https://openjscad.nodebb.com/topic/353/how-to-create-a-multicolor-polyhedron</link><generator>RSS for Node</generator><lastBuildDate>Tue, 10 Mar 2026 15:42:50 GMT</lastBuildDate><atom:link href="https://openjscad.nodebb.com/topic/353.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 26 Mar 2022 11:02:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to how to create a multicolor polyhedron ? on Sun, 27 Mar 2022 20:27:56 GMT]]></title><description><![CDATA[<p dir="auto">I changed my obj importer code to make it work with obj without groups. Now I can start to colorize my models by code. And there's one nice thing about that : I can use that faces coloring to store a volume's unfold pattern.<br />
<img src="/assets/uploads/files/1648412375738-capture-d-%C3%A9cran-de-2022-03-26-21-48-08.png" alt="Capture d’écran de 2022-03-26 21-48-08.png" class=" img-responsive img-markdown" /></p>
]]></description><link>https://openjscad.nodebb.com/post/1152</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/1152</guid><dc:creator><![CDATA[gilboonet]]></dc:creator><pubDate>Sun, 27 Mar 2022 20:27:56 GMT</pubDate></item><item><title><![CDATA[Reply to how to create a multicolor polyhedron ? on Sat, 26 Mar 2022 14:55:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://openjscad.nodebb.com/uid/1">@z3dev</a> I have an app that uses .obj so this format is my preffered one. For the moment when I export a polyhedron where I changed polygons.color values, I first need to import/export with Wings 3d for my app to be able to use it correctly, JSCAD doesn't create groups but add usemtl, I will look at my code to make it work without "g" lines.<br />
<img src="/assets/uploads/files/1648306545786-capture-d-%C3%A9cran-de-2022-03-26-15-52-30.png" alt="Capture d’écran de 2022-03-26 15-52-30.png" class=" img-responsive img-markdown" /></p>
]]></description><link>https://openjscad.nodebb.com/post/1151</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/1151</guid><dc:creator><![CDATA[gilboonet]]></dc:creator><pubDate>Sat, 26 Mar 2022 14:55:47 GMT</pubDate></item><item><title><![CDATA[Reply to how to create a multicolor polyhedron ? on Sat, 26 Mar 2022 14:06:14 GMT]]></title><description><![CDATA[<p dir="auto">As <a class="plugin-mentions-user plugin-mentions-a" href="https://openjscad.nodebb.com/uid/152">@hrgdavor</a> mentioned, colors can be set per polygon. This will allow you to control the rendering. Are you exporting to a specific format?</p>
]]></description><link>https://openjscad.nodebb.com/post/1150</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/1150</guid><dc:creator><![CDATA[z3dev]]></dc:creator><pubDate>Sat, 26 Mar 2022 14:06:14 GMT</pubDate></item><item><title><![CDATA[Reply to how to create a multicolor polyhedron ? on Sat, 26 Mar 2022 12:02:01 GMT]]></title><description><![CDATA[<p dir="auto">looking at jscad sourcecode you can set color on each polygon,<br />
<img src="/assets/uploads/files/1648296085619-cd8a6544-f051-4e44-8f65-eec31b05461d-image.png" alt="cd8a6544-f051-4e44-8f65-eec31b05461d-image.png" class=" img-responsive img-markdown" /></p>
<pre><code class="language-js">const jscad = require('@jscad/modeling')
const { cube } = jscad.primitives

function main(){
  const c = cube({size:10})
  c.polygons[0].color = [1,0,0]
  c.polygons[2].color = [0,1,0]
  console.log(c)
  return c
}

module.exports = {main}
</code></pre>
]]></description><link>https://openjscad.nodebb.com/post/1149</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/1149</guid><dc:creator><![CDATA[hrgdavor]]></dc:creator><pubDate>Sat, 26 Mar 2022 12:02:01 GMT</pubDate></item></channel></rss>