autoforge 1.4.0__tar.gz → 1.4.1__tar.gz

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 (34) hide show
  1. {autoforge-1.4.0 → autoforge-1.4.1}/PKG-INFO +2 -1
  2. {autoforge-1.4.0 → autoforge-1.4.1}/README.md +1 -0
  3. {autoforge-1.4.0 → autoforge-1.4.1}/pyproject.toml +1 -1
  4. {autoforge-1.4.0 → autoforge-1.4.1}/src/AutoForge.egg-info/PKG-INFO +2 -1
  5. {autoforge-1.4.0 → autoforge-1.4.1}/src/autoforge/Helper/OutputHelper.py +20 -9
  6. {autoforge-1.4.0 → autoforge-1.4.1}/src/autoforge/auto_forge.py +8 -1
  7. {autoforge-1.4.0 → autoforge-1.4.1}/setup.cfg +0 -0
  8. {autoforge-1.4.0 → autoforge-1.4.1}/src/AutoForge.egg-info/SOURCES.txt +0 -0
  9. {autoforge-1.4.0 → autoforge-1.4.1}/src/AutoForge.egg-info/dependency_links.txt +0 -0
  10. {autoforge-1.4.0 → autoforge-1.4.1}/src/AutoForge.egg-info/entry_points.txt +0 -0
  11. {autoforge-1.4.0 → autoforge-1.4.1}/src/AutoForge.egg-info/requires.txt +0 -0
  12. {autoforge-1.4.0 → autoforge-1.4.1}/src/AutoForge.egg-info/top_level.txt +0 -0
  13. {autoforge-1.4.0 → autoforge-1.4.1}/src/autoforge/Gui/Views/__init__.py +0 -0
  14. {autoforge-1.4.0 → autoforge-1.4.1}/src/autoforge/Gui/Views/backend_database.py +0 -0
  15. {autoforge-1.4.0 → autoforge-1.4.1}/src/autoforge/Gui/Views/filament_editor.py +0 -0
  16. {autoforge-1.4.0 → autoforge-1.4.1}/src/autoforge/Gui/__init__.py +0 -0
  17. {autoforge-1.4.0 → autoforge-1.4.1}/src/autoforge/Gui/app.py +0 -0
  18. {autoforge-1.4.0 → autoforge-1.4.1}/src/autoforge/Gui/main.py +0 -0
  19. {autoforge-1.4.0 → autoforge-1.4.1}/src/autoforge/Helper/FilamentHelper.py +0 -0
  20. {autoforge-1.4.0 → autoforge-1.4.1}/src/autoforge/Helper/ImageHelper.py +0 -0
  21. {autoforge-1.4.0 → autoforge-1.4.1}/src/autoforge/Helper/OptimizerHelper.py +0 -0
  22. {autoforge-1.4.0 → autoforge-1.4.1}/src/autoforge/Helper/PruningHelper.py +0 -0
  23. {autoforge-1.4.0 → autoforge-1.4.1}/src/autoforge/Helper/__init__.py +0 -0
  24. {autoforge-1.4.0 → autoforge-1.4.1}/src/autoforge/Helper/filamentcolors_library.py +0 -0
  25. {autoforge-1.4.0 → autoforge-1.4.1}/src/autoforge/Loss/LossFunctions.py +0 -0
  26. {autoforge-1.4.0 → autoforge-1.4.1}/src/autoforge/Loss/PerceptionLoss.py +0 -0
  27. {autoforge-1.4.0 → autoforge-1.4.1}/src/autoforge/Loss/__init__.py +0 -0
  28. {autoforge-1.4.0 → autoforge-1.4.1}/src/autoforge/Misc/__init__.py +0 -0
  29. {autoforge-1.4.0 → autoforge-1.4.1}/src/autoforge/Misc/color_fit_all.py +0 -0
  30. {autoforge-1.4.0 → autoforge-1.4.1}/src/autoforge/Modules/Optimizer.py +0 -0
  31. {autoforge-1.4.0 → autoforge-1.4.1}/src/autoforge/Modules/__init__.py +0 -0
  32. {autoforge-1.4.0 → autoforge-1.4.1}/src/autoforge/__init__.py +0 -0
  33. {autoforge-1.4.0 → autoforge-1.4.1}/src/autoforge/__main__.py +0 -0
  34. {autoforge-1.4.0 → autoforge-1.4.1}/src/autoforge/old_jax_files.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: AutoForge
3
- Version: 1.4.0
3
+ Version: 1.4.1
4
4
  Summary: AutoForge is a Python tool for generating 3D printed layered models from an input image.
5
5
  Author-email: Hendric Voss <hvoss@techfak.uni-bielefeld.de>
6
6
  License: CC BY-NC-SA 4.0
@@ -114,6 +114,7 @@ autoforge --input_image path/to/input_image.jpg --csv_file path/to/materials.csv
114
114
  **Note:** We solve on a smaller size as this is many times faster, but also a bit less accurate. Increase if you need more accuracy.
115
115
  - `--init_tau`: Initial tau value for Gumbel-Softmax (default: 1.0).
116
116
  - `--final_tau`: Final tau value for the Gumbel-Softmax formulation (default: 0.01).
117
+ - `--stl_output_size`: Size of the output stl file in mm (default: 200) (20cm).
117
118
  - `--visualize`: Flag to enable live visualization of the composite image during optimization.
118
119
  - `--tensorboard`: Enable TensorBoard logging
119
120
  - `--run-name`: Name of the run used for TensorBoard logging (optional).
@@ -93,6 +93,7 @@ autoforge --input_image path/to/input_image.jpg --csv_file path/to/materials.csv
93
93
  **Note:** We solve on a smaller size as this is many times faster, but also a bit less accurate. Increase if you need more accuracy.
94
94
  - `--init_tau`: Initial tau value for Gumbel-Softmax (default: 1.0).
95
95
  - `--final_tau`: Final tau value for the Gumbel-Softmax formulation (default: 0.01).
96
+ - `--stl_output_size`: Size of the output stl file in mm (default: 200) (20cm).
96
97
  - `--visualize`: Flag to enable live visualization of the composite image during optimization.
97
98
  - `--tensorboard`: Enable TensorBoard logging
98
99
  - `--run-name`: Name of the run used for TensorBoard logging (optional).
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "AutoForge"
7
- version="1.4.0"
7
+ version="1.4.1"
8
8
  description = "AutoForge is a Python tool for generating 3D printed layered models from an input image."
9
9
  authors = [{ name = "Hendric Voss", email = "hvoss@techfak.uni-bielefeld.de" }]
10
10
  readme = "README.md"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: AutoForge
3
- Version: 1.4.0
3
+ Version: 1.4.1
4
4
  Summary: AutoForge is a Python tool for generating 3D printed layered models from an input image.
5
5
  Author-email: Hendric Voss <hvoss@techfak.uni-bielefeld.de>
6
6
  License: CC BY-NC-SA 4.0
@@ -114,6 +114,7 @@ autoforge --input_image path/to/input_image.jpg --csv_file path/to/materials.csv
114
114
  **Note:** We solve on a smaller size as this is many times faster, but also a bit less accurate. Increase if you need more accuracy.
115
115
  - `--init_tau`: Initial tau value for Gumbel-Softmax (default: 1.0).
116
116
  - `--final_tau`: Final tau value for the Gumbel-Softmax formulation (default: 0.01).
117
+ - `--stl_output_size`: Size of the output stl file in mm (default: 200) (20cm).
117
118
  - `--visualize`: Flag to enable live visualization of the composite image during optimization.
118
119
  - `--tensorboard`: Enable TensorBoard logging
119
120
  - `--run-name`: Name of the run used for TensorBoard logging (optional).
@@ -186,33 +186,44 @@ def generate_project_file(
186
186
  json.dump(project_data, f, indent=4)
187
187
 
188
188
 
189
- def generate_stl(height_map, filename, background_height, scale=1.0):
189
+ def generate_stl(height_map, filename, background_height, maximum_x_y_size):
190
190
  """
191
191
  Generate a binary STL file from a height map with shared boundary vertices
192
- to fix non-manifold edge warnings.
192
+ to fix non-manifold edge warnings, scaling the x and y dimensions to a maximum
193
+ size specified in millimeters.
193
194
 
194
195
  Args:
195
196
  height_map (np.ndarray): 2D array representing the height map.
196
197
  filename (str): The name of the output STL file.
197
198
  background_height (float): The height of the background in the STL model.
198
- scale (float, optional): Scale factor for the x dimension (and optionally y). Defaults to 1.0.
199
+ maximum_x_y_size (float): Maximum size (in millimeters) for the x and y dimensions.
199
200
  """
200
201
  H, W = height_map.shape
201
202
 
202
203
  # Create the top vertices grid.
203
- # Note: y is computed as H-1-i. (Apply scale to y if desired.)
204
+ # Note: y is computed as H-1-i.
204
205
  top_vertices = np.zeros((H, W, 3), dtype=np.float32)
205
206
  for i in range(H):
206
207
  for j in range(W):
207
- top_vertices[i, j, 0] = j * scale
208
- top_vertices[i, j, 1] = H - 1 - i # or (H - 1 - i) * scale if you want uniform scaling
208
+ top_vertices[i, j, 0] = j
209
+ top_vertices[i, j, 1] = H - 1 - i # y coordinate: top row has highest value
209
210
  top_vertices[i, j, 2] = height_map[i, j] + background_height
210
211
 
211
- # Create the bottom vertices for the boundary by copying the x and y coordinates,
212
- # but setting z to 0. Using these ensures that adjacent triangles share the same vertices.
212
+ # Create the bottom vertices for the boundary by copying x and y coordinates,
213
+ # but setting z to 0.
213
214
  bottom_vertices = top_vertices.copy()
214
215
  bottom_vertices[:, :, 2] = 0
215
216
 
217
+ # --- Scale vertices so that the maximum x or y dimension equals maximum_x_y_size ---
218
+ # The current extents in x and y are 0 to (W - 1) and 0 to (H - 1), respectively.
219
+ # We use the maximum of these as our original size.
220
+ original_max = max(W - 1, H - 1)
221
+ scale = maximum_x_y_size / original_max
222
+ top_vertices[:, :, 0] *= scale
223
+ top_vertices[:, :, 1] *= scale
224
+ bottom_vertices[:, :, 0] *= scale
225
+ bottom_vertices[:, :, 1] *= scale
226
+
216
227
  triangles = []
217
228
 
218
229
  def add_triangle(v1, v2, v3):
@@ -226,7 +237,7 @@ def generate_stl(height_map, filename, background_height, scale=1.0):
226
237
  v1 = top_vertices[i, j + 1]
227
238
  v2 = top_vertices[i + 1, j + 1]
228
239
  v3 = top_vertices[i + 1, j]
229
- # Using reversed order so that normals face upward.
240
+ # Use reversed order so that normals face upward.
230
241
  add_triangle(v2, v1, v0)
231
242
  add_triangle(v3, v2, v0)
232
243
 
@@ -98,6 +98,13 @@ def main():
98
98
  help="Enable visualization during optimization",
99
99
  )
100
100
 
101
+ parser.add_argument(
102
+ "--stl_output_size",
103
+ type=int,
104
+ default=200,
105
+ help="Size of the longest dimension of the output STL file",
106
+ )
107
+
101
108
  parser.add_argument(
102
109
  "--perform_pruning",
103
110
  type=bool,
@@ -382,7 +389,7 @@ def main():
382
389
  height_map_mm = (
383
390
  disc_height_image.cpu().numpy().astype(np.float32)
384
391
  ) * args.layer_height
385
- generate_stl(height_map_mm, stl_filename, args.background_height, scale=1.0)
392
+ generate_stl(height_map_mm, stl_filename, args.background_height, maximum_x_y_size=args.stl_output_size)
386
393
 
387
394
  # Swap instructions
388
395
  background_layers = int(args.background_height // args.layer_height)
File without changes