Breps to SAT code sample?

We have written a couple of c# plugins to run in Rhino.Compute which are working nicely:

  • brepsToOBJ
  • brepsToSAT

Our calling code (Azure app, c#) sends Rhino.Compute some rhino.breps and it translates them to OBJ or SAT and returns the result. All good.

What we want to change:
However, we are using Rhino.Compute for a bunch of stuff and it is under a lot of load.
To relieve the load on Compute we want to do these two activities directly in our client side (Azure app) to avoid the latency of the http calls to Compute and to free Compute up to respond to other stuff that’s going on.
We succeeded with replacing the first plugin with native client-side code using the Rhino3dm library and curtesy of this github sample for converting breps to OBJ which was precisely what we needed. Big thanks to @fraguada for sharing this code. This made a huge performance improvement compared with using Rhino.Compute to do the work.
Being very encouraged by this we would like to do similar but for SAT format.

Help/Advice pls?:
But we haven’t found a similar code sample for translating breps to SAT.
Does anyone know of such a sample anywhere?
Does anyone know whether translating to SAT is as straightforward an undertaking as it is for OBJ ??
Please bear in mind we are looking for code samples that don’t require Rhino installed on the machine. I.e. Using the Rhino3dm library and similar to @fraguada’s method for OBJ.
Any advice experience on this would be wonderful.

“Does anyone know whether translating to SAT is as straightforward an undertaking as it is for OBJ ??”

A skim read of this pdf helped me understand the composition of a SAT file:

It seems that the SAT file schema is oriented around Classes such as Bodies, Cones, Ellipses etc and therefore a fair bit more complicated than the OBJ schema which seems to be just a description of mesh vertices, edges and faces.

That said, someone at McNeel must have already done the grunt work though since Rhino does have an export method to SAT – i guess it comes down to whether that code is published anywhere or can be easily replicated in c# using just the standalone Rhino3dm library?

Hey @MonkeyFace,

I’ve moved this conversation to the compute category so others who work in this area can see this.

Writing SAT files is much more complicated than writing OBJ files. Our SAT export plug-in is written in C++. So the best we can probably do is make it easier for Rhino.Compute to generate SAT files. I doubt you’ll see SAT support added to Rhino3dm.

@fraguada, @tim - feel free to correct me.

– Dale


I believe the obj sample that @MonkeyFace refers to was probably written by you @dale. But yes, as Dale mentions, SAT is much more complex. You could

  • find some 3rd party library that does it, which would allow you to do it outside of Rhino / Rhino.Compute.
  • write your own library to do the above
  • use Rhino.Compute