diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..2948c13 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,36 @@ +# syntax=docker/dockerfile:1.4 +FROM --platform=linux/amd64 python:3.9 as base + +RUN python -m pip install --upgrade pip + +FROM base as dev + +# Insgtall OCC requirements +RUN apt-get update +RUN apt-get install -y ffmpeg libsm6 libxext6 + +# Install conda +RUN mkdir -p ~/miniconda3 && \ + wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh && \ + bash ~/miniconda3/miniconda.sh -b -u -p /miniconda3 && \ + rm -rf ~/miniconda3/miniconda.sh && \ + /miniconda3/bin/conda init bash + +ARG PROJ_DIR=/proj +ARG PIP_CACHE=/root/.cache/pip +WORKDIR ${PROJ_DIR} + +# Create conda environment +COPY environment.yml . +RUN --mount=type=cache,target=/miniconda3/pkgs,id=conda \ + /miniconda3/bin/conda env create -f environment.yml +SHELL ["conda", "run", "--no-capture-output", "-n", "occwl_dev", "/bin/bash", "-c"] + +# Install Python dependencies +# COPY setup.py . +# RUN mkdir -p ${PROJ_DIR}/src +# RUN --mount=type=cache,target=${PIP_CACHE},id=pip \ +# /miniconda3/bin/conda run -n occwl_dev python -m \ +# pip install -v --cache-dir ${PIP_CACHE} -e . + +ENTRYPOINT [ "/bin/bash", "-c" ] \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..e0baec5 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,47 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/alpine +{ + "name": "Alpine", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + // "image": "occ_dev:7.8.1", + "build": { + // this requires ../docker/Dockerfile to be built to brep_directgen:dev tag. + "dockerfile": "Dockerfile", + "context": ".." + }, + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "uname -a", + // Configure tool-specific properties. + "customizations": { + "vscode": { + "extensions": [ + "charliermarsh.ruff", + "eamodio.gitlens", + "github.vscode-pull-request-github", + "ms-python.debugpy", + "ms-python.python", + "ms-toolsai.jupyter", + "streetsidesoftware.code-spell-checker", + "ms-azuretools.vscode-docker", + "github.copilot" + ], + "settings": { + "extensions.verifySignature": false, + "[python]": { + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.fixAll": "explicit", + "source.organizeImports": "explicit" + }, + "editor.defaultFormatter": "charliermarsh.ruff" + } + } + } + }, + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} \ No newline at end of file diff --git a/README.md b/README.md index a4243c4..bfb9ca1 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ OCCWL is a simple, lightweight Pythonic wrapper around pythonocc (python binding ## Installing our conda package ``` -conda create --name=myoccwlenv python=3.7 +conda create --name=myoccwlenv python=3.9 source activate myoccwlenv conda install -c lambouj -c conda-forge occwl ``` diff --git a/ci/conda/meta.yaml b/ci/conda/meta.yaml index 464f0dd..a5ce55e 100644 --- a/ci/conda/meta.yaml +++ b/ci/conda/meta.yaml @@ -1,5 +1,5 @@ {% set name = "occwl" %} -{% set version = "2.1.0" %} +{% set version = "3.0.0" %} package: name: "{{ name|lower }}" @@ -20,7 +20,7 @@ requirements: - setuptools run: - python >=3.7 - - pythonocc-core =7.5.1 + - pythonocc-core =7.8.1 - numpy - pyqt >=5 - wxpython >=4 diff --git a/environment.yml b/environment.yml index 0cc2c59..b4457d6 100644 --- a/environment.yml +++ b/environment.yml @@ -6,7 +6,7 @@ channels: dependencies: - python=3.9 - numpy - - pythonocc-core=7.5.1 + - pythonocc-core=7.8.1 - networkx - wxPython - pydeprecate \ No newline at end of file diff --git a/setup.py b/setup.py index 013abb2..16b3a48 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setuptools.setup( name="occwl", # package name - version="2.1.0", + version="3.0.0", author="Pradeep Kumar Jayaraman, Joseph G. Lambourne", author_email="pradeep.kumar.jayaraman@autodesk.com, joseph.lambourne@autodesk.com", description="Lightweight Pythonic wrapper around pythonocc", diff --git a/src/occwl/base.py b/src/occwl/base.py index b49f621..eb772c6 100644 --- a/src/occwl/base.py +++ b/src/occwl/base.py @@ -1,20 +1,13 @@ import numpy as np -from OCC.Core.gp import gp_Pnt, gp_Dir, gp_Pnt2d, gp_Ax2 from OCC.Core.Bnd import Bnd_Box -from OCC.Core.BRepBndLib import brepbndlib_Add, brepbndlib_AddOptimal -from OCC.Extend import TopologyUtils -from OCC.Core.BRepGProp import ( - brepgprop_LinearProperties, - brepgprop_SurfaceProperties, - brepgprop_VolumeProperties, -) +from OCC.Core.BRepBndLib import brepbndlib +from OCC.Core.BRepGProp import brepgprop from OCC.Core.BRepMesh import BRepMesh_IncrementalMesh from OCC.Core.GProp import GProp_GProps -from OCC.Core.gp import gp_Pnt, gp_Dir, gp_Ax1, gp_Vec, gp_Trsf +from OCC.Core.gp import gp_Pnt, gp_Ax1, gp_Vec, gp_Trsf from OCC.Core.ShapeUpgrade import ShapeUpgrade_ShapeDivideClosed from OCC.Core.ShapeUpgrade import ShapeUpgrade_ShapeDivideClosedEdges -from OCC.Core.BRepBuilderAPI import BRepBuilderAPI_Transform class VertexContainerMixin: @@ -498,7 +491,7 @@ def area(self): float: Area """ geometry_properties = GProp_GProps() - brepgprop_SurfaceProperties(self.topods_shape(), geometry_properties) + brepgprop.SurfaceProperties(self.topods_shape(), geometry_properties) return geometry_properties.Mass() @@ -517,7 +510,7 @@ def volume(self, tolerance=1e-9): float: Volume """ props = GProp_GProps() - brepgprop_VolumeProperties(self.topods_shape(), props, tolerance) + brepgprop.VolumeProperties(self.topods_shape(), props, tolerance) return props.Mass() def center_of_mass(self, tolerance=1e-9): @@ -532,7 +525,7 @@ def center_of_mass(self, tolerance=1e-9): """ from occwl.geometry import geom_utils props = GProp_GProps() - brepgprop_VolumeProperties(self.topods_shape(), props, tolerance) + brepgprop.VolumeProperties(self.topods_shape(), props, tolerance) com = props.CentreOfMass() return geom_utils.gp_to_numpy(com) @@ -550,7 +543,7 @@ def moment_of_inertia(self, point, direction, tolerance=1e-9): """ from occwl.geometry import geom_utils props = GProp_GProps() - brepgprop_VolumeProperties(self.topods_shape(), props, tolerance) + brepgprop.VolumeProperties(self.topods_shape(), props, tolerance) axis = gp_Ax1( geom_utils.numpy_to_gp(point), geom_utils.numpy_to_gp_dir(direction) ) @@ -571,7 +564,7 @@ def box(self): """ from occwl.geometry import geom_utils b = Bnd_Box() - brepbndlib_Add(self.topods_shape(), b) + brepbndlib.Add(self.topods_shape(), b) return geom_utils.box_to_geometry(b) def exact_box(self, use_shapetolerance=False): @@ -588,7 +581,7 @@ def exact_box(self, use_shapetolerance=False): from occwl.geometry import geom_utils b = Bnd_Box() use_triangulation = True - brepbndlib_AddOptimal(self.topods_shape(), b, use_triangulation, use_shapetolerance) + brepbndlib.AddOptimal(self.topods_shape(), b, use_triangulation, use_shapetolerance) return geom_utils.box_to_geometry(b) def scale_to_box(self, box_side, copy=True): diff --git a/src/occwl/batch/render_multiview.py b/src/occwl/batch/render_multiview.py index 7a35d4a..d7187bb 100644 --- a/src/occwl/batch/render_multiview.py +++ b/src/occwl/batch/render_multiview.py @@ -6,9 +6,6 @@ from multiprocessing import Pool from occwl.compound import Compound from occwl.viewer import OffscreenRenderer -from OCC.Core.gp import gp_Dir, gp_Vec -from OCC.Core.V3d import V3d_DirectionalLight -from OCC.Core.Quantity import Quantity_Color, Quantity_TOC_RGB, Quantity_NOC_WHITE from tqdm import tqdm diff --git a/src/occwl/edge.py b/src/occwl/edge.py index 9dbd187..b14e5ed 100644 --- a/src/occwl/edge.py +++ b/src/occwl/edge.py @@ -1,9 +1,9 @@ import numpy as np -from OCC.Core.gp import gp_Pnt, gp_Dir, gp_Vec, gp_Pnt2d, gp_Ax2, gp_Circ -from OCC.Core.BRep import BRep_Tool, BRep_Tool_Curve, BRep_Tool_Continuity +from OCC.Core.gp import gp_Pnt, gp_Vec, gp_Ax2, gp_Circ +from OCC.Core.BRep import BRep_Tool from OCC.Core.BRepAdaptor import BRepAdaptor_Curve -from OCC.Core.BRepGProp import brepgprop_LinearProperties +from OCC.Core.BRepGProp import brepgprop from OCC.Core.GC import GC_MakeArcOfCircle from OCC.Core.GProp import GProp_GProps from OCC.Core.GeomAbs import ( @@ -17,11 +17,7 @@ GeomAbs_OffsetCurve, GeomAbs_OtherCurve, ) -from OCC.Core.TopAbs import TopAbs_REVERSED -from OCC.Extend import TopologyUtils from OCC.Core.TopoDS import TopoDS_Edge -from OCC.Core.GCPnts import GCPnts_AbscissaPoint -from OCC.Core.BRepAdaptor import BRepAdaptor_Curve from OCC.Core.ShapeAnalysis import ShapeAnalysis_Edge from OCC.Core.BRepBuilderAPI import BRepBuilderAPI_MakeEdge from OCC.Core.GCPnts import ( @@ -35,8 +31,6 @@ from occwl.geometry.interval import Interval from occwl.shape import Shape from occwl.base import VertexContainerMixin, BoundingBoxMixin -from deprecate import deprecated -import logging class Edge(Shape, VertexContainerMixin, BoundingBoxMixin): @@ -217,7 +211,7 @@ def length(self): if not self.has_curve(): return 0.0 geometry_properties = GProp_GProps() - brepgprop_LinearProperties(self.topods_shape(), geometry_properties) + brepgprop.LinearProperties(self.topods_shape(), geometry_properties) return geometry_properties.Mass() def curve(self): @@ -227,7 +221,7 @@ def curve(self): Returns: OCC.Geom.Handle_Geom_Curve: Interface to all curve geometry """ - return BRep_Tool_Curve(self.topods_shape())[0] + return BRep_Tool.Curve(self.topods_shape())[0] def specific_curve(self): """ @@ -278,7 +272,7 @@ def u_bounds(self): if not self.has_curve(): # Return an empty interval return Interval() - _, umin, umax = BRep_Tool_Curve(self.topods_shape()) + _, umin, umax = BRep_Tool.Curve(self.topods_shape()) return Interval(umin, umax) def reversed_edge(self): @@ -363,7 +357,7 @@ def continuity(self, face1, face2): Returns: GeomAbs_Shape: enum describing the continuity order """ - return BRep_Tool_Continuity( + return BRep_Tool.Continuity( self.topods_shape(), face1.topods_shape(), face2.topods_shape() ) diff --git a/src/occwl/edge_data_extractor.py b/src/occwl/edge_data_extractor.py index 7b1c6b1..8970537 100644 --- a/src/occwl/edge_data_extractor.py +++ b/src/occwl/edge_data_extractor.py @@ -7,13 +7,11 @@ import numpy as np # OCC -from OCC.Core.BRepAdaptor import BRepAdaptor_Curve2d, BRepAdaptor_Surface -from OCC.Core.gp import gp_Pnt2d, gp_Identity +from OCC.Core.BRepAdaptor import BRepAdaptor_Curve2d +from OCC.Core.gp import gp_Pnt2d # occwl -from occwl.geometry.interval import Interval from occwl.geometry.arc_length_param_finder import ArcLengthParamFinder -import occwl.geometry.geom_utils as geom_utils class EdgeConvexity(Enum): CONCAVE = 1 diff --git a/src/occwl/face.py b/src/occwl/face.py index 17d9c90..5d07308 100644 --- a/src/occwl/face.py +++ b/src/occwl/face.py @@ -1,13 +1,10 @@ -import logging - import numpy as np -from deprecate import deprecated -from OCC.Core.BRep import BRep_Tool, BRep_Tool_Surface +from OCC.Core.BRep import BRep_Tool from OCC.Core.BRepAdaptor import BRepAdaptor_Surface from OCC.Core.BRepBuilderAPI import BRepBuilderAPI_MakeFace from OCC.Core.BRepFill import BRepFill_Filling from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakePrism -from OCC.Core.BRepTools import breptools_UVBounds +from OCC.Core.BRepTools import breptools from OCC.Core.BRepTopAdaptor import BRepTopAdaptor_FClass2d from OCC.Core.GeomAbs import (GeomAbs_BezierSurface, GeomAbs_BSplineSurface, GeomAbs_C0, GeomAbs_C1, GeomAbs_C2, GeomAbs_C3, @@ -17,9 +14,9 @@ GeomAbs_Sphere, GeomAbs_SurfaceOfExtrusion, GeomAbs_SurfaceOfRevolution, GeomAbs_Torus) from OCC.Core.GeomLProp import GeomLProp_SLProps -from OCC.Core.gp import gp_Dir, gp_Pnt, gp_Pnt2d, gp_TrsfForm +from OCC.Core.gp import gp_Dir, gp_Pnt, gp_Pnt2d from OCC.Core.ShapeAnalysis import ShapeAnalysis_Surface -from OCC.Core.TopAbs import TopAbs_IN, TopAbs_REVERSED +from OCC.Core.TopAbs import TopAbs_IN from OCC.Core.TopLoc import TopLoc_Location from OCC.Core.TopoDS import TopoDS_Face @@ -177,7 +174,7 @@ def surface(self): OCC.Geom.Handle_Geom_Surface: Interface to all surface geometry """ loc = TopLoc_Location() - surf = BRep_Tool_Surface(self.topods_shape(), loc) + surf = BRep_Tool.Surface(self.topods_shape(), loc) if not loc.IsIdentity(): tsf = loc.Transformation() np_tsf = geom_utils.to_numpy(tsf) @@ -240,7 +237,7 @@ def point(self, uv): np.ndarray: 3D Point """ loc = TopLoc_Location() - surf = BRep_Tool_Surface(self.topods_shape(), loc) + surf = BRep_Tool.Surface(self.topods_shape(), loc) pt = surf.Value(uv[0], uv[1]) pt = pt.Transformed(loc.Transformation()) return geom_utils.gp_to_numpy(pt) @@ -256,7 +253,7 @@ def tangent(self, uv): Pair of np.ndarray or None: 3D unit vectors """ loc = TopLoc_Location() - surf = BRep_Tool_Surface(self.topods_shape(), loc) + surf = BRep_Tool.Surface(self.topods_shape(), loc) dU, dV = gp_Dir(), gp_Dir() res = GeomLProp_SLProps(surf, uv[0], uv[1], 1, 1e-9) if res.IsTangentUDefined() and res.IsTangentVDefined(): @@ -277,7 +274,7 @@ def normal(self, uv): np.ndarray: 3D unit normal vector """ loc = TopLoc_Location() - surf = BRep_Tool_Surface(self.topods_shape(), loc) + surf = BRep_Tool.Surface(self.topods_shape(), loc) res = GeomLProp_SLProps(surf, uv[0], uv[1], 1, 1e-9) if not res.IsNormalDefined(): return (0, 0, 0) @@ -414,7 +411,7 @@ def uv_bounds(self): Returns: Box: UV-domain bounds """ - umin, umax, vmin, vmax = breptools_UVBounds(self.topods_shape()) + umin, umax, vmin, vmax = breptools.UVBounds(self.topods_shape()) bounds = Box(np.array([umin, vmin])) bounds.encompass_point(np.array([umax, vmax])) return bounds @@ -430,7 +427,7 @@ def point_to_parameter(self, pt): np.ndarray: UV-coordinate """ loc = TopLoc_Location() - surf = BRep_Tool_Surface(self.topods_shape(), loc) + surf = BRep_Tool.Surface(self.topods_shape(), loc) gp_pt = gp_Pnt(pt[0], pt[1], pt[2]) inv = loc.Transformation().Inverted() gp_pt.Transformed(inv) @@ -551,16 +548,14 @@ def get_triangles(self, return_normals=False): np.empty(shape=(0,3), dtype=np.int32) ) - vert_nodes = facing.Nodes() tri = facing.Triangles() - uv_nodes = facing.UVNodes() verts = [] normals = [] for i in range(1, facing.NbNodes() + 1): - vert = vert_nodes.Value(i).Transformed(location.Transformation()) + vert = facing.Node(i).Transformed(location.Transformation()) verts.append(np.array(list(vert.Coord()))) if return_normals: - uv = uv_nodes.Value(i).Coord() + uv = facing.UVNode(i).Coord() normal = self.normal(uv) normals.append(normal) diff --git a/src/occwl/jupyter_viewer.py b/src/occwl/jupyter_viewer.py index 311d60d..b6a8c68 100644 --- a/src/occwl/jupyter_viewer.py +++ b/src/occwl/jupyter_viewer.py @@ -1,10 +1,9 @@ import numpy as np -import math import sys import uuid -from typing import Any, Callable, List, Optional, Tuple -from OCC.Core.TopoDS import TopoDS_Vertex, TopoDS_Edge, TopoDS_Face, TopoDS_Shell, TopoDS_Solid +from typing import Optional, Tuple +from OCC.Core.TopoDS import TopoDS_Edge, TopoDS_Face from OCC.Display.WebGl.jupyter_renderer import JupyterRenderer @@ -12,12 +11,9 @@ from matplotlib.colors import Normalize from matplotlib.colors import rgb2hex import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid1 import make_axes_locatable -from occwl.vertex import Vertex from occwl.edge import Edge from occwl.face import Face -from occwl.solid import Solid # pythreejs try: diff --git a/src/occwl/shape.py b/src/occwl/shape.py index 70c4d1f..13c07f1 100644 --- a/src/occwl/shape.py +++ b/src/occwl/shape.py @@ -7,7 +7,6 @@ from OCC.Core.BRepExtrema import BRepExtrema_DistShapeShape from OCC.Core.BRepTools import BRepTools_ShapeSet from OCC.Core.Extrema import Extrema_ExtFlag_MIN -from OCC.Core.Message import Message_ProgressRange from OCC.Core.gp import gp_Ax1, gp_Trsf from OCC.Core.TopAbs import TopAbs_REVERSED from OCC.Core.TopLoc import TopLoc_Location diff --git a/src/occwl/solid.py b/src/occwl/solid.py index 81ac669..c4686a6 100644 --- a/src/occwl/solid.py +++ b/src/occwl/solid.py @@ -1,11 +1,9 @@ -import numpy as np - from OCC.Core.TopoDS import ( TopoDS_Solid, TopoDS_Compound, TopoDS_CompSolid, ) -from OCC.Core.gp import gp_Pnt, gp_Dir, gp_Pnt2d, gp_Ax2 +from OCC.Core.gp import gp_Ax2 import math from occwl.base import VertexContainerMixin, EdgeContainerMixin, \ WireContainerMixin, FaceContainerMixin, BottomUpFaceIterator, \ @@ -14,8 +12,6 @@ from occwl.geometry import geom_utils from occwl.shape import Shape -from deprecate import deprecated -import logging class Solid(Shape, VertexContainerMixin, EdgeContainerMixin, ShellContainerMixin, \ diff --git a/src/occwl/uvgrid.py b/src/occwl/uvgrid.py index 9d82a63..f9c16d4 100644 --- a/src/occwl/uvgrid.py +++ b/src/occwl/uvgrid.py @@ -1,8 +1,4 @@ import numpy as np -from OCC.Core.gp import gp_Identity - -from occwl.face import Face -from occwl.edge import Edge def _uvgrid_reverse_u(grid): diff --git a/src/occwl/vertex.py b/src/occwl/vertex.py index dba0670..da2f1b6 100644 --- a/src/occwl/vertex.py +++ b/src/occwl/vertex.py @@ -1,12 +1,9 @@ -from OCC.Core.gp import gp_Pnt, gp_Dir, gp_Pnt2d from OCC.Core.TopoDS import TopoDS_Vertex from OCC.Core.BRep import BRep_Tool from OCC.Core.BRepBuilderAPI import BRepBuilderAPI_MakeVertex -import logging from occwl.geometry import geom_utils from occwl.shape import Shape -from deprecate import deprecated class Vertex(Shape): diff --git a/src/occwl/viewer.py b/src/occwl/viewer.py index 9cbb73c..9e62351 100644 --- a/src/occwl/viewer.py +++ b/src/occwl/viewer.py @@ -1,8 +1,8 @@ from datetime import datetime -from typing import Any, Callable, List, Optional, Tuple +from typing import List, Optional, Tuple import numpy as np -from OCC.Core.AIS import AIS_Line, AIS_Point, AIS_Shaded, AIS_WireFrame, AIS_Axis +from OCC.Core.AIS import AIS_Line, AIS_Point, AIS_Shaded, AIS_WireFrame from OCC.Core.Aspect import ( Aspect_TOL_DASH, Aspect_TOL_DOT, @@ -19,7 +19,7 @@ Graphic3d_TOSM_FACET, Graphic3d_TOSM_FRAGMENT ) -from OCC.Core.gp import gp_Ax1, gp_Dir +from OCC.Core.gp import gp_Dir from OCC.Core.Geom import Geom_CartesianPoint, Geom_Line from OCC.Core.Prs3d import Prs3d_LineAspect, Prs3d_PointAspect from OCC.Core.Quantity import Quantity_Color, Quantity_TOC_RGB diff --git a/src/occwl/wire.py b/src/occwl/wire.py index da3329a..8b97328 100644 --- a/src/occwl/wire.py +++ b/src/occwl/wire.py @@ -5,8 +5,6 @@ from occwl.vertex import Vertex from occwl.shape import Shape -from deprecate import deprecated -import logging class Wire(Shape): diff --git a/tests/test_arc_length_param_finder.py b/tests/test_arc_length_param_finder.py index 5e15a6a..c7336b4 100644 --- a/tests/test_arc_length_param_finder.py +++ b/tests/test_arc_length_param_finder.py @@ -9,7 +9,6 @@ # occwl from occwl.geometry.interval import Interval -from occwl.edge_data_extractor import EdgeDataExtractor, EdgeConvexity from occwl.edge import Edge from occwl.geometry.arc_length_param_finder import ArcLengthParamFinder diff --git a/tests/test_box.py b/tests/test_box.py index 87932d3..ffb3dcd 100644 --- a/tests/test_box.py +++ b/tests/test_box.py @@ -1,5 +1,4 @@ # System -from pathlib import Path import numpy as np # OCC diff --git a/tests/test_compound.py b/tests/test_compound.py index 50d729c..776c22e 100644 --- a/tests/test_compound.py +++ b/tests/test_compound.py @@ -1,5 +1,4 @@ from occwl.compound import Compound -from occwl.io import load_single_compound_from_step # Test from tests.test_base import TestBase diff --git a/tests/test_convert_geometric_identity.py b/tests/test_convert_geometric_identity.py index d8d5020..40a8102 100644 --- a/tests/test_convert_geometric_identity.py +++ b/tests/test_convert_geometric_identity.py @@ -2,9 +2,6 @@ Test for convert_geometric_identity_transforms_to_identity() """ # System -import numpy as np -from pathlib import Path - from occwl.compound import Compound # Test diff --git a/tests/test_edge.py b/tests/test_edge.py index c73cdf2..fec51de 100644 --- a/tests/test_edge.py +++ b/tests/test_edge.py @@ -4,7 +4,7 @@ # Geometry from occwl.geometry.interval import Interval -from OCC.Core.gp import gp_XOY, gp_Pnt +from OCC.Core.gp import gp, gp_Pnt from OCC.Core.GC import GC_MakeSegment from OCC.Core.BRepBuilderAPI import BRepBuilderAPI_MakeEdge from OCC.Core.Geom import Geom_Circle @@ -71,7 +71,7 @@ def test_closed(self): def _test_closed_periodic(self): # Circle - circle = BRepBuilderAPI_MakeEdge(Geom_Circle(gp_XOY(), 1)).Edge() + circle = BRepBuilderAPI_MakeEdge(Geom_Circle(gp.XOY(), 1)).Edge() circle = Edge(circle) is_closed = circle.closed_curve() is_periodic = circle.periodic() @@ -90,7 +90,7 @@ def _test_closed_periodic(self): self.assertTrue(not is_periodic) def _test_curve_type(self): - circle = BRepBuilderAPI_MakeEdge(Geom_Circle(gp_XOY(), 1)).Edge() + circle = BRepBuilderAPI_MakeEdge(Geom_Circle(gp.XOY(), 1)).Edge() circle = Edge(circle) curve_type = circle.curve_type() curve_type_enum = circle.curve_type_enum() diff --git a/tests/test_edge_data_extractor.py b/tests/test_edge_data_extractor.py index 92ae024..3b69066 100644 --- a/tests/test_edge_data_extractor.py +++ b/tests/test_edge_data_extractor.py @@ -5,15 +5,9 @@ # OCC from OCC.Core.Quantity import ( Quantity_Color, - Quantity_TOC_RGB, - Quantity_NOC_WHITE, - Quantity_NOC_BLACK, Quantity_NOC_BLUE1, - Quantity_NOC_CYAN1, Quantity_NOC_RED, Quantity_NOC_GREEN, - Quantity_NOC_ORANGE, - Quantity_NOC_YELLOW, ) diff --git a/tests/test_entity_mapper.py b/tests/test_entity_mapper.py index 2de834e..c027853 100644 --- a/tests/test_entity_mapper.py +++ b/tests/test_entity_mapper.py @@ -3,7 +3,6 @@ # occwl from occwl.entity_mapper import EntityMapper -from occwl.solid import Solid from occwl.face import Face from occwl.edge import Edge from occwl.wire import Wire diff --git a/tests/test_graph.py b/tests/test_graph.py index db5a107..56fe0a7 100644 --- a/tests/test_graph.py +++ b/tests/test_graph.py @@ -1,12 +1,4 @@ -# System -import numpy as np - # Geometry -from occwl.geometry.interval import Interval -from OCC.Core.gp import gp_XOY, gp_Pnt -from OCC.Core.GC import GC_MakeSegment -from OCC.Core.BRepBuilderAPI import BRepBuilderAPI_MakeEdge -from OCC.Core.Geom import Geom_Circle from occwl.graph import vertex_adjacency, face_adjacency # Test diff --git a/tests/test_grid_and_normals.py b/tests/test_grid_and_normals.py index 84f5cd2..5f6ed15 100644 --- a/tests/test_grid_and_normals.py +++ b/tests/test_grid_and_normals.py @@ -1,9 +1,7 @@ # System -from pathlib import Path import numpy as np # OCC -from occwl.solid import Solid from occwl.uvgrid import uvgrid, ugrid, _uvgrid_reverse_u # Test diff --git a/tests/test_load_step_with_attributes.py b/tests/test_load_step_with_attributes.py index f0d112d..ebe2644 100644 --- a/tests/test_load_step_with_attributes.py +++ b/tests/test_load_step_with_attributes.py @@ -1,6 +1,3 @@ -# System -from pathlib import Path - # OCC from occwl.compound import Compound diff --git a/tests/test_reduce_native_file_size.py b/tests/test_reduce_native_file_size.py index fe99b44..cb5940e 100644 --- a/tests/test_reduce_native_file_size.py +++ b/tests/test_reduce_native_file_size.py @@ -6,11 +6,9 @@ # System from pathlib import Path import tempfile -import numpy as np # OCC from occwl.compound import Compound -from OCC.Core import PYTHONOCC_VERSION_MAJOR, PYTHONOCC_VERSION_MINOR # Test from tests.test_base import TestBase diff --git a/tests/test_solid.py b/tests/test_solid.py index dd55ab2..6b64749 100644 --- a/tests/test_solid.py +++ b/tests/test_solid.py @@ -1,8 +1,6 @@ # System import numpy as np -from occwl.solid import Solid - # Test from tests.test_base import TestBase diff --git a/tests/test_transform.py b/tests/test_transform.py index 2991da8..0974e0a 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -5,8 +5,6 @@ # System import numpy as np -from occwl.solid import Solid - # Test from tests.test_base import TestBase diff --git a/tests/test_vertex.py b/tests/test_vertex.py index d9ddad1..7f060da 100644 --- a/tests/test_vertex.py +++ b/tests/test_vertex.py @@ -1,7 +1,5 @@ import numpy as np -from occwl.vertex import Vertex - # Test from tests.test_base import TestBase