-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GcodeStartEndFormatter with basic math functions #11452
Comments
Hi @MarcelMo thank you for your feature request. |
Yes, the error reporting as mentioned should also be adressed. The whole parsing stops on a single error. All other lines should be processed. Maybe the error can simply be added as a comment in the resulting gcode. Or maybe it is even possible to highlight any errors while editing. Also, while editing a suggestion on all possible variables would be really great (maybe even containing the human readable description of the variable and/or its source). |
We have discussed it with the team and we decided to defer this issue, like the other two. |
How about using an existing template engine ? As a php programmer I would think of something like smarty or twig. This should be fairly easy to implement and would circumvent the need to do a lot of coding and documenting. |
You are free to implement this yourself and create a pull request :) |
I must say that I like the idea of using an existing template engine. In Python, you could use eg Jinja or Mako instead of Twig. The problem remains though that much of the decisions of eg which extruders are actually used, and which s used as the first extruder, are made in CuraEngine, not in the Python-based frontend that deals with the start and end gcode formatting. |
I search the web a bit. |
Cura's dependencies are in the cura-build-environment repository. In particular, the Python modules we depend on are in the requirements.txt file there. We'd also have to ensure that existing configurations keep working in Cura. So if the syntax is different and not backwards compatible, that would be a problem. A version upgrade would need to handle that then. |
Hi 👋, If this is still something that you think can improve how you and others use Cura, can you please leave a comment? If it has been resolved or don't need it to be improved anymore, you don't have to do anything, and this issue will be automatically closed in 14 days. |
Bump |
Is your feature request related to a problem?
A good start/stop script should be parametric, but since even the simplest scripts need unit conversions (travel speed for example), there is no "one for all" script possible.
Describe the solution you'd like
GcodeStartEndFormatter should be able to perform at least some basic math functions, and also, should be able to parse the most basic syntax conventions.
My guess, best way would be to define some basic allowed functions and operators.
Functions like sqrt(),pow() and operators like "+","-" and "("/")"
I never used python, so I don't know what kind of evaluation would be safest.
Describe alternatives you've considered
Alternatively I would suggest allowing the whole script to be python, and generating the complete gcode via script.
Or maybe there is some sort of plugin for that already ?
Affected users and/or printers
All users would benefit from universal adapting default scripts.
Additional information & file uploads
No response
The text was updated successfully, but these errors were encountered: