brep-part-finder
A Python package to identify the part ID number in Brep format CAD files
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.7%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
A Python package to identify the part ID number in Brep format CAD files
Basic Info
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
- Releases: 7
Topics
Metadata Files
README.md
Brep-part-finder is able to search within a Brep file for parts that match user specified properties such as volume, center of mass and bounding box. The matching ID number of the part will be returned if found.
This is useful because the order or parts changes when exporting to Brep files. This part finder package helps keep track of meta data within a workflow. The neutronics workflow makes use of this package to help correctly identify materials when making DAGMC h5m files from Paramak geometries for neutronics simulations.
Installation (Conda)
The installation instructions below create a new conda enviroment and install
bash
conda create --name bpf_env
conda activate bpf_env
conda install -c cadquery -c fusion-energy -c conda-forge brep_part_finder
Installation (Conda + Pip)
The installation instructions below create a new conda enviroment, install CadQuery and install this package. The master branch of CadQuery is currently required as latest features are required. When CadQuery version 2.2 is released then install can target a stable version.
bash
conda create --name bpf_env
conda activate bpf_env
conda install -c cadquery -c conda-forge cadquery=master
pip install brep_part_finder
Usage
To view the properties of the parts in the Brep file the first stage is to import the package and make use of the get_part_properties_from_file function.
```python import breppartfinder as bpf
mybreppartproperties = bpf.getpartpropertiesfromfile('mybrep_file.brep')
print(mybreppart_properties)
{ 1: { 'Center.x': 0, 'Center.y': 0, 'Center.z': 0, 'Volume': 10, 'BoundingBox.xmin': -20, 'BoundingBox.ymin': -20, 'BoundingBox.zmin': -20, 'BoundingBox.xmax': 20, 'BoundingBox.ymax': 20, 'BoundingBox.zmax': 20 }, 2: { 'Center.x': 5, 'Center.y': 6, 'Center.z': 7, 'Volume': 10, 'BoundingBox.xmin': -40.0, 'BoundingBox.ymin': -40.0, 'BoundingBox.zmin': -40.0, 'BoundingBox.xmax': 40.0, 'BoundingBox.ymax': 40.0, 'BoundingBox.zmax': 40.0 }, 3: { 'Center.x': 0, 'Center.y': 0, 'Center.z': 0, 'Volume': 10, 'BoundingBox.xmin': -10, 'BoundingBox.ymin': -10, 'BoundingBox.zmin': -10, 'BoundingBox.xmax': 10, 'BoundingBox.ymax': 10, 'BoundingBox.zmax': 10 } } ```
From the above dictionary it is possible to identify parts from their central of mass (x,y,z coordinate), volume and bounding box. This can be done manually or one can pass the required properties into the find_part_id or find_part_ids functions to identify the part numbers of solids automatically.
A minimal example that finds the part id numbers with matching volumes ```python import breppartfinder as bpf
mybreppartproperties = bpf.getpartpropertiesfromfile('mybrepfile.brep') partid = bpf.findpartid( breppartproperties=mybreppart_properties, volume=10,
)
print(part_id)
[1, 3, 4] ```
The above example found 3 part ids with matching volumes.
The follow example also specifies the center of mass which helps narrow down the part ids to just to matching parts. ```python import breppartfinder as bpf
mybreppartproperties = bpf.getpartpropertiesfromfile('mybrepfile.brep') partid = bpf.findpartid( breppartproperties=mybreppartproperties, volume=10, centerof_mass=(0,0,0), )
print(part_id)
[1, 3] ```
In the this example the bounding box of the part has also been specified and these three pieces of information are enough to find one part that matches all three criteria. ```python import breppartfinder as bpf
mybreppartproperties = bpf.getpartpropertiesfromfile('mybrepfile.brep') partid = bpf.findpartid( breppartproperties=mybreppartproperties, volume=10, centerofmass=(0,0,0), boundingbox = [[10,10,10], [-10,-10,10]] )
print(part_id)
[3] ```
For more usage examples see the examples folder in this repository
Combining with Paramak
When reactor models made with Paramak are exported to Brep files it is likely that the order of parts in the Brep file does not match the order of parts within the Paramak object. Therefore this program is useful when identifying parts in the Brep file. See the paramak_example file in the examples folder of this repository.
Owner
- Name: Fusion Energy
- Login: fusion-energy
- Kind: organization
- Repositories: 29
- Profile: https://github.com/fusion-energy
A collection of software projects related to fusion energy
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - family-names: "Shimwell" given-names: "Jonathan" orcid: "https://orcid.org/0000-0001-6909-0946" title: "BRep_part_finder - A Python package to identify the part ID number in Brep format CAD files." version: 0.4.4 date-released: 2022-9-8 url: "https://github.com/fusion-energy/brep_part_finder"
GitHub Events
Total
Last Year
Committers
Last synced: almost 3 years ago
All Time
- Total Commits: 100
- Total Committers: 3
- Avg Commits per committer: 33.333
- Development Distribution Score (DDS): 0.12
Top Committers
| Name | Commits | |
|---|---|---|
| Jonathan Shimwell | m****l@j****m | 88 |
| shimwell | s****l@u****m | 11 |
| Jonathan Shimwell | d****l@g****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 4
- Total pull requests: 33
- Average time to close issues: 1 day
- Average time to close pull requests: about 24 hours
- Total issue authors: 2
- Total pull request authors: 1
- Average comments per issue: 2.0
- Average comments per pull request: 0.03
- Merged pull requests: 33
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- shimwell (3)
- Adambar24 (1)
Pull Request Authors
- shimwell (33)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 810 last-month
- Total dependent packages: 3
- Total dependent repositories: 1
- Total versions: 11
- Total maintainers: 2
pypi.org: brep-part-finder
A Python package to identify the part ID number in Brep format CAD files
- Homepage: https://github.com/fusion-energy/brep_part_finder
- Documentation: https://brep-part-finder.readthedocs.io/
- License: MIT License Copyright (c) 2021-2022 Fusion Energy Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
Latest release: 0.5.2
published about 3 years ago
Rankings
Maintainers (2)
Dependencies
- actions/checkout v2 composite
- actions/checkout v2 composite
- actions/setup-python v2 composite
- stefanzweifel/git-auto-commit-action v4 composite
- actions/checkout v2 composite
- actions/checkout v2 composite
- actions/checkout v2 composite
- actions/setup-python v2 composite
- numpy >=1.21.1
