Hyper Links And Hyperfunctional Text CAD

Strong opinions exist on both sides about OpenSCAD. The lightweight program takes megabytes of space, not gigabytes, so many people have a copy, even if they’ve never written a shape. Some people adore the text-only modeling language, and some people abhor the minimal function list. [Johnathon ‘Zalo’ Selstad] appreciates the idea but wants to see something more robust, and he wants to see it in your browser. His project CascadeStudio has a GitHub repo and a live link so you can start tinkering in a new window straight away.

We’re going to assume that anyone reading past this point is familiar with this type of modeling.

At the first keystroke, it is evident that CascadeStudio is different from OpenSCAD. For starters, tooltips reveal that formatting is a little different. A cone in OpenSCAD uses the cylinder() function while CascadeStudio insists that Cylinders() are the same diameter at the top and bottom, but a Cone() tapers. You may also notice the capital letters for CascadeStudio. Minor differences of this scale mean that anyone familiar with one may have speedbumps with the other, but not roadblocks.

In our opinion, the biggest boon to CascadeStudio is that you can send someone a URL, and they will get access to a fully-functional copy. You cannot simultaneously edit like a Google document, but it is conceivable to store a 3D model within a QR code, or an RFID tag, possibly without a URL shortener. Each time you refresh the rendered model by pressing F5, the URL updates, so it is possible to create dated savepoints with your browser bookmarks. You can save and load JSON files if you prefer to download your files, and you can export STEP, STL, and OBJ files for your printer.

Please tell us what you think of CascadeStudio below, and if this changed your mind about text-based modeling. We’ve seen this parametric workhorse tackle everyday tasks like container boxes to high-security keys.

61 thoughts on “Hyper Links And Hyperfunctional Text CAD

  1. Wow! Just having STEP import and FilletEdges() would be a huge improvement to OpenSCAD.

    But there is an even bigger thing behind the scenes: this appears to process shapes as true curves, instead of forcing them to polygons like OpenSCAD does. Thus you can get reasonable STEP output also.

    1. That would require a whole lot rethinking of OpenSCAD. In its present form, OpenSCAD is essentially a rendering engine that operates from a text-based database that is produced in a text editor window. Exporting to graphics primitives appropriate for STEP would take considerable work, especially where you have things like hull() and minkowski(), which are much, MUCH easier to produce as polygons than as graphics primitives or B-spline surfaces.

      STEP, by the way, is a complete nightmare, so the notion of “reasonable STEP output” is a kind of fantasy/illusion/delusion. To quote the Wikipedia article, “In total STEP consists of several hundred parts and every year new parts are added or new revisions of older parts are released. This makes STEP the biggest standard within ISO. Each part has its own scope and introduction.”

      Which basically means, easy to export, hard to import.

      I’m sure that the OpenSCAD developers would be happy to have someone add STEP import. Or this could be done independently, with a script that reads an IGES file and writes a .scad file. Piece of cake, I’m sure. Luckily, OpenSCAD is both open-source and local to your machine, so it’s possible to add things like this to it, if you have or can find someone else who has the time and skills. Same goes for fillets, but that’s a much simpler problem.

  2. Biggest boon? Biggest bane for me.

    It’s weird to mention how lightweight OpenSCAD is and then follow up with a web app – the most inefficient way to do a user interface known to man.
    “more robust” and “in your browser” really don’t belong in the same sentence. The mind-numbing complexity of a modern web browser leads to the opposite of robustness.

      1. I don’t think a web search engine and a CAD package are comparable. But to be honest, I find even Google Search awful to use these days – I miss the slick functional web site it once was.

        I never had any troubles with OpenSCAD that were caused by its interface (Qt).

      2. I’ve only ever had OpenSCAD crash when running in VNC or on my 12 y/o laptop with it’s really crappy and barely supported GPU. More recent versions of OpenSCAD run fine even on that old laptop.

  3. Nice!
    too bad it is still the same weird reverse notation though. I too have sunk a lot of time in OpenScad to design a 3D printer (what else? ;) but in the end the read it bottom to top, right to left made it feel unnatural. That and the long rendering times when your model got somewhat complex.

    1. There is nothing in “reverse” about OpenSCAD’s notation. I can guess you would probably prefer Reverse Polish Notation, but to those of us who grew up with algebraic expressions, there’s nothing backward about saying “sqrt(sin(x))”. The OpenSCAD equivalent to this would be something like “sqrt() sin() x;”, whereas the RPN version might be “x; sin sqrt”. I think the former is closer to how humans describe things than the latter. Or at least, English speakers in particular.

      To me, the more difficult adjustment was getting used to using a functional language, which I had never had to do before. This means for example that if you say “overall_length = 25” anywhere in the program .. er, description, it is true everywhere, which means you can’t change the value of any variable once it’s been set. The consequence is that you can’t use a number of tricks that assembler and C users take for granted. For example, in a “for” loop, the only variable that can change is the loop iterator, which means that you can’t create intermediate variables and assign them values that depend on the loop iterator. But I’ve discovered that the way to do this is to create “modules” (i.e., functions) that you can pass the loop iterator to and take an intermediate value from. Nothing backward about it, though.

    1. What you are objecting to is a feature of functional languages, not OpenSCAD in particular. And by “feature”, I mean that this is an intentional thing that is meant to prevent problems that in procedural languages have been caused by the very fact that variables can change. OpenSCAD has a way of incrementing a variable; it’s called a “for” loop, which creates a variable on each iteration of the loop, that increments, but whose value does not change within that iteration. It takes a little getting used to, but if you ask anyone who thinks functional languages are a good thing, they will just ask you why you would want a variable to be changing all the time.

      1. Apparently I need to read up on functional programming. To me, if a variable doesn’t ever change, it’s not a “variable;” it’s a constant.

        I guess they work something like a macro constant in C for example? But I also see that you can store a return value in a variable, and maybe the functions are returning pointers to drawing shapes? In that case it’s still not going to vary, but it’s obviously doing more than a macro constant.

        I think it also has to do with different goals. Something like this, you are basically describing what the 3D shape looks like. There’s no reason for circle diameter to be 10 initially and then later 5; even if you could change it later, why wouldn’t you just make it 5 to begin with? But procedural programming normally uses variables because there are values that are not known and need to be calculated or measured, so yeah they do change all the time, and if they didn’t you wouldn’t need them.

        1. Not a functional expert.

          But the deal is that you are always creating new “variables” (that don’t change). It’s always y=x+1 and not x=x+1.

          This prevents most of the nasty stuff that happens with variables and multiple-access / threading / timing / races / whatever.

        2. Good point about variables – I don’t know about other functional languages, but in OpenSCAD, the only true variables are the loop iterators in “for” loops, which of course change values on each iteration.

          I keep trying to champion OpenSCAD, by jumping in whenever someones says “you can’t do ____ in OpenSCAD” but I am NOT a fan of functional languages, and I only defend OpenSCAD because it’s the only game in town when it comes to its main feature, which is the total parametric description of 3D models. I would MUCH rather see something else take this on, but in the procedural programming paradigm, which is why I’m interested in seeing what CascadeStudio can do.

          1. If you know tcl BRL-CAD will let you do anything OpenSCAD will (might have to write your own hull function though). I have also found it to handle larger designs. You have the ability to query objects deep into a hierarchy about its position and orientation so things like lining up holes in two parts of an assembly is possible without you keeping track of all the translations and rotations that happened to get the parts where you want them. And, it can give you a bounding box for your module. tcl is procedural, but you also have the option of just drawing something in the gui.
            I usually use OpenSCAD for objects I’m going to 3d print. Somethings can be done pretty easily in SCAD because it is so lightweight and has a pretty well defined usage model.

    1. For what it’s worth, “in the browser” here is incidental to the fact that it is still a client-side application. It can be downloaded for offline use because it uses a WebAssembly compilation of the OpenCASCADE Kernel (the same one that backs FreeCAD).

    1. I’m extremely eagerly awaiting PR #440 ;)
      That and a solution to Issue #361.
      These two things along with the long existing *selectors* are going to make it so much powerful than FreeCAD!

      Right now I’m fighting in FreeCAD with a following use case:
      1. I have a model box with apriori given dimensions.
      2. I need to place a Raspberry and some other things into the given box. There are some constraints e.g. Raspi have to be 3mm above the inner bottom of the box, the RJ45 connector needs to be next to a wall etc…
      3. I need to project some features like the RJ45 connector outline back to the box so I can make cutouts etc…

      It is hell to to that in FreeCAD. You need various 3rd party plugins and the Box in step 1. have to be a different ‘Body’ than the Box in step 3. because even though there is no dependency cycles in the features FreeCAD just doesn’t give a fck and sees a dependency cycle between the ‘Bodies’.
      And after you do that, every step is non-reusable etc…

      Even without issue #361 I *guess* I’ll be able to easily calculate transformation matrix from the placed RPi back to the Box and manually project/transform a rectangle outlying RJ45 to the box and make the hole once the PR #440 is done.

    2. Interesting. I have fond the language of OpenSCAD quite lacking. If it would have commands to specify attachment points (pins and plugs) and then to attach objects you could use these, that would be a big help. The flexibility of scripting is needed when describing components, but calculating attachment is a pain. I wish if 3d objects could work like objects in the script language, and you could access it’s properties (position, size, etc…). Currently if you want to make multiple objects use the same data, you have to define variables and create the objects based on these. Your script is quickly becoming a mess.
      Also the language is lacking on structured programing concepts.

      One way to fix this is to use an existing full blown langue like python, and this is what CadQuery is doing. But a full blown language may be too complex for most people. Something like the Arduino IDE may help. This is hiding the complexity of C++ well enough. Not sure if this really is the right way.

      1. There is the https://github.com/CadQuery/CQ-editor !

        Btw. I feel similarly about OpenSCAD. The language is sh*t:
        1. It wants to look like functional language but there are no function types. You can’t reference functions there. Highly dysfunctional!
        2. No Classes/Records.

        Though I don’t agree in one thing. IMO Arduino IDE is the worst of worst what any IDE of any type should be like. No highlighting, no goto declaration/definition, no find all usages/reference, no autoformatting, no DEBUGGEING, nada. If you use Arudino IDE for yours sake don’t. Try VSCode/VSCodium + platformIO :D . Playbutton is there + all things I mentioned Arduino IDE doesn’t have :D

      2. What structured programming concept to you believe is not covered in OpenSCAD? While OpenSCAD is definitely not object-oriented, I don’t see any lack of structured features.

        I can see how not having access to internal variables (for attachment points, for example) makes things difficult, but only if you don’t see your object as hierarchical. And there actually IS a workaround for this: when you create a module, you can also create companion functions for each attachment point. Which, yeah, is ugly, because it means you have to update these companion functions whenever you move the attachment points in the base model. But this is really no different from having to write “getter” functions in an object-oriented language.

      1. It looks like CadQuery may just be a Python binding for OpenCascade, for those that don’t like the JavaScript wrapper that CascadeStudio is. The catch is that that is all it is – it just gives you the ability to create graphical objects and manipulate them in programs. It doesn’t seem to do things for you like show the changes to the object as you make them. So you have to write the editing application if you want a standalone CAD application. Unless someone else has done that. Which, of course, they have: https://github.com/CadQuery/CQ-editor, which is a Qt-based application.

      2. And it’s not quite that simple. Open Cascade is a company with a product they call Open Cascade Technology (OCCT), which they say is open source. But on their own website they say, “Explore business needs which could be addressed by Open Cascade proprietary technologies and expertise.” Which I interpret to mean that some subset of their library is open source, but they are in the business of selling that which is not open source. On the Wikipedia page for Open Cascade Technology, it is said “In March 2011, Thomas Paviot initiated a fork of the then most recent publicly available version 6.5.0 of Open Cascade library. The initiative is called Open Cascade Community Edition. The project aims to establish a separate community-based release and bug-report process for the library.” That’s 2011, and the current version of OCCT is 7.5. “OCCT”, by the way, is residue from the original name, Open CAS.CADE Technology.

        All of which isn’t a problem on its own; it’s just a red flag. And maybe I’m just not looking hard enough, but I can’t find any source code on Open Cascade’s website. Thomas Paviot’s website, http://www.pythonocc.org/, links to some applications he has written using PythonOCC, which looks like it may be what he calls the aforementioned community fork of OCCT. Included in the applications mentioned is Pycado, which has a similar look to OpenSCAD and CascadeStudio, with a text editor on the left and a viewing window on the right.

        On the Pycado Github page, http://julienbld.github.io/pycado/, we see “Pycado is an object oriented 3D CAD scripting language based on pythonocc with a graphical interactive editor” The Pycado language, its author says, is a subset of Python. How big a subset? Don’t know. It does say that one of its dependencies is Open Cascade. For which he has a link to http://www.opencascade.org, which redirects to http://www.opencascade.com. Unfortunately, julianbld says “Pycado is on very early stage, kind of proof of concept. Some example scripts were written. They are quite simple but give a good preview of our objectives.” Even more unfortunately, I don’t see any updates past 2010.

        I can’t find any mention of Open Cascade Technology or OCCT on the pythonOCC webpage or Github page (https://github.com/tpaviot/pythonocc), but t wouldn’t be the first time a fork disowned its parent.

        But wait. Okay, now I’m seeing the connection. OCE is Thomas Pariot’s “OpenCascade Community Edition” (https://github.com/tpaviot/oce), which is a C++ library, and pythonOCC is a Python wrapper he wrote for it.

        And that’s as far down the rabbit whole as I’m going tonight. It could be that someone else has written a whole other CAD application using OCE or pythonOCC.

  4. It actually does slightly increase the odds of me ever considering text cad. Perhaps I’ll want to fully procedurally generate something.

    To me, anything but Blender and FreeCAD (the realthunder edition of course), is a special purpose tool, not a real go to way to make a model.

    But I can see myself using a really good JS CAD, especially if it’s open source and can be embedded into a sharable customizer app or something.

    I can’t speak for the people who specifically enjoy lightweight software, but to me the most interesting part of text based cad is the procedural generation aspect/customization aspect.

    1. Which is just a translation from a subset of Python into OpenSCAD language. I had considered doing this, and in fact had written a program in C to generate NACA airfoil profiles as OpenSCAD polygons. But since then I’ve gotten a lot more comfortable in OpenSCAD.

  5. I like the UI. I haven’t decided about the language yet, but having it all run in the browser means that you can use it anywhere that you have a browser.

    I like to work from my chromebook, whether from a recliner in the living room, a hammock in the back yard, or even the hot tub. I’ve been ssh’ing to my linux desktop system to edit and build then saving STL to a shared drive for display back on my chromebook. It’s a bit clunky but it works. CascadeStudio takes the linux box out of the loop. I can do all the work directly on my chromebook. What’s not to like?

    I haven’t decided about the language yet. I’m not so excited about the additional functions because those are easily added to OpenSCAD via libraries. Considering all the OpenSCAD libraries and projects, a translator or way to use them directly would be nice.

    I still need to learn about it’s language model.

    1. The language model is Javascript, and there’s a PR in the pipeline that will promote it to full-on TypeScript and add the ability for users to import their own standard libraries (so if they don’t like the way I’ve put it together, they can change it themselves): https://github.com/zalo/CascadeStudio/pull/15

      CascadeStudio should also be installable to your Chrome Book for offline usage too.

  6. At least on the live demo I don’t see any way to save just the code. Instead it has this json foratted output.

    The problem with that is there’s no good way to put your work into version control. I suppose you could just keep saving the json over top some local copy and checking that in but actually going back and reading your changes would be so messy.

    I do like the idea of a web based tool, so long as I control it myself, not a cloud tool where someone else can keep my work hostage. I’ve been thinking about building something using jscad and my own backend, probably PHP based to store the files and somehow integrate git to track changes. I’m open to other ideas besides jscad and will probably explore Cascade Studio some more.

    I also liked the idea of jscad because I often wish OpenSCAD was a bit more of a “real” programming language. I’d like variables that are mutable. I guess maybe special variables are but they also have wider scope. I’d also like to be able to define classes and objects.

    Solidpython would be better as I prefer class to be it’s own keyword instead of the mess of functions within functions that javascript uses but I’m not sure that solves the problem of running remotely in a browser.

    Well, anyway. now that it’s fall in the northern hemisphere it’s cool enough to work outside but the clock is ticking before it gets too cold. I have outside work to do, fences to mend, trees to trim a car to fix, etc… This is one more thing to look at in a couple of months.

  7. Software engineers are idiots…..I renounce my field. I’m sick of the everything in the browser stupidity. I refuse web programming jobs because usually they are BS like this trying to do things browsers shouldn’t, or they assume *HYPER TEXT TRANSFER PROTOCOL* is the *ONLY* protocol.

    Don’t like cloud based solutions making you pay monthly? Stop writing their software, stop spreading their ideas. Before you know it, all software will be monthly subscriptions in the browser, and that is not ok.

    1. For what it’s worth, CascadeStudio is MIT Licensed and runs entirely client-side, so you can install it locally for offline user, and forget that it ever ran in a web browser. It was originally only made to run in a browser to make it easier to share models via zip-encoded URLs.

  8. Fun little toy. Finally got to see a shape I’ve been curious about for a while (the intersection of three cylinders is not a sphere, more of a puffy box like you’d make out of origami).

    1. It’s called a Steinmetz solid. There are some others but it’s the most fun. They’re interesting to make and play with. When you roll one in a direction it goes all bumpy for a second and then takes off smoothly rolling in a different direction. They’re easy to 3d print but are quite a challenge to make on a lathe.
      Both Archimedes and Zu Chongzhi successfully calculated the volume of this shape quite a while back, so they probably should have someone else’s name attached to them, but that’s Stigler’s Law for you.

      1. Good to know. I wonder if you could make a d24 out of it, with whichever “half” of one of the 12 curved edge-sides is facing up when it stops is the roll result…

        I also tried making a more spherical version, taking the intersection of the base solid and (3 different copies, each rotated 45 degrees in a different axis)… it… really didn’t like that. Had some “null face” errors.

  9. There is one obstacle for “Yet another CAD” adoption.
    OpenSCAD is de-facto standard. There are OpenSCAD import add-ons CAM toolchain downstream, like CAM part of FreeCAD and 3D printer slicers. I do not use STL or STEP when I mill, laser cut or 3D print – I design in OpenSCAD, then load OpenSCad file to CAM and convert it straight to GCode path.
    I would switch to an alternative CAD only if it is much, much better AND provide all the same kind of plugins to the downstream toolchain.

  10. 1. Just a shout out for Implicitcad. This was a (potentially) fantastic progression of OpenScad. Using a fast custom engine in Haskell instead of that (slow and clunky) OpenCSG and CGAL stuff. A really good thing was filleting and rounding were built in. The trouble was only a subset of functions of openscad were implemented before the project seem to die.

    I actually like the language of OpenScad, and the more so the more I use it. However it does have some serious limitations including weird bracketting behaviour and the inability to pass around modules themselves as module parameters. Some introspection would be nice. I think implicitcad could be developed to offer this because it would not be as limited by foreign libraries.

    Someone called Julia Longtin seemed to take it up, which is great , but it needs more support. I check in every so often but I have not done so for a while.

    Impliciticad while limited in functionality was fast, small and clean.

  11. Brian, I think you may be mis-stating the controversy. The question isn’t about text-based vs. graphical object based descriptions of objects. It’s about having my models on my computer vs. having dubious access to them over a network. Seems to me like a LOT of commenters on HaD prefer not to give away control over their work.

  12. Maybe the value in this is not so much in the implementation we are presented with, but in the definition of the language in which models are written. Looking at the live page, I can see that this is probably a procedural rather than functional language, which won’t have people gagging on immutable variables like they do in OpenSCAD. I’ve seen a number of comments over the years, that people would rather write their own Python “version” of OpenSCAD than go through the learning curve for a functional language. But of course, such a thing would not be compatible with models developed in OpenSCAD.

    For those of us who really don’t want a cloud-resident, browser-based application, the easy way out would be an independent port of it to Python or C++ or Java, that people could KEEP a copy of and run on their own machines. It would be relatively easy to develop a compatible standalone application, if Cascade Studio were to become a popular platform.

    It’s a little weird, that there is an option to save the project as a .json file, but not as a text file. The .json file DOES contain the whole text of the file, including comments, though, so it’s something that can be worked with.

  13. Thanks for the OpenCASCADE hint. A rabbit hole in itself :-)

    As for WebAssembly. I still remain sceptical of anything so near to web technologies.

    It is obvious that the big actors will invest as much as they have (and they do have, currently) into establishing their dominance, by whatever means it takes.

    It’s all of Microsoft of the 90ies all over again, but on steroids. Watch how Google, after having practically conquered the “server side”, are on top of mobile and have displaced all browsers except the last one.

    This ain’t looking good.

  14. Very nice UX. I do all my 3d in openScad and cool to see that you Cascade has taken live parameter tweaking function to the party and nice inspiration on how other domains can be addressed in the browser :-)

    In the browser is more about accessibility then performance – I do STEM stuff (http://codingpirates.dk/in-english/) and what microbits.org is disruptive. I can onboard 6-8 year old kit into programming in 60 sec on a computer with internet access.

    Respect

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.