Skip to content

BASIC / CSG-CUBE

CsgCube

A box, sphere and three crossing bores

Built in SolidCraft 0.49.0 6 commands

Model preview

CsgCube SolidCraft build

A constructive solid geometry demonstration: intersect a cube with a sphere, then subtract cylinders along three axes.

Key dimensions: 50 mm cube; three crossing cylindrical cuts

Open in SolidCraft Web

The editable .sc model is loaded directly from the accepted build branch.

SCPF source

The exact SCPF Python source declared by this build variant.

scpf/model.py
class CsgCube:
    size = 50

    def build(self):
        body = Sphere(self.size / 1.5) & Box(self.size, self.size, self.size)
        diameter = self.size / 1.5

        hole_x = Cylinder(d=diameter, h=self.size, axis=Axis.X).at(body)
        hole_y = Cylinder(d=diameter, h=self.size, axis=Axis.Y).at(body)
        hole_z = Cylinder(d=diameter, h=self.size, axis=Axis.Z).at(body)

        return body - (hole_x + hole_y + hole_z)
SolidCraft command sequence 6 generated operations · expand to inspect
  1. parameters.add
    {
       "expression": "50",
       "name": "size",
       "unit": "mm"
    }
    
  2. solid.sphere
    {
       "body_name": "CsgCube",
       "center": [
          0,
          0,
          0
       ],
       "operation": "new",
       "radius": "size / 1.5"
    }
    
  3. solid.box
    {
       "center": [
          0,
          0,
          0
       ],
       "height": "size",
       "length": "size",
       "operation": "intersect",
       "targets": [
          "CsgCube"
       ],
       "width": "size"
    }
    
  4. solid.cylinder
    {
       "axis": "X",
       "base": [
          "-(size / 2)",
          0,
          0
       ],
       "diameter": "size / 1.5",
       "height": "size",
       "operation": "cut",
       "targets": [
          "CsgCube"
       ]
    }
    
  5. solid.cylinder
    {
       "axis": "Y",
       "base": [
          0,
          "-(size / 2)",
          0
       ],
       "diameter": "size / 1.5",
       "height": "size",
       "operation": "cut",
       "targets": [
          "CsgCube"
       ]
    }
    
  6. solid.cylinder
    {
       "axis": "Z",
       "base": [
          0,
          0,
          "-(size / 2)"
       ],
       "diameter": "size / 1.5",
       "height": "size",
       "operation": "cut",
       "targets": [
          "CsgCube"
       ]
    }
    

Build information

Build scope
main
Build variant
csg-cube
Physical owner
csg-cube
Built source
1f2fdb32d67d9af42779500c949f2900ee59c7ae
Forge
v0.23.0 ·
SolidCraft
0.49.0
Runtime
ghcr.io/brainboxemb/cad-solidcraft:v0.3.6