JSCAD User Group

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

    Porting V1 code to V2 or rewrite it ?

    Comments & Feedback
    2
    3
    460
    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'm trying to port a V1 script to V2, and apparently I'm missing something (maybe default centering ?) because I don't have same output.
      My code is not complex, it's a way to create a desktop made of plate and several columns, it's only cuboids translations and rotation. Default center of object is [0,0,0] on V2, but I don't know what it was with V1. The easier way would be to write a new script, but it would be fine if there's a way to have translations compatible from V1 to V2.

      Capture d’écran de 2021-02-21 11-24-04.png Capture d’écran de 2021-02-21 11-24-41.png

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

        @z3dev Thank you for your suggestions. What I did was only translating the code so it run on V2 regardless of placement. I'll try to implement helper function for cube and cuboid, then it should work.

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

          @gilboonet thanks.

          This design seems to be composed of both functional API (Old OpenSCAD API) and object API (CSG / CAG objects).

          This is one of the reasons that V2 has changed. It just became too UGLY for users. And unmaintainable.

          I have a couple of suggestions...

          First, you can run through the code and change the signatures of function calls to match V2. This may take some time, as you need to align shapes appropriately.

          Second, you can implement helper functions for this design. For example, ‘cube’. Your ‘cube’ function can provide the same functionality as the old OpenSCAD API, and place the cube to align the corner at 0,0,0.

          Hope that helps.

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