Porting V1 code to V2 or rewrite it ?



  • 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 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.



  • @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.


Log in to reply