JSCAD User Group

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

    Design with random values

    Comments & Feedback
    2
    3
    1293
    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.
    • gilboonet
      gilboonet last edited by

      Hello, I have a little programming design problem : I made a design that randomly builds a circular labyrinth. It has two modes, one to view the design in 3d as it would be when finished, and one in 2d with the background to lasercut. The idea is to first view 3d mode and update till the random arrangement looks good, then switch to 2d to save the pattern to .svg to cut it. My problem is that as the script uses Math.random(), when you switch from 3d to 2d, the design will change, is there a way to be able to use designs with random values that would not be lost when switching parameters (mode here) ?

      The script is here : https://openjscad.org/#https://raw.githubusercontent.com/gilboonet/designs/master/laby_rond.jscad

      1 Reply Last reply Reply Quote 0
      • gilboonet
        gilboonet last edited by

        Thank you. I will try something similar, it just needs to add a parameter to choose a design number, if the table of random values doesn't have values for this number they are randomly feeded, else they are used for the rendering. Such "mechanism" could be handy for designs using both random values and more than one viewing mode.

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

          Maybe you could build a table of randon values while in 3D mode, then save those for use by the 2D mode.

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