Introduction:
Google Summer of Code, is an international software development program organized annually. Every year, thousands of students from all over the world apply for this life changing opportunity (in the literal sense) and only a fraction of them actually get to live this dream. I am one of them.
My GSoC project is called User Interface for Customizing Models. It is under the umbrella organization of BRL-CAD. OpenSCAD is an open source organization that serves a free software to create solid 3d CAD objects. OpenSCAD has in a way redefined how easy 3D modeling can be. But the Wikipedia article on OpenSCAD says that it is a non interactive modeler, but rather a 3D compiler based on a textual description language. Pay attention to the above line, it’s primarily what I’ll be talking about in this post.
What the guys over at Wikipedia said is true but their version of the truth needs a little filtration (rather trimming). OpenSCAD’s way of customization is interactive, just not through a graphical interface. And this contingency makes the whole 3D modeling thing a little less easy than it can be. But all of that is about to change. How? Just read the rest of the post and see for yourself.
Solid 3D modeling. That sounds like some serious business. But it’s just an awesome tool for making models pertaining to many uses (mostly 3D printing). And 3D printing as we can all agree upon is cool. 3D models can be created by anyone using OpenSCAD. OpenSCAD is as much for designers as it is for you and me. What else can most people agree upon apart from the fact that solid 3D modeling is cool? A graphical interface is simpler and more intuitive to use. There is a general aversion for typing commands in order to get things done. Simply put, more people have an inclination towards GUI.
This is something that OpenSCAD lacked. But the benevolent folks at Thingiverse.com found a way to help out the demographic intersection of GUI lovers and OpenSCAD users. The website provides an easy to use interface to customize models of OpenSCAD. All one needs to do is upload the OpenSCAD file. After uploading the file, what you’ll see can only be described as being magic. I’m kidding, it’s just very useful is all. The OpenSCAD’s script is used to make a form containing slide bars, text boxes, combo boxes, labels, etc all for the singular purpose of customizing models.
My GSoC project was to include similar functionality into OpenSCAD itself. Constantly having to upload files created in one software (OpenSCAD) to a website in order to customize your models can get a little problematic as one is uploading scripts without being able to confirm how the script will translate into a form on the site. Wouldn’t it be great if everything is at one place, the original place: OpenSCAD? Of course, it would.
My project intends to define a user interface to customize models interactively instead of having to modify them manually. It will enable the user to create the templates for a given model which can further be changed as per user’s requirements.
This project upon completion will allow the modelers to create generic models (templates) which others can then customize to cater to their own use.
Goals:
The major goals of My project are:
- Syntax support for generation of customization form:
The customization form generated on Thingiverse is based on a certain syntax for both describing the elements in the form and providing a range of their values. In order to make this work in OpenSCAD as well, the same style of description and parametrization can be incorporated into OpenSCAD. Hence the user will be able to generate the customization form from within OpenSCAD by adding a few simple lines in the .scad file. - Customization of the model from the form:
Once the form is ready, it must be able to customize the model as desired by the user. The changes made in the form should directly correspond to changes in the model itself. - Enhancing the UI for the customization form:
The customization form is there to make the whole customization thing easy. And that implies that the form itself should also be easy to use. And this can be achieved by having a good and simple look to the whole thing.
Current State:
So I’ve cleared my GSoC mid-term. That means I must have tasted some success in regards to achieving some of the above-mentioned goals. The version of OpenSCAD I represent provides the syntax support for generation of the customization form and then some!
Unlike in Thingiverse where parameters need to be placed at the top of your script before the first module declaration, parameters in this version of OpenSCAD can be placed anywhere in the script, outside module declaration. This should be in the following form:
// variable description variable name = default value; // possible values
The variable description line is optional but is useful to give the user an idea of what the parameter defines.
Furthermore, it will make input widget for only those parameters that you want it to and not for every parameter there is in the script.
There are a couple of things that are different from Thingiverse but are a little more modest.
Variable names will not be automatically formatted to be more readable.For instance small_box_height will not be labeled “Small Box Height” on the form.
Unlike in Thingiverse where the possible values comment at the end is optional, this version of OpenSCAD requires you to have this comment otherwise, the widget for this variable will not be provided in the form. This is in accordance to what I discussed earlier i.e. the liberty to choose what variable will be having a widget in the form.
Following is the syntax for how to define different types of widgets in the form:


- Drop down box:
// combo box for nunber Numbers=2; // [0, 1, 2, 3]
// combo box for string Strings="foo"; // [foo, bar, baz]
//labeled combo box for numbers Labeled_values=10; // [10:L, 20:M, 30:L]
//labeled combo box for string Labeled_value="S"; // [S:Small, M:Medium, L:Large]
- Slider:
Only numbers are allowed in this one, specify any of the following:// slider widget for number slider =34; // [10:100]
//step slider for number stepSlider=2; //[0:5:100]
- Checkbox:
//description Variable = true //comment
- Spinbox:
// spinbox with step size 23 Spinbox= 5; //23
- Textbox:
//Text box for vector with more than 4 elements Vector=[12,34,44,43,23,23];//comment
// Text box for string String="hello"; //comment
- Special vector
//Text box for vector with less than or equal to 4 elements Vector2=[12,34,45,23]; //any thing
Future Scope:
The above section of this post described the current state of the project. I plan to include all the main features from Thingiverse and then add some more to make the user experience even better. Some of these features include:
- Grouping of widgets based how the user wants to use them.
- The functionality of being able to export changes made in the form to a script (sort of like the inverse what we are doing).
- Enhancing the form UI.
- This one is a biggie, so pay attention. The current syntax is based on Thingiverse. But that need not be permanent. In the future, we can have a whole new syntax support in OpenSCAD for doing exactly what the current syntax does. This future inclusion would enable OpenSCAD to offer a far grander set of features than the present version does. This would also imply some improvement in the performance (as the current version is basically a detailed post-processing of the script).
Following is the syntax for how to define different types of widgets in the form with native syntax that we might support ( discussion regarding this syntax is going on, you can also be part of that discussion and give your opinion ):
Note: This is planned syntax for future but not included in yet in final PR
- Drop down box:
@Description("combo box for nunber") @Parameter([0, 1, 2, 3]) Numbers = 2;
@Description("combo box for string") @Parameter(["foo", "bar", "baz"]) Strings = "foo";
@Description("labeled combo box for numbers") @Parameter([[10, "L"], [20, "M"], [30, "L"]]) Labeled_values = 10;
@Description("labeled combo box for string") @Parameter([["S", "Small"], ["M", "Medium"], ["L", "Large"]]) Labeled_value = "S";
- Slider:
Only numbers are allowed in this one, specify any of the following:@Description("slider widget for number") @Parameter([10 : 100]) slider = 34;
@Description("step slider for number") @Parameter([0 : 5 : 100]) stepSlider = 2;
- Checkbox:
@Description("Checkbox for boolean ") @Parameter() Variable = true;
- Spinbox:
@Description("spinbox with step size 23") @Parameter(23) Spinbox = 5;
- Textbox:
@Description("Text box for string") @Parameter() String = "hello";
@Description("Text box for vector with more than 4 elements ") @Parameter() Vector = [12, 34, 45, 12, 23, 56];
- Special vector
@Description("Text box for vector with less than or equal to 4 elements") @Parameter() Vector2 = [12, 34, 45, 23];
This is what future of OpenSCAD will look like.
Click here to see New Features
Make sure to check it out at and provide a feedback:
Latest snapshots( with Thingiverse syntax):
- Mac:
- Window:
- http://files.openscad.org/snapshots/OpenSCAD-2016.10.05-x86-32_gsoc2016-refactored-Installer.exe
- http://files.openscad.org/snapshots/OpenSCAD-2016.10.05-x86-32_gsoc2016-refactored.zip
- http://files.openscad.org/snapshots/OpenSCAD-2016.10.05-x86-64_gsoc2016-refactored-Installer.exe
- http://files.openscad.org/snapshots/OpenSCAD-2016.10.05-x86-64_gsoc2016-refactored.zip
- Source Code:
Old Snapshots (with both Thingiverse syntax and native syntax ):
- Mac:
http://files.openscad.org/snapshots/OpenSCAD-2016.07.15-gsoc2016.dmg - Window:
- 32 bit:
http://files.openscad.org/snapshots/OpenSCAD-2016.07.15-x86-32_gsoc2016-Installer.exe - 64 bit:
http://files.openscad.org/snapshots/OpenSCAD-2016.07.15-x86-64_gsoc2016-Installer.exe - Zip files
http://files.openscad.org/snapshots/OpenSCAD-2016.07.15-x86-32_gsoc2016.zip
http://files.openscad.org/snapshots/OpenSCAD-2016.07.15-x86-64_gsoc2016.zip
- 32 bit:
- Source Code:
I just saw this come up on #openscad on freenode. I wanted to say, Fantastic work! I can’t wait to see your repo pulled back into the main openscad repo!
LikeLike
Thanks, buddy. It would be great to get your feedback on it and how it can be improved for better user experience. I think new binaries would be ready soon with the feature i.e. pagination of parameters and many more features to come.
LikeLike
Too cool, thanks!
LikeLike
Hi Amarjeet i’m getting a syntax error can you please help?
// spinbox with step size 23
Spinbox= 5; //23
ERROR: Parser error in file “C:\Program Files (x86)\OpenSCAD”, line 20: syntax error
ERROR: Compilation failed!
LikeLike
Hi, I tried this code on windows and Linux. I didn’t get any error. Would you show the full code?
LikeLike
Hi,
Awesome, I was waiting something like that for my Ultimate Box Maker.
I just downloaded and tried it right now, already working with some options.
I will test it deeper, I really wish to make all the box and panel maker working with.
Thanks a lot Amar.
LikeLike
Hey, nice work. Formerly, I made custom GUI for the openscad parameters using PyQt5, but this is way better than my idea. One thing, Textbox doesn’t seem to work nicely with the non latin language especially Korean (I am using text module for the Korean).
LikeLike
Thanks Kim, for reviewing it. And I think there was a small bug related to text box when these binaries were made which was corrected later, When I found it will testing the code.
I will talk about support for Non-Latin languages with my mentors.
Plus If you found any new issues or feature that could be part of this project do tell us.
P.S You can also check out https://amarjeetkapoor1.wordpress.com/2016/07/18/user-interface-for-customizing-models-part-2/ (although binaries are not available for these but you can build it from source at https://github.com/openscad/openscad/tree/gsoc2016
LikeLike
Very, very nice! Big Thanks!
I use openscad and very needed in this functionality.
On windows it works perfectly! Now i will wait functionality about groupping parameters.
LikeLike
Thanks for providing feedback and I think the grouping feature is already in this version. You can refer to https://amarjeetkapoor1.wordpress.com/2016/07/18/user-interface-for-customizing-models-part-2/ (although feature of save parameters is not available in the binaries).
LikeLike
Hi,
the parameter option is great!
it should be nice if you can add a parameter in more than one group so you make a simple and advanced parameter section
LikeLike
Thanks karijin for reviewing.
We can add parameter to more than one group by making it global but If you want to add parameter to some groups not all then there is no option at present.
Above feature and many more features that we had thought about will be added once our native syntax gets finalize.
LikeLike
btw, I can’t wait to see more 🙂
LikeLike
That’s amazing, fun and very useful! I have cloned the repository and compiled this branch and I am currently expermenting on this, will try and spread the word as much as I can.
LikeLike
Thanks claudio and If any bug found do report on link given at the end of the post.
LikeLike
Reblogged this on julian correa.
LikeLike
One suggestion: It would be nice to be able to save and load a set of parameters, so I can have different preconfigured sets easily available.
As the parameters probably already exist in a some kind of memory structure, saving and load from file shouldn’t be that hard. Just a simple list, for example:
parametername1=value
parametername2=value
LikeLike
It had been already there. Just check
https://amarjeetkapoor1.wordpress.com/2016/07/18/user-interface-for-customizing-models-part-2/
or
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/WIP#Customizer
LikeLike
Thank you. I hang my head in shame, should have read the manual.
Either way, great work!
LikeLike
Thanks for liking the work. If you have any other suggestions or found any other bug do report.
LikeLike
Woah what an content on %BT%! That’s an element I`ve been surfing for decades!
I believe a bit more on the way concurrently?
LikeLike
Thanks for a marvelous posting! I really enjoyed reading it, you are a great author.
I will be sure to bookmark your blog and definitely will come back later in life.
I want to encourage continue your great posts, have a nice holiday weekend!
LikeLike
I like the helpful information you provide on your articles.
I’ll bookmark your blog and check again here regularly.
I am quite sure I will learn plenty of new stuff right right
here! Good luck for the following!
LikeLike
Wow that was odd. I just wrote an extremely long comment but after I
clicked submit my comment didn’t show up. Grrrr… well I’m not
writing all that over again. Anyways, just wanted
to say wonderful blog!
LikeLike
These are truly wonderful ideas in regarding blogging.
You have touched some nice points here. Any way keep up wrinting.
LikeLike
I have been exploring for a little for any high-quality
articles or blog posts in this kind of area . Exploring in Yahoo I finally stumbled upon this web site.
Studying this information So i am glad to convey that
I’ve an incredibly good uncanny feeling I found out exactly what I
needed. I most unquestionably will make certain to don?t put out of your mind this web site and give it a
glance on a constant basis.
LikeLike
I think this is one of the most significant information for
me. And i am glad reading your article. But should remark on few general things,
The website style is perfect, the articles is really
excellent : D. Good job, cheers
LikeLike
Hi to all, because I am genuinely keen of reading
this webpage’s post to be updated on a regular basis. It includes good data.
LikeLike
What a data of un-ambiguity and preserveness of
precious know-how on the topic of unpredicted emotions.
LikeLike