christophschranz / tweaker-3 Goto Github PK
View Code? Open in Web Editor NEWA performant auto-rotate software for objects in 3D Printing, whose parameter are trained by an evolutionary algorithm.
License: GNU General Public License v3.0
A performant auto-rotate software for objects in 3D Printing, whose parameter are trained by an evolutionary algorithm.
License: GNU General Public License v3.0
Hi there,
I am using tweaker for a custom slicer and in most cases tweaker works great and orientates the models perfectly. This model is consistently placed on the end even though it makes for a lot more overhanging parts.
The rounded corners might be the reason why it chooses to place it like this, but it would be pretty bad to print the part like this.
Otherwise love the feature, it makes it awesome to work with downloaded STL files.
Hey there - first of all, thanks so much for this awesome project @ChristophSchranz!
I've noticed that Tweaker accepts 3mf
files, but that it doesn't quite know how to handle multiple objects within one 3mf
file, so it just selects one and smart-rotates that one.
Would it be possible for it to rotate and return multiple objects?
Here's an example file;
Multi-instance-control-box.zip
Hello! Thanks for the project!
There's a model (https://cdn.thingiverse.com/assets/70/96/59/c1/62/RIGHT_Q1_single_piece_SolidSlime_1.3.stl), where I ONLY want support to be generated from buildplate, otherwise support will leave some scarred interface on some surface.
But I can only make tweaker-3 (actually, the cura wrapper plugin) to orient it in a way that it can only be printed when support is generated from anywhere, otherwise some dramatic overhang will fail.
How tweaker-3 orient it (the top part has some dangerous overhang):
How I assume tweaker-3 should orient it:
So is there any way to make Tweaker-3 optimize support while assuming support is only generated from the buildplate? Thanks.
Hello,
Is this project still in development?
Is it still useful to use this software? I wanted to try it but I got error when trying to use minimal support (cmd not recognized).
I also tried -vol that returns errors.
When it comes to 3D printing object for production the strength of the object in a given orientation is important. I have been trying to generate two objects with Tweaker-3, one upstanding and one laying on one of the side. The documentation on the -fs
function is a little bit vague. Thus, I can seem to figure out if there is a way using the favorite side function in order to achieve restrictions on certain axis rotations?
When trying to run python Tweaker.py -i <my_obj.STL> -vb -x -fs "[[0,-1,2.5],3]"
I get this exception:
Calculating the optimal orientation:
spool_axle.STL
You favour the side [ 0. -0.39872611 0.91707006] with a factor of 1.0
Traceback (most recent call last):
File "/home/gena/workspace/work/Iambol_e_grada/Tweaker-3/Tweaker.py", line 154, in <module>
x = Tweak(mesh, args.extended_mode, args.verbose, args.show_progress, args.favside, args.volume)
File "/home/gena/workspace/work/Iambol_e_grada/Tweaker-3/MeshTweaker.py", line 107, in __init__
self.favour_side(favside)
File "/home/gena/workspace/work/Iambol_e_grada/Tweaker-3/MeshTweaker.py", line 281, in favour_side
align = np.sum(diff * diff, axis=1) < self.ANGLE_SCALE # 0.7654, ANGLE_SCALE ist around 0.1
AttributeError: 'Tweak' object has no attribute 'ANGLE_SCALE'
Hi,
I am the developer of a web-based slicing program called Symple Slicer:
https://github.com/SynDaverCO/symple-slicer
I think the auto-rotation feature would be very handy for our slicer. I have quite a bit of experience porting Python code to JavaScript, but before I launch into that, I was wondering if you were aware of anyone who may have already ported Tweaker-3 to JavaScript?
Secondly, I looked though your whitepaper and while most of it was beyond my understanding, I am curious about the death star algorithm. You say in your paper that "since the bottom area would be a circle without any
resulting area, the area cumulation algorithm fails." In Symple Slicer, I needed to have an option for the user to lay a print flat on the print bed and complex shapes presented a challenge. I solved my problem by using an off-the-shelf algorithm to compute the convex hull of the STL file, as the convex hull provides a convenient representation of all faces that can sit against the bed.
Since the convex hull of the death star is precisely a sphere with a large flat circular face, I wonder if that could be used in Tweaker-3 to simplify the death star problem and maybe give you solution that is more deterministic. Computing the convex hull of geometry is not trivial, but there are well developed algorithms out there for doing it.
I tried running python Tweaker.py -i gauntlet.stl -x -p -r
with this file and I got this error:
Traceback (most recent call last):
File "/home/stuart/Downloads/Tweaker-3/FileHandler.py", line 26, in load_mesh
objs = self.load_ascii_stl(f)
File "/home/stuart/Downloads/Tweaker-3/FileHandler.py", line 72, in load_ascii_stl
for line in f:
File "/usr/lib/python3.7/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9e in position 81: invalid start byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "Tweaker.py", line 120, in <module>
objs = FileHandler.load_mesh(args.inputfile)
File "/home/stuart/Downloads/Tweaker-3/FileHandler.py", line 30, in load_mesh
objs = self.load_binary_stl(f)
File "/home/stuart/Downloads/Tweaker-3/FileHandler.py", line 91, in load_binary_stl
f.read(80-5)
File "/usr/lib/python3.7/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9e in position 76: invalid start byte
In update_progress()
you use os.system('cls')
, which is not OS Independent. On a non-Windows system you will get the following errors:
tweaker3 -i BODY_RIGHT.stl -x -p
sh: cls: command not found
Progress is: 18
sh: cls: command not found
Progress is: 54
sh: cls: command not found
Progress is: 90
I would suggest using something along the lines of os.system('cls' if os.name == 'nt' else 'clear')
Reference: https://stackoverflow.com/a/2084628/18731807
It seems the following commit breaks the facet count in binary stl.
The one example in your readme doesn't show the full potential of the script. Do you have other examples to get a better notion?
Thank you
Hi,
I have tweaked lots of models with your wonderful Tweaker (probably thousands at this point ;) and most of the time it works wonderfully. So thank you so much for great work!
Only recently I stumbled on one model that can't be tweaked. Error description from "your Auto-Rotate Developer" instructed me to open new issue, so here I am.
Model seems not corrupted- it works without any problems in Mac OS X Preview, Meshmixer and PrusaSlicer. Problem seems to be in ASCII formatting of .stl file, because the same model converted to binary .stl can be tweaked just fine.
Best,
Your Grateful Auto-Rotate User
I developed small dos scripts to allow right-clicking a STL file and do things.
I prefer to not PR that because I don't know if the REG file (to add right-click menu) will work on other computer (I can't try).
Also, the user has to install your software in C:\stlTweaker and put the content of my zip into your installation folder.
So, take it as a small feature to improve or as a suggestion in your README.md
Giving tweaker a larger stl (180mb) tweaker seems to use a little over 2GB of memory to orient this file. Is there anything that can be done to minimize memory usage?
I own a CR-30 belt printer, which has an "infinite" horizontal Z-axis and an XY axis that's rotated 45 degrees from what you'd normally expect. In this configuration, the rotation of the part around the up-axis matters. Here's an illustrated example of a side-view of the belt with an L-shaped 3d model:
The diagonal lines indicate the XY layers. In this case, the same geometry rotated 180 degrees results in the same adhesion to the bed, but creates an unprintable overhang in the example on the right.
In addition to weird overhang behavior, the leading edge at the base of the print is also important - a long leading edge causes a long initial extrusion, which tends to adhere worse than a short leading edge. This is why suggestions to improve bed adhesion mention rotating the part 45 degrees so it has a small initial area on the bed
Can I use Tweaker to account for these things? If not, what would it take to support this use case?
Also for a bit more context, I own the Continuous Print plugin for OctoPrint and am looking for integrations that would allow on-demand slicing for heterogeneous clusters of 3d printers. Right now I handle this by slicing the same STL multiple times and adding metadata around which file is valid for which printer type - example here. I'd love to integrate with Tweaker if it solved part orientation for belt printing and I'm willing to help contribute where I can!
I am using this plugin in one of my project. Thanks for a good plugin. I am trying to understand for example if the model has been optimized already in terms minimum support material necessary using Cura or any other software, then how do I find out whether it still needs improvement of it is already been optimized (or rortated)? Because this tool simply rotates what ever model I use. It will be useful to know this information. So I don't need to apply the plugin unnecessarily.
Please let me know or please point me to the right direction where I can find this information? I can't see this in the wiki
Thank You
Shan
I cloned the repo and ran the first command in the readme and get the below syntax error. Am I possibly missing some dependancy?
a483e711095a:Tweaker-3 speredni$ python Tweaker.py -i demo_object.stl -vb
Traceback (most recent call last):
File "Tweaker.py", line 8, in <module>
from MeshTweaker import Tweak
File "/Users/speredni/Documents/Tweaker-3/MeshTweaker.py", line 451
print("\nProgress is: {}".format(progress), end="")
^
SyntaxError: invalid syntax
Python version info:
Python 2.7.16 (default, Dec 3 2019, 07:02:07)
[GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)] on darwin
cura2.5
Python 3.10.6
Pip 22.2.2
`C:\Windows\System32>pip install git+https://github.com/ChristophSchranz/Tweaker-3.git
Collecting git+https://github.com/ChristophSchranz/Tweaker-3.git
Cloning https://github.com/ChristophSchranz/Tweaker-3.git to c:\users\meyverick\appdata\local\temp\pip-req-build-v3a_o4vf
Running command git clone --filter=blob:none --quiet https://github.com/ChristophSchranz/Tweaker-3.git 'C:\Users\Meyverick\AppData\Local\Temp\pip-req-build-v3a_o4vf'
Resolved https://github.com/ChristophSchranz/Tweaker-3.git to commit f9db764
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [59 lines of output]
running egg_info
creating tweaker3.egg-info
writing tweaker3.egg-info\PKG-INFO
writing dependency_links to tweaker3.egg-info\dependency_links.txt
writing entry points to tweaker3.egg-info\entry_points.txt
writing requirements to tweaker3.egg-info\requires.txt
writing top-level names to tweaker3.egg-info\top_level.txt
writing manifest file 'tweaker3.egg-info\SOURCES.txt'
Traceback (most recent call last):
File "C:\Users\Meyverick\AppData\Local\Programs\Python\Python310\lib\site-packages\pip_vendor\pep517\in_process_in_process.py", line 363, in
main()
File "C:\Users\Meyverick\AppData\Local\Programs\Python\Python310\lib\site-packages\pip_vendor\pep517\in_process_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "C:\Users\Meyverick\AppData\Local\Programs\Python\Python310\lib\site-packages\pip_vendor\pep517\in_process_in_process.py", line 130, in get_requires_for_build_wheel
return hook(config_settings)
File "C:\Users\Meyverick\AppData\Local\Temp\pip-build-env-rv6wsqfl\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "C:\Users\Meyverick\AppData\Local\Temp\pip-build-env-rv6wsqfl\overlay\Lib\site-packages\setuptools\build_meta.py", line 320, in get_build_requires
self.run_setup()
File "C:\Users\Meyverick\AppData\Local\Temp\pip-build-env-rv6wsqfl\overlay\Lib\site-packages\setuptools\build_meta.py", line 335, in run_setup
exec(code, locals())
File "", line 1, in
File "C:\Users\Meyverick\AppData\Local\Temp\pip-build-env-rv6wsqfl\overlay\Lib\site-packages\setuptools_init.py", line 87, in setup
return distutils.core.setup(**attrs)
File "C:\Users\Meyverick\AppData\Local\Temp\pip-build-env-rv6wsqfl\overlay\Lib\site-packages\setuptools_distutils\core.py", line 185, in setup
return run_commands(dist)
File "C:\Users\Meyverick\AppData\Local\Temp\pip-build-env-rv6wsqfl\overlay\Lib\site-packages\setuptools_distutils\core.py", line 201, in run_commands
dist.run_commands()
File "C:\Users\Meyverick\AppData\Local\Temp\pip-build-env-rv6wsqfl\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 973, in run_commands
self.run_command(cmd)
File "C:\Users\Meyverick\AppData\Local\Temp\pip-build-env-rv6wsqfl\overlay\Lib\site-packages\setuptools\dist.py", line 1217, in run_command
super().run_command(command)
File "C:\Users\Meyverick\AppData\Local\Temp\pip-build-env-rv6wsqfl\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 992, in run_command
cmd_obj.run()
File "C:\Users\Meyverick\AppData\Local\Temp\pip-build-env-rv6wsqfl\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 308, in run
self.find_sources()
File "C:\Users\Meyverick\AppData\Local\Temp\pip-build-env-rv6wsqfl\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 316, in find_sources
mm.run()
File "C:\Users\Meyverick\AppData\Local\Temp\pip-build-env-rv6wsqfl\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 560, in run
self.add_defaults()
File "C:\Users\Meyverick\AppData\Local\Temp\pip-build-env-rv6wsqfl\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 597, in add_defaults
sdist.add_defaults(self)
File "C:\Users\Meyverick\AppData\Local\Temp\pip-build-env-rv6wsqfl\overlay\Lib\site-packages\setuptools\command\sdist.py", line 106, in add_defaults
super().add_defaults()
File "C:\Users\Meyverick\AppData\Local\Temp\pip-build-env-rv6wsqfl\overlay\Lib\site-packages\setuptools_distutils\command\sdist.py", line 250, in add_defaults
self._add_defaults_python()
File "C:\Users\Meyverick\AppData\Local\Temp\pip-build-env-rv6wsqfl\overlay\Lib\site-packages\setuptools\command\sdist.py", line 117, in _add_defaults_python
build_py = self.get_finalized_command('build_py')
File "C:\Users\Meyverick\AppData\Local\Temp\pip-build-env-rv6wsqfl\overlay\Lib\site-packages\setuptools_distutils\cmd.py", line 306, in get_finalized_command
cmd_obj.ensure_finalized()
File "C:\Users\Meyverick\AppData\Local\Temp\pip-build-env-rv6wsqfl\overlay\Lib\site-packages\setuptools_distutils\cmd.py", line 109, in ensure_finalized
self.finalize_options()
File "C:\Users\Meyverick\AppData\Local\Temp\pip-build-env-rv6wsqfl\overlay\Lib\site-packages\setuptools\command\build_py.py", line 37, in finalize_options
orig.build_py.finalize_options(self)
File "C:\Users\Meyverick\AppData\Local\Temp\pip-build-env-rv6wsqfl\overlay\Lib\site-packages\setuptools_distutils\command\build_py.py", line 59, in finalize_options
self.package_dir[name] = convert_path(path)
File "C:\Users\Meyverick\AppData\Local\Temp\pip-build-env-rv6wsqfl\overlay\Lib\site-packages\setuptools_distutils\util.py", line 139, in convert_path
raise ValueError("path '%s' cannot end with '/'" % pathname)
ValueError: path './' cannot end with '/'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.`
I was looking for the "Auto Orientation" plugin in Cura's Plugin Marketplace but I don't see it anywhere.
I realize it says it's in the Cura Marketplace for Cura versions >=4 in the README.md, but that file was last modified before Cura 5 came out. Does it perhaps not support Cura 5?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.