====== ICE SL ======
[[http://shapeforge.loria.fr/icesl-online/|Online tool]]
===== Documentatie =====
* Cheatsheet kan je **[[https://icesl.loria.fr/cheatsheet/|Hier]]** vinden
* [[https://gforge.inria.fr/plugins/mediawiki/wiki/icesl/index.php/Scripting#Primitive_Shapes|Officieel ICL documentatie]]
* [[https://gitlab.inria.fr/mfx/icesl-documentation/-/wikis/Scripting-language|gitlab documentatie]]
* [[https://github.com/shapeforge/icesl-models|Github voorbeeld modellen]]
* [[http://thomaslauer.com/download/luarefv51.pdf| Lua Code]]
* [[https://groups.google.com/g/icesl|Forum]]
* [[https://pastebin.com/AU4JGHqC|Lua Cheat Sheet for Programmers]]
===== Functies =====
* ''bal = ui_scalar('Bal/diameter (mm)', 239, 0, 600)'' -> 1e veld is text/label, default waarde, minimum waarde, max waarde)
* ''emit(object)'' -> tekenen van Object 'dhoek'
* ''difference(objetA,objectB)'' -> wegsnijden van objecte adv object.
* ''emit(translate(0,0,0)*ring)'' -> op een specifieke plaats tekenen van het object
* ''print("Here is a string" .. ' concatenated with ' .. 2 .. ' other strings.')'' -> om text te printen/tussentijdse feedback
*
===== Voorbeelden =====
==== Driehoek ====
L = 160
H = 200
D = 83/2
Db = D + 4
dikte = 20
-- weergeven variable waarde
v1 = ui_scalar('.A', 0, 0, 300)
v2 = ui_scalar('.B', 0, 0, 300)
v3 = ui_scalar('.C', 0, 0, 300)
v4 = ui_scalar('.D', L, 0, 160)
v5 = ui_scalar('.E', H, 0, 200)
v6 = ui_scalar('.F', (L/2), 0, 80)
triangle = { v(v1,v2), v(v3,v4), v(v5,v6) }
dir = v(0,0,dikte)
dhoek = linear_extrude(dir, triangle)
emit(dhoek)
==== Cilinder ====
hoogte = 40
buitenring = cylinder(160,hoogte)
binnenring = cylinder(100,hoogte)
ring = difference(buitenring,binnenring)
emit(ring)
==== Binnen verval ====
bringbuitenrand = 92 /2
bringbinnenrand = 35 /2
kegellengte = 30
bringdikte = 50
-- DEEL 1 (Platte ring)
--*******************************************
bevestigingsring = difference(cylinder(bringbuitenrand,bringdikte),
cylinder(bringbinnenrand,bringdikte)
)
--emit(bevestigingsring)
-- DEEL 2 (kegel)
--*******************************************
kegel = cone(bringbuitenrand, bringbinnenrand, kegellengte)
--emit(kegel)
-- DEEL 3 (Ring - kegel)
--*******************************************
emit(difference(bevestigingsring,kegel))
==== Code voorbeelden ====
-- Lua Cheat Sheet for Programmers, by Al Sweigart http://coffeeghost.net
-- This cheat sheet is an executable Lua program.
--[[ This is
a multline comment]]
---[[ This is a neat trick. The first -- makes -[[ not a multiline comment.
print("This line executes.")
--]] The rest of this line is also a comment.
print("Here is a string" .. ' concatenated with ' .. 2 .. ' other strings.')
-- Note: All number types are doubles. There're no integers.
print(type(42), type(42.0)) -- prints out "number number"
variable_one = 1 + 2 - 3 -- This will equal zero.
variable_One = "Variables are case sensitive."
negative_twofiftysix = -2^8
a, b = 42, 101 --mulitple assignment
a, b = b, a --provides a nice value swap trick
x, y, z = 1, 2, 3, "this value is discarded"
print(previously_unused_variable == nil) -- prints true, all vars start as nil
print(nil == 0 or nil == "") -- prints false, nil is not the same as false or 0
print('The # len operator says there are ' .. #'hello' .. ' letters in "hello".')
some_bool_variable = true and false or true and not false
a_table = {['spam'] = "Type something in:", ['eggs'] = 10} -- tables are dictionaries/arrays
print(a_table['spam'])
what_the_user_typed_in = io.read()
print('You typed in ' .. what_the_user_typed_in)
if 10 < 20 then
print( "apple" == "orange" ) -- prints false
print( "apple" ~= "orange" ) -- true, an apple is not equal to an orange
local foo
foo = 42
print(foo)
elseif 50 < 100 then
--These clauses can contain no lines of code.
end
print(foo) -- prints nil, local foo exists only in that "if" block above
m = 0
while m < 10 do
print("howdy " .. m)
m = m + 1 -- there is no m++ or m += 1
repeat
print("Repeat loops check the condition at end, and stops if it is true.")
break -- breaks out of the loop early
until m == 9999
end
for i = 1, 10 do
for j = 1, 10, 2 do
print("for loops add 1 to i and 2 to j each iteration " .. i .. ' ' .. j)
end
end
function Greet(name)
print('Hello ' .. name)
bar = 100
return "returns nil if you don't have a return statement."
end
Greet('Al Sweigart')
print(bar) -- prints 100