Sha256: 817cde604e1feb89fcd5b213590ec983ccd158ad4933297296d06ce72b790113

Contents?: true

Size: 635 Bytes

Versions: 2

Compression:

Stored size: 635 Bytes

Contents

#example
require_relative '../lib/yasp'

Yasp.file('scad.scad') do

  # you can load Commands into variables!
  sphere = assign do
    sphere(3)
  end

  # and functions!
  def square_at(position)
    translate(position) do
      cube(6, center = true)
    end
  end

  # and use them wherever you'd like!
  5.times do |y|
    translate([y*10, 0,0]) do
      rotate([-y * 15, 0, 0]) do
        cylinder(r: 3, h: 10, '$fn': 10 * y)
        # anything that returns Commands must directly use the
        # add() function, since method_missing can't catch them.
        add(sphere);
        square_at([0,0,y])
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yasp-2.0.2 examples/example.rb
yasp-2.0.0 examples/example.rb