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
Enable usage of local use/include statements #3
Conversation
Openscad enables code re-use via the include and use methods. https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Include_Statement This change generates the temporary file for the scad buffer in the default-directory so local files can be found via use or include statements during preview or flymake operations.
Thanks, good point. I am not fond of creating files in the working directory, but it seems there is no other way, since openscad does not have a search path command line option. |
Currently only the environment variable exists, but that sounds like a useful feature request. |
Thanks for the change. I agree that local temporary files are not great, but it seems the simplest approach. |
Can you please point me to the documentation? We should better change this to instead add the default-directory to the environment variable.
It is not great to go with the simplest approach. I will revert and we can hopefully use the environment variables. |
It's mentioned in the Library section: It's intended to work like the usual PATH variables, providing a list of root directories for relative file lookup. |
Yes, this is a better approach - I missed the environment variable in my googling of the topic. |
@t-paul Thanks! I only looked at https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Include_Statement and it wasn't mentioned there. @mgsb Would you like to prepare an improved PR which uses |
Ah, good point, I've added a short note mentioning the variable to that page. |
Ok, I'll give it a try. I don't see a command-line option for openscad, so I'll use process-environment. |
In testing this, I found another issue with copying the source scad file. Import statements with relative file paths https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Importing_Geometry are not found when the source is moved. There does not appear to be a search path for these statements. |
On 3/16/23 20:46, Mark Grosen wrote:
Why is it necessary to make a copy of the source? Just use the original
file associated with the buffer and "compile" it seems like it would work.
The buffer has not necessarily been saved yet.
|
Ok, I remember - the preview is updated periodically based on buffer changes - not file changes/saves. |
Openscad enables code re-use via the include and use methods. https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Include_Statement This change generates the temporary file for the scad buffer in the default-directory so local files can be found via use or include statements during preview or flymake operations.