-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsnap.lua
More file actions
28 lines (22 loc) · 803 Bytes
/
Copy pathsnap.lua
File metadata and controls
28 lines (22 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
name_en = "Snap to bed"
name_es = "Fijar a la base"
name_fr = "Fixe au plateau"
description_en = "Snaps the object to the printing bed based on a surface point"
description_es = "Fija el objecto a la base de impresión con respecto a un punto de su superficie"
description_fr = "Fixe l'objet au lit d'impression à l'égard d'un point de sa surface"
enable_variable_cache = true
function effect(mdl)
if not snap_model then
pmatrix = ui_pick('Choose surface point')
end
local snap_model = ui_bool('Snap object to bed w.r.t.\npoint (close surface picker first)', false)
local mag1 = union(Void, magnet('m1'))
local mag2 = union(Void, pmatrix * magnet('m2'))
local smatrix = snap(mag1, 'm1', mag2, 'm2')
if snap_model then
return smatrix * mdl
else
emit(mag2)
return mdl
end
end