Modifying OpenFlexure: Where to start?

Hello everyone,

I am an electron microscopist, and I discovered OpenFlexure project some months ago. I was amazed! I quickly bought the necessary components, and built my first microscope. It was totally beyond my expectations, I am very happy with it!

Now I want to do more by modifying it. My hope is to do ptychography with it, but I need to modify a couple of things before I get there. However, when I wanted to modify the parts, I ran into some challenges. The designs are not really accessible for modifications, at least at my knowledge level.

Shortly, my questions is: If someone wants to modify the parts (beyond changing the length of the lens tube through SCAD), how should they approach this? For example, does anyone have access to the solid versions of the STL parts?

==

And if you have time, here is a practical example of what I’m going through:

I wanted to modify the condenser. And the original part itself is beautifully designed. But when I want to add something to it, I can only use mesh-level operations, because the original file is an STL.

I tried converting it to a solid in Fusion360, and unsurprisingly it didn’t work, as these work only for very basic shapes.

And if I want to draw it myself from scratch, while maintaining compatibility with the rest of the microscope, the amount of complexity is too much. For example, I have no idea how to approach drawing these details:

I use CADs such as Fusion360, and I am somewhat a beginner/intermediate user.

Does anyone have any suggestions to help me start modifying some parts, beyond parametric modifications through SCAD?

Kind regards,

Berk

Hi @FrustratedElectron. Thank you for looking into the project. I would love to see ptychography implemented.

As you have already discovered, the source design is in OpenSCAD, and the solid parts are STLs. OpenSCAD uses a constructive solid geometry approach to CAD, which is fundamentally different from programs such as Fusion or FreeCAD, which use constraints based geometry. It is not possible to make direct conversions between these different approaches.

There is some explanation of the reasons for using OpenSCAD in the first place, and the consequences of that, in Alternative file options other than STL for block/delta stages? - #2 by WilliamW .

If you are wanting to make significant modifications to the main body, you would be best working in OpenSCAD. If you are wanting to modify accessories, or things that mount onto the optics fitting or the illumination dovetail, then these relatively simple parts do not take too long to recreate, or you could try the methods in Towards STEP components . This should work for most of the mounted parts. You might only need the part that mates to the OpenFlexure mount, from there you can add what you need.

Hello @WilliamW ,

Thank you sincerely for the reply, and the links. These are super useful.

Honestly, I was a bit reluctant to learn OpenSCAD because I read it’s rarely used in the industry. However, after reading some other discussions about it in a more positive light, I decided to give it a go. I’ll let you know of the results.

Kind regards,

Berk

OpenSCAD is not very widely used, and it has some odd quirks. I would put it as ‘OK when you get used to it’.

The main reason to use it is the ease of version control with multiple developers and tracking development, because it uses text based programing.

Throwing my hat into the ring (many month too late :slight_smile: ) :

Honestly I think OpenSCAD is totally worth learning. I started fiddling around with in in ~2014 or so and i cursed the hell out of it, because the learning curve is very steep in the beginning (comparable to learning linux on the commandline for the first time). However, think of physicists or biologists or chemists: Many of them can do programming to a certain extend (e.G. in a simpler language like python). Not because they want to be programmers, but because the ability to create software from scratch is a tool to them. The same applies to OpenSCAD. While the standard CAD-Approach has numerous benefits, especially in terms of Speed or for “just quicky designing a simple part”, classic CAD only very rarely is used in a truely parametric fashion. Sure, some variables here and there, but most models (in my opinion) do break very easily. In OpenSCAD in contrast, i basically use absolutely no numeric values at all. In my design-style they are all(!) derived from variables. this seems very slow and inefficient (and it often is), but the flexibility for changing things later, and the level of how “unbreakable” the parts can become is absolutely unmatched compared to classic CAD-modelers.

There are also things that are easy in OpenSCAD, that are hard-to-impossible otherwise. Think like a programmer: you can use (nested) loops, functions, inline-includes from other files, use other files as libs, do fancy arithmetics, and so on. You can also import 3d (STL) and 2d(SVG/DXF)-geometry and continue working from there (You can directly use them as geometry, which is much more complex in classic cad-software). It is basically a programming language, and that comes with some awesome benefits. You can manage your models as code in git, you can build your whole stack of parts from a CI/CD-Pipeline, do proper versioning, branching and so on. You can automatically render images and animations from the code for documentation, and so on. You can apply and enforce coding-standard, do automatic testing-routines and many, many more. Many of these things are used in the OFM-Project.

For the same reasons, other things, that are simple standard-operations in CAD-Modelers, are incredibly hard to pull off in OpenSCAD, like shell-/pipe-/hollowing-Operations and especially chamfers and fillets. While possible, they cannot be used in the same way as with other CAD-Software.

If you are somewhat comfortable with reading and writing code (you don’t need to be a programmer), you should give it a try. As long you can “think in basic, geometric primitives and how to combine or subtract them from each other to get to a finished part”, OpenSCAD can be quite a powerful tool (just use a recent version, which can do multithreading, not the stable from 2021).

I learned it this way:

Constrain yourself to a very basic set of Operations, like “cube(),sphere(),cylinder(),difference(),translate()” and try to build one or two basic models with that. after some cursing and swearing it will work. For the next model, extend the things you already know, e.G. with “rotate()” and “scale()”, and when you’re comfortable using those, add loops, functions and finally value-arrays. The OpenSCAD-Documentation is very good, and some super-complex geometry can sometimes generated in just a few lines of code cleverly combined (just look at the fan-model on the openscad-startpage. it is just that few lines of code). I think this is the easiest way to learn OpenSCAD. When you’re already a programmer, use functions from the beginning.