diff --git a/cadquery/occ_impl/assembly.py b/cadquery/occ_impl/assembly.py index 365374e07..a8805b274 100644 --- a/cadquery/occ_impl/assembly.py +++ b/cadquery/occ_impl/assembly.py @@ -36,7 +36,7 @@ Quantity_TOC_RGB, ) from OCP.BRepAlgoAPI import BRepAlgoAPI_Fuse -from OCP.TopTools import TopTools_ListOfShape +from OCP import List_TopoDS_Shape as TopTools_ListOfShape from OCP.BOPAlgo import BOPAlgo_GlueEnum, BOPAlgo_Builder from OCP.TopoDS import TopoDS_Shape from OCP.gp import gp_EulerSequence diff --git a/cadquery/occ_impl/exporters/assembly.py b/cadquery/occ_impl/exporters/assembly.py index 05f9e8a89..ba2badf4a 100644 --- a/cadquery/occ_impl/exporters/assembly.py +++ b/cadquery/occ_impl/exporters/assembly.py @@ -41,7 +41,9 @@ ) from OCP.PCDM import PCDM_StoreStatus from OCP.RWGltf import RWGltf_CafWriter -from OCP.TColStd import TColStd_IndexedDataMapOfStringString +from OCP import ( + IndexedDataMap_TCollection_AsciiString_TCollection_AsciiString as TColStd_IndexedDataMapOfStringString, +) from OCP.Message import Message_ProgressRange from OCP.Interface import Interface_Static diff --git a/cadquery/occ_impl/geom.py b/cadquery/occ_impl/geom.py index 1a9074c59..b1e03026b 100644 --- a/cadquery/occ_impl/geom.py +++ b/cadquery/occ_impl/geom.py @@ -360,7 +360,7 @@ def _rotate(self, direction: gp_Ax1, angle: float): new = gp_Trsf() new.SetRotation(direction, angle) - self.wrapped = self.wrapped * gp_GTrsf(new) + self.wrapped = self.wrapped.Multiplied(gp_GTrsf(new)) def inverse(self) -> "Matrix": @@ -1135,7 +1135,7 @@ def inverse(self) -> "Location": def __mul__(self, other: "Location") -> "Location": - return Location(self.wrapped * other.wrapped) + return Location(self.wrapped.Multiplied(other.wrapped)) def __pow__(self, exponent: int) -> "Location": diff --git a/cadquery/occ_impl/importers/assembly.py b/cadquery/occ_impl/importers/assembly.py index 98dbc4de7..56ed7e64d 100644 --- a/cadquery/occ_impl/importers/assembly.py +++ b/cadquery/occ_impl/importers/assembly.py @@ -4,7 +4,8 @@ from OCP.TopoDS import TopoDS_Shape from OCP.TCollection import TCollection_ExtendedString from OCP.Quantity import Quantity_ColorRGBA -from OCP.TDF import TDF_Label, TDF_LabelSequence +from OCP.TDF import TDF_Label +from OCP import Sequence_TDS_Label as TDF_LabelSequence from OCP.IFSelect import IFSelect_RetDone from OCP.TDocStd import TDocStd_Document from OCP.TDataStd import TDataStd_Name, TDataStd_TreeNode diff --git a/cadquery/occ_impl/importers/dxf.py b/cadquery/occ_impl/importers/dxf.py index a6c5093d4..502d0cfb7 100644 --- a/cadquery/occ_impl/importers/dxf.py +++ b/cadquery/occ_impl/importers/dxf.py @@ -9,11 +9,14 @@ import ezdxf from OCP.ShapeAnalysis import ShapeAnalysis_FreeBounds -from OCP.TopTools import TopTools_HSequenceOfShape +from OCP import HSequence_TopoDS_Shape as TopTools_HSequenceOfShape from OCP.gp import gp_Pnt from OCP.Geom import Geom_BSplineCurve -from OCP.TColgp import TColgp_Array1OfPnt -from OCP.TColStd import TColStd_Array1OfReal, TColStd_Array1OfInteger +from OCP import Arra1_gp_Pnt as TColgp_Array1OfPnt +from OCP import ( + Array1_double as TColStd_Array1OfReal, + Array1_int as TColStd_Array1OfInteger, +) from OCP.BRepBuilderAPI import BRepBuilderAPI_MakeEdge diff --git a/cadquery/occ_impl/nurbs.py b/cadquery/occ_impl/nurbs.py index 9f77b1949..6fcd45bea 100644 --- a/cadquery/occ_impl/nurbs.py +++ b/cadquery/occ_impl/nurbs.py @@ -14,10 +14,10 @@ from casadi import ldl, ldl_solve, Linsol, DM, solve from OCP.Geom import Geom_BSplineCurve, Geom_BSplineSurface -from OCP.TColgp import TColgp_Array1OfPnt, TColgp_Array2OfPnt -from OCP.TColStd import ( - TColStd_Array1OfInteger, - TColStd_Array1OfReal, +from OCP import Array1_gp_Pnt as TColgp_Array1OfPnt, Array2_gp_Pnt as TColgp_Array2OfPnt +from OCP import ( + Array1_int as TColStd_Array1OfInteger, + Array1_double as TColStd_Array1OfReal, ) from OCP.gp import gp_Pnt from OCP.BRepBuilderAPI import BRepBuilderAPI_MakeEdge, BRepBuilderAPI_MakeFace diff --git a/cadquery/occ_impl/shapes.py b/cadquery/occ_impl/shapes.py index 31b125e37..6f90514ea 100644 --- a/cadquery/occ_impl/shapes.py +++ b/cadquery/occ_impl/shapes.py @@ -63,21 +63,21 @@ ) # Array of points (used for B-spline construction): -from OCP.TColgp import ( - TColgp_HArray1OfPnt, - TColgp_HArray2OfPnt, - TColgp_Array1OfPnt, - TColgp_HArray1OfPnt2d, +from OCP import ( + HArray1_gp_Pnt as TColgp_HArray1OfPnt, + HArray2_gp_Pnt as TColgp_HArray2OfPnt, + Array1_gp_Pnt as TColgp_Array1OfPnt, + HArray2_gp_Pnt2d as TColgp_HArray1OfPnt2d, ) # Array of vectors (used for B-spline interpolation): -from OCP.TColgp import TColgp_Array1OfVec +from OCP import Array1_gp_Vec as TColgp_Array1OfVec # Array of booleans (used for B-spline interpolation): -from OCP.TColStd import TColStd_HArray1OfBoolean +from OCP import HArray1_bool as TColStd_HArray1OfBoolean # Array of floats (used for B-spline interpolation): -from OCP.TColStd import TColStd_HArray1OfReal +from OCP import HArray1_double as TColStd_HArray1OfReal from OCP.BRepAdaptor import ( BRepAdaptor_Curve, @@ -141,8 +141,7 @@ TopoDS_CompSolid, ) -from OCP.GC import GC_MakeArcOfCircle, GC_MakeArcOfEllipse # geometry construction -from OCP.GCE2d import GCE2d_MakeSegment +from OCP.GC import GC_MakeArcOfCircle, GC_MakeArcOfEllipse, GC_MakeSegment2d from OCP.gce import gce_MakeLin, gce_MakeDir from OCP.GeomAPI import ( GeomAPI_Interpolate, @@ -195,11 +194,11 @@ BRepFilletAPI_MakeFillet2d, ) -from OCP.TopTools import ( - TopTools_IndexedDataMapOfShapeListOfShape, - TopTools_ListOfShape, - TopTools_MapOfShape, - TopTools_IndexedMapOfShape, +from OCP import ( + IndexedDataMap_TopoDS_Shape_List_TopoDS_Shape as TopTools_IndexedDataMapOfShapeListOfShape, + List_TopoDS_Shape as TopTools_ListOfShape, + Map_TopoDS_Shape as TopTools_MapOfShape, + IndexedMap_TopoDS_Shape as TopTools_IndexedMapOfShape, ) @@ -242,7 +241,7 @@ Graphic3d_VTA_TOP, ) -from OCP.NCollection import NCollection_Utf8String +from OCP.NCollection import NCollection_String as NCollection_Utf8String from OCP.BRepFeat import BRepFeat_MakeDPrism, BRepFeat_MakePrism @@ -288,7 +287,7 @@ ShapeAnalysis, ShapeAnalysis_WireOrder, ) -from OCP.TopTools import TopTools_HSequenceOfShape +from OCP import HSequence_TopoDS_Shape as TopTools_HSequenceOfShape from OCP.GCPnts import ( GCPnts_AbscissaPoint, @@ -327,7 +326,7 @@ from OCP.Approx import Approx_ParametrizationType -from OCP.LProp3d import LProp3d_CLProps +from OCP.LProp3d import LProp3d_CLProps # FIXME from OCP.BinTools import BinTools @@ -3158,7 +3157,7 @@ def makeHelix( n_turns = height / pitch u_start = geom_line.Value(0.0) u_stop = geom_line.Value(n_turns * sqrt((2 * pi) ** 2 + pitch ** 2)) - geom_seg = GCE2d_MakeSegment(u_start, u_stop).Value() + geom_seg = GC_MakeSegment2d(u_start, u_stop).Value() e = BRepBuilderAPI_MakeEdge(geom_seg, geom_surf).Edge() @@ -3897,7 +3896,7 @@ def trim( # build (u,v) segments for el1, el2 in zip((pt1, pt2, pt3, *pts), (pt2, pt3, *pts, pt1)): - segs_uv.append(GCE2d_MakeSegment(gp_Pnt2d(*el1), gp_Pnt2d(*el2)).Value()) + segs_uv.append(GC_MakeSegment2d(gp_Pnt2d(*el1), gp_Pnt2d(*el2)).Value()) # convert to edges edges = [] diff --git a/cadquery/occ_impl/solver.py b/cadquery/occ_impl/solver.py index 66bc71898..a56e2478b 100644 --- a/cadquery/occ_impl/solver.py +++ b/cadquery/occ_impl/solver.py @@ -418,7 +418,7 @@ def point_in_plane_cost( m1_dm = ca.DM((m1.X(), m1.Y(), m1.Z())) m2_dir = m2.Axis().Direction() - m2_pnt = m2.Axis().Location().Translated(val * gp_Vec(m2_dir)) + m2_pnt = m2.Axis().Location().Translated(gp_Vec(m2_dir).Scaled(val)) m2_dir_dm = ca.DM((m2_dir.X(), m2_dir.Y(), m2_dir.Z())) m2_pnt_dm = ca.DM((m2_pnt.X(), m2_pnt.Y(), m2_pnt.Z())) diff --git a/environment.yml b/environment.yml index 4608af03b..136b7db35 100644 --- a/environment.yml +++ b/environment.yml @@ -4,8 +4,8 @@ channels: dependencies: - python>=3.11 - ipython -# - cadquery/label/dev::ocp=x.x.x for dev - - ocp=7.9.3.1 + - cadquery/label/dev::ocp=8.0.0.0 +# - ocp=7.9.3.1 - pyparsing>=3.0.0 - sphinx=9.1.0 # - sphinx_rtd_theme=3.1.0