BD - Beams and bars
Construction beams and bars library for build123d
Links
Community:
Usage
There is no pypi module for now; use the git repository. If you need a specific reference, append it to the repository
url with @<ref>
.
This library don't use the pypi version of build123d, as we rely on unreleased features. Check pyproject.toml
to see the git reference.
Pip:
Or, with requirements.txt:
and in a pyproject.yml:
dependencies= [
#...
"bd_beams_and_bars @ git+https://gitlab.com/experimentslabs/3d/bd_beams_and_bars.git",
]
Then:
from bd_beams_and_bars.profiles.flat_bars import (
Section, # Makes 2D faces
Bar, # Makes 3D parts
# Check the docs or sources for available standards and variants
Standards,
Definition, # Profile definition, only for custom profiles
)
# With the standards
sketch = Section(Standards.FL.FL_20x10)
part = Bar(Standards.LFL.LFL_160x5, 500)
# With custom values:
sketch = Section(Definition(w=43, h=9))
part = Bar(Definition(w=43, h=9), 500)
Notes
We provide round tubes sections and bars. Depending on what you want to do, you may consider to use bd_warehouse, which have classes to generate and work with pipes.
What about a v1?
My goals for a stable version are:
- A bit of every type of profile/sheets present in the catalogues of my local reseller (bars, beams, sheets, grids, fencing, gratings,...). This is arbitrary but allows for various kind of drawings
- A naming convention for all the different standards/variants of easy, understandable (and short) names
- Unit tests
Contributing
Bug reports and pull requests are welcome on the issue tracker at GitLab. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
Setup
First of all, clone the repository.
The following steps creates a Python virtual environment to develop this project. If you already have an environment for Build123d projects, it may be enough.
Let's just say the project successfully builds with the Build123d version
specified in requirements.txt
.
- Create a Python environment:
- Activate the env:
- Install dependencies:
Now, code :)
There is a file, dev.py
which has a lot of boilerplate to help in developing specific parts of the library. Feel free
to edit it if needed. It relies on show_object
and other methods from ocp_vscode
, so either edit the code in VSCodium
with the right plugin, or start the viewer server manually (check the section right after).
OCP VSCode without VSCodium
To use ocp_vscode to develop the parts, but without VSCodium:
- Manually start the server
- Manually render the files or use a watcher
python some_part.py # One specific file
# Or add a watcher on all .py files and executes "dev.py" on changes
find . -type f -name "*.py" | entr -s "clear && python dev.py"
Feel free to change dev.py during the development, and commit your pertinent changes
Tools
Use diff3d (included in the .[tools]
dependencies) to compare generated models:
Linting and formatting
To check all the code:
To fix what is fixable automatically:
Checking licenses
To help ensuring the project has a valid license, run licensecheck
; it will
compare the license with the ones of the dependencies.
You only have to run it when dependencies changes.
Testing
Run unit tests with:
Documentation
Documentation is generated in CI. To generate it locally:
# Copies markdown files and generate pictures; there is no need to run it
# everytime.
scripts/prepare_documentation.sh
# Serve documentation locally
poe docs-serve
# Open your browser at the link given by the server.
License
This library is available as open source under the terms of the GPL v3 License.
Code of Conduct
Everyone interacting in this project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
Final notes
This is my first Python library; improvements are welcome.