JSCAD User Group

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Color lost in translation (or any operation)

    Development Discussions
    2
    4
    546
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • BarbourSmith
      BarbourSmith last edited by

      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?

      z3dev 2 Replies Last reply Reply Quote 0
      • BarbourSmith
        BarbourSmith last edited by

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

        1 Reply Last reply Reply Quote 0
        • z3dev
          z3dev @BarbourSmith last edited by

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

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

          1 Reply Last reply Reply Quote 1
          • z3dev
            z3dev @BarbourSmith last edited by

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

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

            1 Reply Last reply Reply Quote 1
            • First post
              Last post
            Powered by NodeBB | Contributors