1.) I'm an avid 3D printing hobbyist. I own two 3D printers and get a huge kick out of designing and printing new things.
3.) I'm a gamer and enjoy game development. 3D modelling skills are also useful for 3D game development.
What is OSCADSharp?
OSCADSharp is a C# library that generates OpenSCAD code. OpenSCAD is a scripting language that generates 3D models in a somewhat procedural (yet functional) way, with methods that correlate to 3D and 2D operations.
OpenSCAD is very powerful, and you can achieve great results with it. Yet as a language that has no Object-Oriented constructs, nor a mainstream IDE behind it, productivity can falter. I often find myself fighting with formatting, redundant code, and overly-verbose scripts without the means at my disposal to be efficient in rectifying the situation.
So in the spirit of TypeScript, I seek to change that for myself (and hopefully others), by introducing a means of using C# to write OpenSCAD code.
OSCADSharp isn't just about being able to use Visual Studio. There are many things that could be improved upon to make people more effective in writing complex OpenSCAD scripts.
1.) Frictionless code reuse through Object-Orientation and script generation
In OSCADSharp we can use classes, inheritance, and class composition to more effectively write complex scripts. There will also be convenience functions on all OSCADSharp objects like .Clone() to facilitate repetitive use of subtle variations on the same object.
2.) Greater expressiveness
In OpenSCAD you often need to make a choice: Do I sacrifice coding conventions for terseness (no curly braces, lots of lines of chained simple code), or do I attempt to adhere to indentation and curly brace parity, and cost of fighting formatting six levels of indentation deep on complex objects.
In OSCADSharp you won't need to make that choice, because the API is designed for chaining of 3D operations. Every 3D object is an OSCADObject, upon which 3D operations can be performed.. A statement that may have been three or four levels of braces deep, can now be expressed in just one function-chained line.
var text = new Text3D("Hello, World").Translate(-30, 0, 0).Rotate(90, 0, 0).Scale(1, 2, 1);
3.) Shorthands for common constructs
The goal of OSCADSharp is to make you more effective and reduce the pain of redundant code. Subsequently I will be including many things that may frequently in your OpenSCAD code, to alleviate the need to maintain or import libraries for them.
- Helpers/Constants for imperial units (inches and fractional inches)
- Classes for commonly used components, such as tubes, boxes, lids, gears, screws, etc.
- Vector and value manipulation.
4.) Simplification of the API
OpenSCAD has been around for a while, and is a powerful and complete language in and of itself. The goal of OSCADSharp is not to supplant OpenSCAD, but rather to complement it by introducing a powerful, efficient way to create OpenSCAD code using an alternative API. Significant portions of the OpenSCAD API won't be supported in OSCADSharp, because doing so would increase the complexity of OSCADSharp without enriching the API that the most common users would use.
OSCADSharp is very much in its infancy right now, but I think it has a lot of potential. More updates will follow, and the complete version is not yet available as a standalone DLL, but feel free to check it out at: