... | ... | @@ -2,7 +2,41 @@ This is the official IceSL scripting language documentation wiki. Examples featu |
|
|
|
|
|
We welcome IceSL users to redirect their questions about the scripting language to the [IceSL forum page](https://groups.google.com/forum/?fromgroups#!forum/icesl).
|
|
|
|
|
|
Legend:
|
|
|
# Syntax
|
|
|
The scripting language of IceSL (hereafter referred to as IceSL) is a superset of [http://www.lua.org/pil/contents.html Lua]. Moreover, IceSL has been designed to facilitate conversion from/to [OpenSCAD](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual).
|
|
|
|
|
|
* <sub>IceSL</sub>: Supported by [IceSL](https://icesl.loria.fr/download/)
|
|
|
* <sub>IceSL-online</sub>: Supported by [IceSL Online](http://shapeforge.loria.fr/icesl-online/ IceSL-Online) |
|
|
\ No newline at end of file |
|
|
IceSL also extends Lua's types in order to specify shapes and transforms. The main basic types are:
|
|
|
|
|
|
1. Vector (e.g. `v(1,0,0)`)
|
|
|
2. Matrix (e.g. `m(1,0,0,1, 0,1,0,1, 0,0,1,1, 0,0,0,1)`)
|
|
|
3. Shapes:
|
|
|
1. Primitives (e.g. `sphere(1)`),
|
|
|
2. Meshes (e.g. `load('fox.stl')`),
|
|
|
3. Implicits,
|
|
|
4. Voxels.
|
|
|
|
|
|
# Drawing and Scale
|
|
|
|
|
|
Creating a shape in IceSL does not automatically render it in the final scene. In order to do this, you need to emit it.
|
|
|
|
|
|
`emit( shape, brush )`
|
|
|
|
|
|
* `shape`: the shape to render
|
|
|
* `brush`: the brush's index to render the shape with. 0 by default
|
|
|
|
|
|
Brushes are an internalized concept of IceSL, there are a total of 128 indexes starting from 0. Their use is meant to group shapes under a set of parameters (usally printing parameters like _infill percentage_). In case of overlapping, the group with the lower index takes priority. The next code exemplifies the use of <code>emit</code>:
|
|
|
|
|
|
```lua
|
|
|
b = box(10)
|
|
|
emit( b, 0 )
|
|
|
c = sphere(5)
|
|
|
emit( translate(0,0,5) * c, 1 )
|
|
|
```
|
|
|
[[File:example_emit.png|thumb]]
|
|
|
|
|
|
|
|
|
Finally, a unit in the scripting language corresponds to 1mm in the printing world. IceSL always renders a scene with a virtual _printing bed_; a grid that represents the 3d printer bed (see image below). Each square of IceSL's printing bed corresponds to 1cm<sup>2</sup>.
|
|
|
|
|
|
Notice that, in order to have a visual aid on view orientation, axes are drown in the bottom-left corner. The red, green and blue lines correspond to the positive X, Y, and Z axes respectively.
|
|
|
|
|
|
[[File:Printing_bed.png|thumb|none]] |