gleamscad

Types

pub type CenteredOrNot {
  Centered
  NotCentered
}

Constructors

  • Centered
  • NotCentered

builder pattern for our OpenSCAD expressions:

pub opaque type OpenSCADExpr
pub type RadiusOrDiameter {
  Radius
  Diameter
}

Constructors

  • Radius
  • Diameter
pub type Settings {
  MinimumAngle(value: Float)
  MinimumSize(value: Float)
  NumberOfSegments(value: Int)
  AnimationStep(value: Float)
}

Constructors

  • MinimumAngle(value: Float)
  • MinimumSize(value: Float)
  • NumberOfSegments(value: Int)
  • AnimationStep(value: Float)

Values

pub fn circle(
  value: Float,
  rod: RadiusOrDiameter,
) -> OpenSCADExpr

Draws a 2d circle

pub fn cube(size: Float, center: CenteredOrNot) -> OpenSCADExpr

Creates a 3d cube with all sides of equal length

pub fn cube3(
  width: Float,
  depth: Float,
  height: Float,
  center: CenteredOrNot,
) -> OpenSCADExpr

Creates a 3d cube

pub fn custom_code(code: String) -> OpenSCADExpr

Allows for adding custom code

pub fn cylinder(
  height: Float,
  value: Float,
  rod: RadiusOrDiameter,
  center: CenteredOrNot,
) -> OpenSCADExpr

Creates a 3d cylinder

pub fn cylinder2(
  height: Float,
  value1: Float,
  value2: Float,
  rod: RadiusOrDiameter,
  center: CenteredOrNot,
) -> OpenSCADExpr

Creates a 3d cylinder. Enables you to pass different diameters/radii for top and bottom

pub fn difference(
  expressions: List(OpenSCADExpr),
) -> OpenSCADExpr

Create a difference of shapes

pub fn hull(expressions: List(OpenSCADExpr)) -> OpenSCADExpr

Displays the convex hull of child nodes

pub fn intersection(
  expressions: List(OpenSCADExpr),
) -> OpenSCADExpr

Creates an intersection of shapes

pub fn linear_extrude(
  expressions: List(OpenSCADExpr),
  height: Float,
  center: CenteredOrNot,
  convexity: Float,
  twist: Float,
  slices: Float,
) -> OpenSCADExpr

Turns a 2D shape into a 3D shape

pub fn minkowski(expressions: List(OpenSCADExpr)) -> OpenSCADExpr

Displays the minkowski sum of child nodes

pub fn mirror(
  expressions: List(OpenSCADExpr),
  x: Float,
  y: Float,
  z: Float,
) -> OpenSCADExpr

Mirrors a shape

pub fn options(values: List(Settings)) -> OpenSCADExpr

Setting one or several OpenSCAD special variables

pub fn polygon(polygons: List(#(Float, Float))) -> OpenSCADExpr

Draws a 2d polygon

pub fn rotate(
  expressions: List(OpenSCADExpr),
  x: Float,
  y: Float,
  z: Float,
) -> OpenSCADExpr

Rotate a shape

pub fn rotate_single(
  expression: OpenSCADExpr,
  x: Float,
  y: Float,
  z: Float,
) -> OpenSCADExpr
pub fn scale(
  expressions: List(OpenSCADExpr),
  x: Float,
  y: Float,
  z: Float,
) -> OpenSCADExpr

Scales a shape

pub fn scale_single(
  expression: OpenSCADExpr,
  x: Float,
  y: Float,
  z: Float,
) -> OpenSCADExpr
pub fn sphere(
  value: Float,
  rod: RadiusOrDiameter,
) -> OpenSCADExpr

Creates a 3d sphere

pub fn square(
  width: Float,
  height: Float,
  center: CenteredOrNot,
) -> OpenSCADExpr

Draws a 2d square

pub fn to_openscad(expr: OpenSCADExpr) -> String

Exports the data to a string, containing OpenSCAD code

pub fn translate(
  expressions: List(OpenSCADExpr),
  x: Float,
  y: Float,
  z: Float,
) -> OpenSCADExpr

Translate (move) a shape

pub fn translate_single(
  expression: OpenSCADExpr,
  x: Float,
  y: Float,
  z: Float,
) -> OpenSCADExpr
pub fn union(expressions: List(OpenSCADExpr)) -> OpenSCADExpr

Create a union of shapes

Search Document