https://github.com/merklegroot/PrimSharp
A C# library for Constructive Solid Geometry
Objects are rendered to OpenSCAD code.
You can paste the rendered code into OpenSCAD and use it to generate an STL file.
You can get OpenSCAD from here:
https://openscad.org/
Dimensions use Width, Breadth, and Height. I went with "Breadth" instead of "Length" to avoid conflicts with the word "Length."
Running this:
newCube().RotateZ(45).ToOpenScad();Gives you this:
rotate([0, 0, 45])
cube([1, 1, 1], center=true);Note that the geometry isn't translated to OpenScad until the ToOpenScad() method is called.
I usually just use unit tests to retrieve outputs for a model.
This probably isn't the best use of tests, but it works.
usingPrimSharp;usingXunit;usingXunit.Abstractions;namespacePrimSharpTests{publicclassBoxTests{privatereadonlyITestOutputHelper_outputHelper;publicBoxTests(ITestOutputHelperoutputHelper)=>_outputHelper=outputHelper;[Fact]publicvoidBox_with_defaults()=>_outputHelper.WriteLine(newBox().ToOpenScad());}}Cube - a rectangular solid
newCube(width:3,breadth:5,height:2);Cylinder - you know what a cylinder is.
newCylinder(radius:2,height:5);newBox(4,4,1).Subtract(newBox(2,2,1));PrimSharp - Primitives
PrimDesign - Models created from primitives
