oozby 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/oozby/environment.rb +2 -1
  3. data/readme.md +23 -20
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f815ac48e5c34d5320cf8c68e405e50ae5628c1
4
- data.tar.gz: bd65a310084b29367e72156a0115be35fcbec393
3
+ metadata.gz: 72a9ef479750895c4718a2fc8d0f68ca54f9741e
4
+ data.tar.gz: 61345c4bbfd49980801843157756baef7ce98cba
5
5
  SHA512:
6
- metadata.gz: 2e8e9c157aa4311fd3eed8e78696c6b3bd8c2a31925feadfc2c3614705610079aa7ca5a88086da4355a789673a2cc193807efa542d6ce4a95ddb34eae1fbda29
7
- data.tar.gz: 9fe7a2662cb73940d13abd4c8ef311aa52a700eb2b148d4604ce453e769c06615a83d387adbaa355c26c7c13659335ea8201fb722b48445c9e668e37c6118950
6
+ metadata.gz: 61786bf4d356df899a4b091501d6e8477d4ac8ea8d449888b0efde86a018558d793d24c1049e94e63947b47cf0bb453ba804c9198db18d74874c131b519f1019
7
+ data.tar.gz: 3f9f1a23a1e03c1287eecca227ac4fe9b1c1a0c0ff367ffadcc929087961029027cc41994ea22401e1796f16cdd6862f4603088029a25f9e3e11bd9fe3f5e2c3
@@ -54,7 +54,8 @@ class Oozby::Environment
54
54
  method: method_name,
55
55
  args: args, named_args: hash,
56
56
  children: children,
57
- modifier: @one_time_modifier || @modifier
57
+ modifier: @one_time_modifier || @modifier,
58
+ call_address: @ast.length
58
59
  }
59
60
 
60
61
  @ast.push call
data/readme.md CHANGED
@@ -1,28 +1,31 @@
1
- Oozby (Oozebane + Ruby) is inspired by the realisation that OpenSCAD does not truly support variables, and so it is more like a markup language than a programming language. Oozby aims to give users a similar interface to OpenSCAD, but with the more sensible and clear syntax of Ruby, and with a bunch of extra features patched in. Check out the examples folder to see some great demos of the features Oozby offers.
1
+ Oozby (Oozebane + Ruby) is inspired by the realisation that OpenSCAD does not support real variables, and so it is more like a markup language than a programming language. Oozby uses all the same familiar functions as OpenSCAD, but with the clear and sensible grammar of the Ruby programming language. Oozby also patches in lots of useful features. Check out the `examples` folder to see some great demos of some of Oozby's abilities.
2
2
 
3
3
  Here are some highlights:
4
4
 
5
- * For built in functions which take an '`r`' parameter like `sphere`, `circle`, `cylinder`, you can specify any of these instead:
6
- * + `r`, `radius`
7
- * + `r1`, `radius\_1`, `radius1`
8
- * + `r2`, `radius\_2`, `radius2`
9
- * + `d`, `dia`, `diameter`: _anything specified as diameter will be automatically halved, taking a lot of `/ 2.0` statements out of your code__
10
- * + and of course `d1`, `dia1`, `dia\_1`, `diameter1`, `diameter\_1`, `d2`, `dia2`, `dia\_2`, `diameter2`, `diameter\_2`
11
- * Built in functions which take 'h' like `cylinder`, `linear\_extrude` can take `height` instead if you like
12
- * Cubes and Squares have 'radius' option, which if > 0.0 causes the corners to be rounded very nicely.
13
- * Full support for variables, can use all of ruby's core and standard libraries, use rubygems to pull in data - read images, access web services, read databases, automatically download things from thingiverse, whatever
14
- * For cylinders you can specify a Range for the radius option instead of specifying r1 and r2 separately if you like
15
- * All the round things have a 'facets' option which translates to $fn
16
- * No semicolons (of course!) - specify one function as the parent of the next by using a block or use the > operator (see examples)
17
- * Lambda, classes, methods, oh my!
18
- * Built in functions like translate, rotate, scale, which take a 2d or 3d vector [x,y,z] can instead have options passed like this:
19
- * + `translate(x: 5, y: 6)` - unspecified items default to 0
20
- * + `scale(y: 2)` - unspecified items default to 1
21
- * Specify defaults: You can create a context within a block where everything defaults to `center: true`! How many times have you had to write `center = true` again and again when constructing something with lots of symmetry in OpenSCAD?
22
- * Establish a scope within a block with specific resolution
5
+ * For built in functions which take an `r` parameter like `sphere`, `circle`, `cylinder`, you can specify any of these instead:
6
+ * * `r`, `radius`
7
+ * * `r1`, `radius_1`, `radius1`
8
+ * * `r2`, `radius_2`, `radius2`
9
+ * * `d`, `dia`, `diameter`: _anything specified as diameter will be automatically halved, taking a lot of `/ 2.0` statements out of your code_
10
+ * * and of course `d1`, `dia1`, `dia_1`, `diameter1`, `diameter_1`, `d2`, `dia2`, `dia_2`, `diameter2`, `diameter_2`
11
+ * For cylinders you can specify a Range for the radius option instead of specifying r1 and r2 to make tapering shapes
12
+ * Built in functions which take 'h' like `cylinder` and `linear_extrude` can take `height` instead if you like
13
+ * Cubes and Squares have a `radius` option, which if `> 0.0` causes the corners to be rounded very cleanly.
14
+ * All the round things have a 'facets' option which translates to $fn
15
+ * No semicolons (of course!) - specify one function as the parent of the next by using a block or use the > operator (see examples)
16
+ * Lambda, classes, methods, oh my!
17
+ * Built in functions like translate, rotate, scale, which take a 2d or 3d vector [x,y,z] can instead have options passed like this:
18
+ * * `translate(x: 5, y: 6)` - unspecified items default to 0
19
+ * * `scale(y: 2)` - unspecified items default to 1 for scale. Smart!
20
+ * Specify defaults: You can create a context within a block where everything defaults to `center: true`! How many times have you had to write `center = true` again and again when constructing something with lots of symmetry in OpenSCAD?
21
+ * Establish a scope within a block with specific resolution settings
22
+ * Totally legit scope.
23
+ * Actual variables.
24
+ * All the kinds of looping, enumeration and hard core maths Ruby is capable of. It's just ruby code after all! Need a complex number? the core Complex class has you covered! Want a mathematical Matrix? The Matrix class included in the standard ruby library is here to help! Need to work with insanely big numbers? bigdecimal to the rescue!
25
+ * Everything in RubyGems: Parse an MP3 and print out a phonograph record! Digest an XML feed of geological data and extrude 3d shapes from it with nokogiri! Query sensor data from webcams, arduinos, microphones, buttons, joysticks, and generic usb devices! Directly read image formats with gems like ChunkyPNG and rmagick! Create automated production workflows, importing data from online store orders directly in to your printing pipeline!
23
26
 
24
27
  This tool is considered very experimental at the moment and could break in horrible ways. There is a good chance the API will change and break stuff until the gem hits 1.0, but hey, get on board and lets figure out how to make OpenSCAD less horrible. Maybe if we come up with really great ideas in Oozby that will give the OpenSCAD devs a clear direction forward for new syntaxes and features in the future - kind of the same idea as rubinius and pypy! A place to quickly prototype kooky ideas.
25
28
 
26
29
  Oozby is not a language translator and doesn't try to be. It is a markup builder like Markaby or XML Builder, so you should expect it's output to sometimes be not very readable and unnecessarily verbose. Your variables and maths are all rendered by Oozby, and as a result Oozby cannot and probably never will be able to generate dynamic modules which can be used from OpenSCAD files. Of course, you can use Oozby libraries from inside other Oozby scripts! And it probably wouldn't be too difficult to implement the OpenSCAD language in Oozby itself, so it could automatically convert OpenSCAD in to Oozby and in that way allow OpenSCAD files to call on Oozby libraries.
27
30
 
28
- Another note: Oozby uses regular ruby maths, and that means if you're not working entirely in whole millimetres you may encounter a little bit of floating point rounding. You should try to make surfaces intersect, not just come up against each other's edges exactly. Anything that wouldn't look right rendered by the quick opengl preview mode of OpenSCAD might not work properly with full CGAL renders. Also note that in ruby `5 / 2 = 2`. If you want `2.5`, make one of the operands a Float, so `5 / 2.0 = 2.5` or `5.0 / 2 = 2.5` or `5.0 / 2.0 = 2.5`. We could use refinements perhaps to patch the oozby environment so `5 / 2 = 2.5` but that would be weird for existing Ruby users. Not sure what to do here.
31
+ Another note: Oozby uses regular ruby maths, and that means if you're not working entirely in whole millimetres you may encounter a little bit of floating point rounding. You should try to make surfaces intersect, not just come up against each other's edges exactly. Anything that wouldn't look right rendered by the quick opengl preview mode of OpenSCAD might not work properly with full CGAL renders. Also note that in ruby `5 / 2 = 2`. If you want `2.5`, make one of the operands a Float, so `5 / 2.0 = 2.5` or `5.0 / 2 = 2.5` or `5.0 / 2.0 = 2.5`. We could use refinements to patch the oozby environment so `5 / 2 = 2.5` but that would be weird for existing Ruby users. Not sure what to do here.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oozby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bluebie