scad-rs icon indicating copy to clipboard operation
scad-rs copied to clipboard

Let users define their own modules

Open Michael-F-Bryan opened this issue 3 years ago • 0 comments

The goal is for people to write something like example 2 under Object Modules:

module house(roof="flat",paint=[1,0,0]) {
  color(paint)
  if(roof=="flat") { 
    translate([0,-1,0]) cube(); 
  } else if(roof=="pitched") {
    rotate([90,0,0]) linear_extrude(height=1)
    polygon(points=[[0,0],[0,1],[0.5,1.5],[1,1],[1,0]]); 
  } else if(roof=="domical") {
    translate([0,-1,0]) {
      translate([0.5,0.5,1]) sphere(r=0.5,$fn=20); cube(); 
    }
  } 
}

Michael-F-Bryan avatar Aug 11 '22 20:08 Michael-F-Bryan