lithop 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/Cargo.lock +284 -0
  4. data/Cargo.toml +6 -0
  5. data/README.md +25 -7
  6. data/RELEASING.md +24 -6
  7. data/docs/README.md +3 -1
  8. data/docs/artifacts.md +9 -2
  9. data/docs/bambu-studio.md +5 -1
  10. data/docs/command.md +25 -2
  11. data/docs/config.md +1 -1
  12. data/docs/getting-started.md +8 -5
  13. data/docs/images/cmyw-lithophane-preview.png +0 -0
  14. data/docs/local-ui.md +114 -0
  15. data/docs/tiling.md +4 -2
  16. data/docs/troubleshooting.md +10 -0
  17. data/ext/lithop_native/Cargo.toml +17 -0
  18. data/ext/lithop_native/build.rs +4 -0
  19. data/ext/lithop_native/extconf.rb +6 -0
  20. data/ext/lithop_native/src/column_mesh.rs +388 -0
  21. data/ext/lithop_native/src/lib.rs +37 -0
  22. data/ext/lithop_native/src/mesh.rs +187 -0
  23. data/ext/lithop_native/src/palette.rs +67 -0
  24. data/ext/lithop_native/src/xml.rs +134 -0
  25. data/lib/lithop/calibration/export.rb +2 -2
  26. data/lib/lithop/cli/options.rb +13 -0
  27. data/lib/lithop/cli.rb +28 -0
  28. data/lib/lithop/export/generation.rb +30 -17
  29. data/lib/lithop/export/job.rb +2 -2
  30. data/lib/lithop/export/metadata.rb +8 -3
  31. data/lib/lithop/export/previews.rb +25 -1
  32. data/lib/lithop/formats/three_mf/mesh.rb +72 -3
  33. data/lib/lithop/formats/three_mf/model_writer.rb +19 -16
  34. data/lib/lithop/formats/three_mf/part_writer.rb +37 -0
  35. data/lib/lithop/formats/three_mf.rb +1 -1
  36. data/lib/lithop/image/pipeline.rb +50 -11
  37. data/lib/lithop/image/svg_loader.rb +5 -5
  38. data/lib/lithop/job_execution.rb +132 -4
  39. data/lib/lithop/mesh/column_geometry.rb +8 -0
  40. data/lib/lithop/mesh/column_topology.rb +2 -0
  41. data/lib/lithop/model/material_model.rb +17 -5
  42. data/lib/lithop/model/palette.rb +21 -3
  43. data/lib/lithop/native.rb +39 -0
  44. data/lib/lithop/tiling.rb +3 -2
  45. data/lib/lithop/version.rb +1 -1
  46. data/lib/lithop/web/app.rb +513 -0
  47. data/lib/lithop/web/bambu_studio_launcher.rb +82 -0
  48. data/lib/lithop/web/job_launcher.rb +214 -0
  49. data/lib/lithop/web/job_store.rb +390 -0
  50. data/lib/lithop/web/preview_store.rb +182 -0
  51. data/lib/lithop/web/public/app.css +319 -0
  52. data/lib/lithop/web/public/app.js +1847 -0
  53. data/lib/lithop/web/server.rb +21 -0
  54. data/lib/lithop/web/settings_form.rb +64 -0
  55. data/lib/lithop/web/settings_library.rb +154 -0
  56. data/lib/lithop/web/views/index.erb +364 -0
  57. data/lib/lithop/web/worker.rb +27 -0
  58. data/lib/lithop.rb +1 -0
  59. data/sig/lithop.rbs +25 -0
  60. metadata +84 -2
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+ require "lithop"
5
+
6
+ module Lithop
7
+ module Web
8
+ # Runs one UI conversion in a separate Ruby process.
9
+ module Worker
10
+ module_function
11
+
12
+ def run(arguments, out: $stdout, err: $stderr)
13
+ job_id, input_path, settings_path, project_dir = arguments
14
+ raise Error, "invalid web worker arguments" unless arguments.length == 4
15
+
16
+ loaded = SettingsFile.load(settings_path, required: true)
17
+ settings = Settings.new(**loaded.values)
18
+ result = Export.new(settings:, project_dir:, job_id:).call(input_path)
19
+ out.puts "Generated #{result.three_mf_triangle_count} CMYW 3MF triangles in #{result.path}"
20
+ 0
21
+ rescue Error, SystemCallError, JSON::ParserError => e
22
+ err.puts "lithop: #{e.message}"
23
+ 1
24
+ end
25
+ end
26
+ end
27
+ end
data/lib/lithop.rb CHANGED
@@ -8,6 +8,7 @@ module Lithop
8
8
  class InputError < Error; end
9
9
  end
10
10
 
11
+ require_relative "lithop/native"
11
12
  require_relative "lithop/sampling_grid"
12
13
  require_relative "lithop/layer_structure"
13
14
  require_relative "lithop/settings"
data/sig/lithop.rbs CHANGED
@@ -1,6 +1,30 @@
1
1
  module Lithop
2
2
  VERSION: String
3
3
 
4
+ module Native
5
+ class MeshBuilder
6
+ def self.new: () -> MeshBuilder
7
+ def add_batch: (Array[Float] coordinates, Array[Integer] topology_keys) -> Integer
8
+ def vertex_count: () -> Integer
9
+ def triangle_count: () -> Integer
10
+ def center: () -> Array[Float]
11
+ def vertex_xml: (Integer offset, Integer count, Array[Float] origin) -> String
12
+ def triangle_xml: (Integer offset, Integer count) -> String
13
+ def memory_bytes: () -> Integer
14
+ end
15
+
16
+ def self.available?: () -> bool
17
+ def self.enabled?: () -> bool
18
+ def self.backend: () -> (:rust | :ruby)
19
+ def self.extension_version: () -> String
20
+ def self.loaded_extension_version: () -> String?
21
+ def self.diagnostics: () -> Hash[Symbol, untyped]
22
+ def self.palette_indices: (Array[Float] cmys, Array[Float] coverages) -> Array[Integer]
23
+ def self.vertex_xml: (Array[Float] vertices, Array[Float] origin) -> String
24
+ def self.triangle_xml: (Array[Integer] indices) -> String
25
+ def self.column_mesh: (Integer columns, Integer rows, Array[Float] x_boundaries, Array[Float] y_boundaries, Array[Float] z_boundaries, Array[Integer] intervals, Array[Integer] group_ids, Integer group_count) -> MeshBuilder
26
+ end
27
+
4
28
  class Error < StandardError
5
29
  end
6
30
 
@@ -121,6 +145,7 @@ module Lithop
121
145
 
122
146
  def initialize: (?layer_count: Integer, ?pigment_order: Array[Symbol]) -> void
123
147
  def nearest: (Array[Numeric] cmy) -> Recipe
148
+ def nearest_many: (Array[Array[Numeric]] cmys) -> Array[Recipe]
124
149
  def display_color: (Recipe recipe) -> String
125
150
  end
126
151
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lithop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ogom
@@ -9,6 +9,48 @@ bindir: bin
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: puma
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '7.0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '7.0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: rackup
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.2'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '2.2'
40
+ - !ruby/object:Gem::Dependency
41
+ name: rb_sys
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: 0.9.128
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: 0.9.128
12
54
  - !ruby/object:Gem::Dependency
13
55
  name: rexml
14
56
  requirement: !ruby/object:Gem::Requirement
@@ -51,16 +93,33 @@ dependencies:
51
93
  - - "~>"
52
94
  - !ruby/object:Gem::Version
53
95
  version: '3.7'
96
+ - !ruby/object:Gem::Dependency
97
+ name: sinatra
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '4.2'
103
+ type: :runtime
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '4.2'
54
110
  description: Lithop converts JPEG, PNG, and SVG images locally into STL and multipart
55
111
  CMYW 3MF models for backlit lithophane printing.
56
112
  email:
57
113
  - ogom@users.noreply.github.com
58
114
  executables:
59
115
  - lithop
60
- extensions: []
116
+ extensions:
117
+ - ext/lithop_native/extconf.rb
61
118
  extra_rdoc_files: []
62
119
  files:
63
120
  - CHANGELOG.md
121
+ - Cargo.lock
122
+ - Cargo.toml
64
123
  - LICENSE
65
124
  - README.md
66
125
  - RELEASING.md
@@ -73,8 +132,18 @@ files:
73
132
  - docs/command.md
74
133
  - docs/config.md
75
134
  - docs/getting-started.md
135
+ - docs/images/cmyw-lithophane-preview.png
136
+ - docs/local-ui.md
76
137
  - docs/tiling.md
77
138
  - docs/troubleshooting.md
139
+ - ext/lithop_native/Cargo.toml
140
+ - ext/lithop_native/build.rs
141
+ - ext/lithop_native/extconf.rb
142
+ - ext/lithop_native/src/column_mesh.rs
143
+ - ext/lithop_native/src/lib.rs
144
+ - ext/lithop_native/src/mesh.rs
145
+ - ext/lithop_native/src/palette.rs
146
+ - ext/lithop_native/src/xml.rs
78
147
  - lib/lithop.rb
79
148
  - lib/lithop/calibration/export.rb
80
149
  - lib/lithop/calibration/profile.rb
@@ -124,12 +193,25 @@ files:
124
193
  - lib/lithop/model/material_model.rb
125
194
  - lib/lithop/model/palette.rb
126
195
  - lib/lithop/model/thickness.rb
196
+ - lib/lithop/native.rb
127
197
  - lib/lithop/reference_three_mf.rb
128
198
  - lib/lithop/sampling_grid.rb
129
199
  - lib/lithop/settings.rb
130
200
  - lib/lithop/settings_file.rb
131
201
  - lib/lithop/tiling.rb
132
202
  - lib/lithop/version.rb
203
+ - lib/lithop/web/app.rb
204
+ - lib/lithop/web/bambu_studio_launcher.rb
205
+ - lib/lithop/web/job_launcher.rb
206
+ - lib/lithop/web/job_store.rb
207
+ - lib/lithop/web/preview_store.rb
208
+ - lib/lithop/web/public/app.css
209
+ - lib/lithop/web/public/app.js
210
+ - lib/lithop/web/server.rb
211
+ - lib/lithop/web/settings_form.rb
212
+ - lib/lithop/web/settings_library.rb
213
+ - lib/lithop/web/views/index.erb
214
+ - lib/lithop/web/worker.rb
133
215
  - sig/lithop.rbs
134
216
  homepage: https://github.com/ogom/lithop
135
217
  licenses: