Loading

OpenSCAD polygon editor (single HTML file)

by Daid, published

OpenSCAD polygon editor (single HTML file) by Daid Dec 2, 2011
Tip Designer Report Thing

Thing Info

22379Views 1262Downloads

Summary

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.

Following the idea from the "OpenScad Polygon Generator" by "PieterBos" http://www.thingiverse.com/thing:9290
But then working for any OS, any browser, without fuss. You don't even need to install anything! (might even work in mobile browsers)

Online version can be found at:
http://daid.mine.nu/~daid/3d/
Latest sources can be found at:
https://github.com/daid/OpenSCAD-polygon-editor

Instructions

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.

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

You can use the uploaded HTML file as offline tool.

Tip Designer Report Thing

Thing Info

22379Views 1262Downloads

Liked By

View All

License

Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag. Print Thing Tag

All Apps

No results.

I just used this cool script again.  This time I noticed the image I needed to rotate the image by 90 degrees and then nudge it over a few pixels this way and that.  Using FireBug in Firefox, I was able to adjust the image using some minor CSS.  However, being able to move the image around a little with some basic buttons would be pretty helpful.  :)

This is great! I've just used it to add some detail to some Settlers of Catan pieces I'm working on. You've saved me a great deal of time, thanks!

Great work on the OpenSCAD polygon editor. Thanks for all your work! What a relief something like this exist.

Would it be possible to suggest some additional features for it? Maybe the following functionality already exists and I just don't know how to use it but these are some thoughts;

  1. Undo seems to work if I click in the code window and press CTRL+Z. It would be nice if it would be possible to dete
    ct and act on the keypress without clicking in the code window, or alternatively a Undo button in the toolbar.

  2. Is it possible to add functionality for inserting a polygon "point" graphically? Preferably by clicking on a line between two existing points. it seems now it is only possible to add a
    point at the end of the list.
Daid - in reply to Ante

1) The undo functionality is... unintentional :P guess it works, but it was never designed in. I might have a look to see if I can send the CTRL+Z keypress to the textbox.

2) Yes, this was bothering me also. So it's on the plan, but not sure when. Most likely when I need to use this tool again myself.

I love this. Feature request; start with a really simple polygon so I can play without having to author any openscad code.

You don't have to import any OpenSCAD code, just click on the [new] on the toolbar path selection, and then use the [add] tool to draw new points. (the add tool is the green plus). It will create a new Polygon([[x,y]]);

Nice one no flash needed :-)

Made a new version of my generator btw http://www.thingiverse.com/thing:13348http://www.thingiverse.com/thi... this one olso has a online version http://www.protorabbit.nl/flash/polygonrabbit/PolygonRabbit.htmlhttp://www.protorabbit.nl/flas... but i really like the way u are using the scad code as a base

PolygonRabbit a OpenScad Polygon Generator

Great job Daid! Love this so much, I'm hosting it on my site too. I also remade the code into pieces so your browser will cache things better: http://maker3.com/openscad/http://maker3.com/openscad/

This is FANTASTIC! If I may make a minor feature request... Could you implement a way to specify a picture on the internet that would then be placed behind the grid and could be switched on/off? Doing so would allow people to upload an image, trace it, and download the file in OpenSCAD.

Could not help it i added a background image upload to my version :-[

http://www.protorabbit.nl/flash/polygonrabbit/PolygonRabbit.htmlhttp://www.protorabbit.nl/flas... (also in the air app).No files get uploaded btw its all handled locally. :-P

In that case, I cannot stay behind ;) so my editor also features an image function now. Allows direct load from disk with firefox and chrome, but not in IE8 because it lacks the javascript features from HTML5 for that. It also never uploads anything same as PietersBos's version.

It also allows you to specify an URL.

:) superlike from me :-D

Honestly, the first version had this, but the code was butt ugly (and had another set of problems) but it's one of the features I might add. Just like bezier curves.

I also noticed a few 'issues' during use. No bugs, but things that could be friendlier.

But, it's all open source, so anyone can edit it if they want.

Awesome! you should put this on GitHub, so everyone can contribute! :)

Or if you don't mind, I will.

https://github.com/daid/OpenSCAD-polygon-editorhttps://github.com/daid/OpenSC...

Done! I also fixed a bug, where the editor would jump back to the first polygon if you tried to copy/paste the resulting code.

that does it, now I dont have to learn sketchup!

Sweet! I'm sure I'll make good use of this.

Top