Color lost in translation (or any operation)



  • I'm seeing some behavior which is different from what I would expect. My solids are losing their color when they are translated or operated on in any other way (ie booleans).

    Is this the desired behavior? I remember V1 working differently and I would advocate for solids holding their color through operations.

    Here's a quick example which shows the behavior in jscad.xyz

    const jscad = require('@jscad/modeling')
    const { colorize, colorNameToRgb } = jscad.colors
    const { sphere } = jscad.primitives
    const { translate } = jscad.transforms
    
    const main = () => {
      
      const colorSphere = colorize(colorNameToRgb('red'), sphere())
      
      const translatedSphere = translate([5, 0, 0], colorSphere)
      
    
      return [
        colorSphere,
        translatedSphere
      ]
    }
    
    module.exports = { main }
    

    I would expect to see two red spheres, but instead I see:

    393d8a6f-2852-4c92-9c02-a1a101715805-image.png

    Is this a bug?



  • Thanks! I'll give it a comment of support there 😀



  • @BarbourSmith there's an open issue about this as well.

    https://github.com/jscad/OpenJSCAD.org/issues/594



  • @BarbourSmith well... let's call it a feature of V2.

    colors should be added as the last step, after all operations are completed.


Log in to reply