-
Notifications
You must be signed in to change notification settings - Fork 11
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
include() statement and external "functions" usage #7
Comments
I had not considered that possibility, and I don't think i personally have a use for it, but it does sound like a neat idea! I'm not sure what the best way to do it would be. One simple way might be to to add a way to specify include files in he |
I discovered your crate only like 2 hours back, ad am thinking of using it to transform my cumbersome and partially unfinished scad scripts for 3d printable model into neater Rust program... Myself being Rust beginner (only one small app finished so far here on github), I do not want to promise anything, though I will maybe try to put together a rough pull request with an attempt. My current rough idea is with two new ScadElement types, one for inclusion (simple string param should suffice), other for included functions invocation (normal vs named params as HashMap or Vector of tuples / other?) edit: |
Sounds good! Fun fact: this was my first serious rust project that I wrote. Let me know if you run into any issues :) Regarding the implementation I think it might be neater to not have an scad!(Include("file.scad"); cube(...)) I imagine it could be done similarly to how the file detail is specified here https://github.com/TheZoq2/Rust-Scad/blob/master/src/scad_file.rs#L17 and here https://github.com/TheZoq2/Rust-Scad/blob/master/src/scad_file.rs#L41 |
😆 exactly same idea/alert popped into my mind before editing my latest comment, and redirecting my thoughts to ScadFile setting instead... |
I started to implement this on a fork today, but am struggling with representation of the function direct and named arguments... Combination of lifetimes for references or insane Will try to cope with it a bit more, though does not look good, my head keeps exploding... :) edit: Currently new ScadElement felt like a good start point:
however Clone trait implementation for |
Progress committed as: Current limitation for include statement - i put it into "header" of resulting file, though it should be usable also further in .scad file, to allow user variables pre-setting before include and variables overwrite...(https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Include_Statement) Include is added as a new setting for Arguments/ named arguments are defined as optional Rc<> wrapped Vector, to prevent need to implement clones or define explicit lifetimes for already existing ScadObject variants. (at least that is direction where my experiments lead me, not sure if this would really be necessary). I still need to experiment with usage and see how it handles. Please let me know if oyu have time your opinions on current direction... (i'm more than opened to criticism ;) ) |
I opened pull request #9 with usage example excerpt in the PR comment. |
hello,
this is a question rather than actual issue...
Have you considered adding support for
include()
statement of external .scad files for resulting output scad code?To allow adding include into resulting code, and place calls to external functions with rust-code defined parameters, where needed/appropriate - sort of new
ScadElement
enum type that would allow to add arbitrary included scad functions with defined (named) parameters that would contain values from rust.e.g.:
Not sure if this could be implemented using some simple new ScadElement enum type with HashMap input that would allow to define function name plus param names/values or something similar...
The text was updated successfully, but these errors were encountered: