Union on multi-color imported obj file lose colors
-
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.
-
@z3dev Sadly, lines already have a color (red for cuts, maroon for mountain fold and green for valley fold).
-
@gilboonet is it possible to add color to each of the unfolded pieces, i.e. add color to the lines?
-
@z3dev 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).
-
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
-
The Boolean functions always return a new solid, without colors. This makes the results easy to understand.
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.
-
It only took :
let vf = require('./' + fileName) var vf2 = vf[0] if (vf.length > 1) { for (var i = 1; i < vf.length; i++){ vf[i].polygons.forEach(function(p){ vf2.polygons.push(p) }) } } var V = toPolyhedron(vf2)
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.