3 Commits

Author SHA1 Message Date
Jonathon Broughton a06c9023fc better mock Mesh
build and deploy Speckle functions / publish-automate-function-version (push) Has been cancelled
2023-11-13 03:37:59 +00:00
Jonathon Broughton 4bcfe2cb2d mypymesh mock
build and deploy Speckle functions / publish-automate-function-version (push) Has been cancelled
2023-11-13 03:32:35 +00:00
Jonathon Broughton 4f32286a9b trying a poetry install pymesh pre install
build and deploy Speckle functions / publish-automate-function-version (push) Has been cancelled
2023-11-13 03:16:49 +00:00
5 changed files with 1310 additions and 22 deletions
+8 -5
View File
@@ -1,7 +1,12 @@
from concurrent.futures import ProcessPoolExecutor, as_completed
from typing import List, Tuple, Any, Optional
import pymesh
try:
import pymesh
except ImportError:
from Geometry.mocks import mypymesh
pymesh = mypymesh
from speckle_automate import AutomationContext
@@ -41,7 +46,7 @@ def detect_clashes_old(
continue
intersection = pymesh.boolean(
ref_pymesh, latest_pymesh, operation="intersection"
latest_pymesh, operation="intersection"
)
if (
@@ -77,9 +82,7 @@ def check_for_clash(
if not ref_pymesh or not latest_pymesh:
continue
intersection = pymesh.boolean(
ref_pymesh, latest_pymesh, operation="intersection"
)
intersection = pymesh.boolean(latest_pymesh, operation="intersection")
if intersection and intersection.volume > 0:
severity = intersection.volume / min(
ref_pymesh.volume, latest_pymesh.volume
+7 -11
View File
@@ -1,19 +1,15 @@
from typing import Union, Type, TYPE_CHECKING
from typing import Union, Type
try:
import pymesh
except ImportError:
from Geometry.mocks import mypymesh
import pymesh
pymesh = mypymesh
import trimesh
class MockPyMesh:
def __init__(self, vertices, faces):
self.vertices = vertices or []
self.faces = faces or []
def boolean(self, other, operation):
return MockPyMesh([], [])
from Geometry.helpers import triangulate_face
def trimesh_to_pymesh(mesh: trimesh.Trimesh) -> pymesh.Mesh:
+13
View File
@@ -0,0 +1,13 @@
class mypymesh:
class Mesh:
def __init__(self, vertices, faces):
self.vertices = vertices
self.faces = faces
@property
def volume(self):
return 0
@staticmethod
def boolean(_other, _operation):
return mypymesh.Mesh([], [])
Generated
+1277
View File
File diff suppressed because it is too large Load Diff
+5 -6
View File
@@ -9,7 +9,6 @@ readme = "README.md"
python = "^3.10"
specklepy = "2.17.11"
trimesh = "^4.0.4"
pymesh = {git = "https://github.com/PyMesh/PyMesh.git"}
[tool.poetry.group.dev.dependencies]
black = "^23.3.0"
@@ -23,11 +22,11 @@ build-backend = "poetry.core.masonry.api"
[tool.ruff]
select = [
"E", # pycodestyle
"F", # pyflakes
"UP", # pyupgrade
"D", # pydocstyle
"I", # isort
"E", # pycodestyle
"F", # pyflakes
"UP", # pyupgrade
"D", # pydocstyle
"I", # isort
]
[tool.ruff.pydocstyle]