Skip to content

Commit

Permalink
Merge pull request #34 from fusion-energy/develop
Browse files Browse the repository at this point in the history
update package making
  • Loading branch information
shimwell authored Nov 1, 2022
2 parents 8109c6f + bbe3910 commit d613ada
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 54 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/conda-build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: conda-build-test

on:
workflow_dispatch:
pull_request:
branches:
- develop
- main

jobs:
build:
runs-on: ubuntu-latest
container: continuumio/miniconda3:4.10.3

steps:
- uses: actions/checkout@v2

- name: Set up conda
run: |
apt-get --allow-releaseinfo-change update
apt install -y libgl1-mesa-glx
conda install -y anaconda-client conda-build
conda config --set anaconda_upload no
- name: Build and test
env:
GIT_DESCRIBE_TAG: 0.1
run: |
conda build conda -c cadquery -c conda-forge --config-file conda/conda_build_config.yaml
6 changes: 3 additions & 3 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ source:

build:
number: 0
script: python setup.py install --single-version-externally-managed --record=record.txt
script: python -m pip install --no-deps --ignore-installed .

requirements:
build:
- python {{ python }}
- setuptools>=46.4.0
- setuptools_scm>=6.3.1
- setuptools>=65.4.0
- setuptools_scm>=7.0.5
run:
- python {{ python }}
- cadquery {{ cadquery }}
Expand Down
42 changes: 36 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,40 @@
[build-system]
requires = [
"setuptools >= 46.4.0",
"wheel",
"setuptools_scm[toml] >= 6.3.1",
]
requires = ["setuptools >= 65.4.0", "setuptools_scm[toml]>=7.0.5"]
build-backend = "setuptools.build_meta"

[project]
name = "brep_part_finder"
authors = [
{ name="Jonathan Shimwell", email="[email protected]" },
]
license = {file = "LICENSE.txt"}
description = "A Python package to identify the part ID number in Brep format CAD files"
readme = "README.md"
requires-python = ">=3.8"
keywords = ["brep", "geometry", "part", "find", "identify", "volume"]
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
dependencies = [
"numpy>=1.21.1",
]
dynamic = ["version"]


[tool.setuptools_scm]
write_to = "brep_part_finder/_version.py"
write_to = "src/brep_part_finder/_version.py"


[project.optional-dependencies]
tests = [
"pytest",
]

[project.urls]
"Homepage" = "https://github.com/fusion-energy/brep_part_finder"
"Bug Tracker" = "https://github.com/fusion-energy/brep_part_finder/issues"

[tool.setuptools]
package-dir = {"" = "src"}
38 changes: 0 additions & 38 deletions setup.cfg

This file was deleted.

4 changes: 0 additions & 4 deletions setup.py

This file was deleted.

File renamed without changes.
34 changes: 31 additions & 3 deletions brep_part_finder/core.py → src/brep_part_finder/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ def get_matching_part_id(
center: a tuple of x,y,z coordinates
bounding_box: a tuple of two coordinates where the coordinates are the
lower left and upper right corners of the bounding box.
volume_atol: absolute tolerance acceptable on the volume comparision
center_atol: absolute tolerance acceptable on the center comparision
bounding_box_atol: absolute tolerance acceptable on the bounding box comparision
volume_atol: absolute tolerance acceptable on the volume comparison
center_atol: absolute tolerance acceptable on the center comparison
bounding_box_atol: absolute tolerance acceptable on the bounding box comparison
"""

part_ids_matching = {}
Expand Down Expand Up @@ -193,6 +193,13 @@ def get_matching_part_id(
print(" volume_atol", volume_atol)
print(" center_atol", center_atol)
print(" bounding_box_atol", bounding_box_atol)
print("\nbrep criteria are:")
for key, value in brep_part_properties.items():
print(f" {key}")
for key2, value2 in value.items():
print(f" {key2}, {value2}")

if lists_of_matching_parts_separate == []:
raise ValueError("No matching part found")

lists_of_matching_parts = list(
Expand All @@ -201,6 +208,27 @@ def get_matching_part_id(

if len(lists_of_matching_parts) == 0:
warnings.warn("No single part found that matches all criteria")
print("search criteria are:")
print(" volume", volume)
print(" center_x", center_x)
print(" center_y", center_y)
print(" center_z", center_z)
print(" bounding_box_xmin", bounding_box_xmin)
print(" bounding_box_ymin", bounding_box_ymin)
print(" bounding_box_zmin", bounding_box_zmin)
print(" bounding_box_xmax", bounding_box_xmax)
print(" bounding_box_ymax", bounding_box_ymax)
print(" bounding_box_zmax", bounding_box_zmax)
print(" with tolerances")
print(" volume_atol", volume_atol)
print(" center_atol", center_atol)
print(" bounding_box_atol", bounding_box_atol)
print("\nbrep criteria are:")
for key, value in brep_part_properties.items():
print(f" {key}")
for key2, value2 in value.items():
print(f" {key2}, {value2}")
raise ValueError("No matching part found")

return lists_of_matching_parts

Expand Down

0 comments on commit d613ada

Please sign in to comment.