Skip to content
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

scad_render_to_file forwards file_header #6

Merged
merged 1 commit into from
Dec 15, 2022

Conversation

Exr0n
Copy link

@Exr0n Exr0n commented Dec 15, 2022

Update scad_render_to_file to forward file_header to scad_render, to maintain the interface of SolidPython.

I believe this is the correct fix to re-enable the scad_render_to_file(scad_obj, 'filename.scad', '$fn = 50') to increase the resolution of rendered curves like cylinders?

Update `scad_render_to_file` to forward `file_header` to `scad_render`, to maintain the interface of SolidPython.
@Exr0n
Copy link
Author

Exr0n commented Dec 15, 2022

There is one mention of $fn and segments in the readme, but I couldn't figure out how to use it.

@jeff-dh
Copy link
Owner

jeff-dh commented Dec 15, 2022

You can set the global $fn like this:

>>> from solid2 import *
>>> from solid2.extensions.greedy_scad_interface import set_global_fn
>>> 
>>> set_global_fn(72)
>>> cube() #test it
$fn = 72;
cube();

Take a look at the greedy_scad_interface there are more functions in there to manipulate global variables.

https://github.com/jeff-dh/SolidPython/blob/exp_solid/solid2/examples/17-greedy-scad-interface.py
https://github.com/jeff-dh/SolidPython/blob/exp_solid/solid2/extensions/greedy_scad_interface/scad_interface.py

@jeff-dh
Copy link
Owner

jeff-dh commented Dec 15, 2022

I though I -- at least wanted to -- completely wiped out the file_header parameter while refactoring that module, but apparently I didn't and ended up with an inconsistent api....

So, thx a lot for this issue and the corresponding fix!

============ back to global $fn ===========
Actually you don't need to explicitly import the greedy_scad_interface_extensions it's enabled by default, so calling set_global_fn is what you want.

And I see the issue concerning the docs. Since I consider the examples as docs, I guess the underlying issue is that this functions should not be mentioned the first time in the very last example.... I'll have a look at it, if you have any suggestion, let me know!

@jeff-dh jeff-dh merged commit 88598d0 into jeff-dh:exp_solid Dec 15, 2022
@jeff-dh
Copy link
Owner

jeff-dh commented Dec 15, 2022

fixed the docs issue, it's now mentioned in the very first example :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants