Jump to content
Ultimaker Community of 3D Printing Experts

OpenSCAD polygon builder.


Recommended Posts

Posted · OpenSCAD polygon builder.

I'm making extensive use of OpenSCAD. The only problem I found is that the polygon function is hard to use. I rather draw my polygons visual. So I created a simple polygon editor for OpenSCAD in Javascript+HTML.

It can be found at:

http://daid.eu/~daid/3d/

Action screenshot:

http://daid.eu/~daid/Screenshot.png

How does it work? Well, simply paste the OpenSCAD code containing polygons in the lower left text area. And the polygons will show up. Then use the edit/add/delete tools to modify the polygons and it will update the code automatically (like magic). Just copy it back to OpenSCAD for the final result.

Example code:

 

$fs = 0.4;render() intersection() {rotate([-90,0,0]) linear_extrude(height=20,center=true) polygon([[24,0],[21,4],[15,7],[-13,7],[-21,4],[-24,1],[-24,-5],[-13,-4],[-12,0],[-9,0],[-7,1],[11,1],[13,-1],[25,-2]]);linear_extrude(height=20,center=true) polygon([[23,-3],[25,0],[23,3],[19,6],[12,8],[-20,8],[-23,6],[-24,0],[-23,-6],[-20,-8],[12,-8],[19,-6]]);rotate([-90,0,90]) linear_extrude(height=100,center=true) polygon([[8,-8],[-8,-8],[-8,2],[-7,5],[-5,7],[5,7],[7,5],[8,2]]);}translate([-3,0,-2]) cylinder(r=1,h=20);translate([ 8,0,-2]) cylinder(r=1,h=20);

 

I've tested it in firefox, IE and chrome. Which all worked without a hitch.

If you want an offline version. Just save the page, everything needed for the tool to function is in a single HTML file.

  • Share this post


    Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    • Our picks

      • Talking additive | The 3D printing podcast
        Why should we be the only ones asking questions? Join us and ask Jabil all your questions on September 22nd 5pm CET
          • Like
        • 3 replies
      • Ultimaker masterclass: Optimizing your Ultimaker Cura workflow
        Save your seat for either broadcast on September 23.
        What will you learn?
        · Best practices for iterative print preparation and every lesson you should learn from each print
        · The right way to use per-object settings and when they are most useful
        · Easy-to-use resources for anyone who wants to develop their own printer definitions, plugins, or print profiles
        · How to optimize print profile settings and whether to “keep” or “discard” changes
        · When is the right time to export your drawing from CAD? (Based on Ultimaker Cura’s surprising power as 3D control software)
        · And a whole lot more tips and tricks!
         
        How can I join?
        This free masterclass will take place twice:
        1. 11am CEST (5pm SGT, 5am EDT)
        2. 5pm CEST (11am EDT, 8am PDT, 11pm SGT)
          • Like
        • 0 replies
      • Do you use 3D printing at work? Let us know
        It doesn't matter if you are using 1 Ultimaker or 10, there is inspiration in everything. We're looking for ...
        • 1 reply
    ×
    ×
    • Create New...