-
Notifications
You must be signed in to change notification settings - Fork 2
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
Make module for npm-based package #1
Comments
export OPENSCADPATH=scad_modules then run openscad from same terminal or add this line to ~/.profile file
For details on use, include and library dirs see here: for example, we have 2 modules installed in project/scad_modules dir example scad design: Example design uses gearbox module and gearbox module depends on pd-gears module. Use gearbox module inside gearbox-demo.scad like this: use <gearbox/gearbox.scad> Also inside gearbox module use pd-gears dependance module in the same way: project/scad_modules/gearbox/gearbox.scad use <pd-gears/pd-gears.scad> This would also work |
Looks like we can't replace node_modules with scad_modules with default npm without patching it https://docs.npmjs.com/files/folders So, will have to install openscad modules to node_modules as well
|
add to either ~~~/.profile~~ (will not work with ~/.profile) ~/.bashrc or ~/.bash_aliases:
check on new login
|
|
to generate test package before publishing to registry
Then check out pd-gears-2.0.0.tgz Publish to registry:
check in new project dir:
|
only works when start OpenSCAD from console, unfortunately when start from console, then check help > info (import works):
when open .scad file from file manager (import does NOT work):
so, it does not use OPENSCADPATH variablle dynamically, it just takes OPENSCADPATH at start and puts it together with current dir (in case, if the path is relative, most likely). When open .scad file from file manager current dir by some reason is set to $HOME |
submitted feature request here |
And another issue here https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Libraries
So, even if we include gearbox.scad like "gearbox/gearbox.scad" from "node_modules" relatively to current project, and then gearbox.scad would also include pd-gears.scad with relative path like "pd-gears/pd-gears.scad" or even like "node_modues/pd-gears/pd-gears.scad", it won't see it, because it will not go down to the root module and would look pd-gears some where near node_modules/gearbox/ or in global libraries. |
pull request to handle all above: |
Hi, For example (extended by MCAD): We have the following dependencies (in this example MCAD is used with the same version for all modules, if not, NPM would installs it nested and hence the problem itself would not be present) and at least the following files/libraries are present:
NPM will recognize that MCAD is used by multiple modules of the whole project and installs it flat (on top level of node_modules) folder. |
Unfortunately, this only works when start OpenSCAD from console from project dir. Will not work when double-click on .scad file in file manager. That's because currently OpenSCAD always simply creates absolute paths from relative paths in OPENSCADPATH add_librarydir(fs::absolute(fs::path(boost::copy_range<std::string>(*it))).string()); See this comment: I have opened issue with more details on this, please, take a look |
offtopic side-note for openscad build instructions - to change install dir before build do:
|
Convert project to modulle compatible with OpenSCAD-Modules OpenSCAD module manager experimental project (based on NPM) and publish to openscad-modules registry.
https://github.com/RobertFach/Openscad-Modules
http://forum.openscad.org/A-Package-Manager-for-OpenSCAD-td23465.html
example project
https://github.com/RobertFach/openscad-fractals/blob/master/package.json
For reference - another experimental module manager project for OpenSCAD based on Ruby gems
https://github.com/lostapathy/scad_bundler#draft-conventions
The text was updated successfully, but these errors were encountered: