Add script to generate 3D models for TO-92 #120
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I already had the situation several times that I wanted to generate a 3D model for a package which was created by hand and without the intention to also generate the package because it's just a single (or a few) package not worth to generate. One example is TO-92, but there are many more such packages.
However, so far this repository contains only generators creating the complete library elements. So I wonder how we should handle the case where we only want to generate the 3D model. Initially I started with a new top-level directory called "3d" which would contain pure 3D generators, and a corresponding "out" directory. However, I think this doesn't work because the dependency
cadquery_helpers.py
is in the top level directory ("ImportError: attempted relative import with no known parent package").So for now I came up with just adding the new script
generate_to92.py
and its output directoryout_3d
to the root directory. Maybe that's actually not that bad since those scripts might some day be extend to also generate the whole package, then they are already at the correct location.Note that we cannot reuse the existing
out
directory for plain 3D models because theout
directory is intended to be copied 1:1 into a LibrePCB workspace, while the 3D models need to be imported manually into the LibrePCB library editor. So the new script just writes some 3D models intoout_3d/to92/
and these STEP models then need to be manually loaded into LibrePCB.Theoretically we don't need to store these scripts (because no UUIDs are generated, no cache is needed) but of course it would be nice to still have the source of the 3D models stored somewhere.
Any opinions/ideas welcome!
Btw, here the generated models: