Skip to content
2 changes: 1 addition & 1 deletion cadquery/occ_impl/assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
Quantity_TOC_RGB,
)
from OCP.BRepAlgoAPI import BRepAlgoAPI_Fuse
from OCP.TopTools import TopTools_ListOfShape
from OCP.collections 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
Expand Down
4 changes: 3 additions & 1 deletion cadquery/occ_impl/exporters/assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
)
from OCP.PCDM import PCDM_StoreStatus
from OCP.RWGltf import RWGltf_CafWriter
from OCP.TColStd import TColStd_IndexedDataMapOfStringString
from OCP.collections import (
IndexedDataMap_TCollection_AsciiString_TCollection_AsciiString as TColStd_IndexedDataMapOfStringString,
)
from OCP.Message import Message_ProgressRange
from OCP.Interface import Interface_Static

Expand Down
13 changes: 10 additions & 3 deletions cadquery/occ_impl/geom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":

Expand Down Expand Up @@ -890,7 +890,14 @@ class BoundBox(object):

def __init__(self, bb: Bnd_Box) -> None:
self.wrapped = bb
XMin, YMin, ZMin, XMax, YMax, ZMax = bb.Get()
XMin, YMin, ZMin, XMax, YMax, ZMax = (
bb.GetXMin(),
bb.GetYMin(),
bb.GetZMin(),
bb.GetXMax(),
bb.GetYMax(),
bb.GetZMax(),
)

self.xmin = XMin
self.xmax = XMax
Expand Down Expand Up @@ -1135,7 +1142,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":

Expand Down
3 changes: 2 additions & 1 deletion cadquery/occ_impl/importers/assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.collections import Sequence_TDF_Label as TDF_LabelSequence
from OCP.IFSelect import IFSelect_RetDone
from OCP.TDocStd import TDocStd_Document
from OCP.TDataStd import TDataStd_Name, TDataStd_TreeNode
Expand Down
9 changes: 6 additions & 3 deletions cadquery/occ_impl/importers/dxf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@
import ezdxf

from OCP.ShapeAnalysis import ShapeAnalysis_FreeBounds
from OCP.TopTools import TopTools_HSequenceOfShape
from OCP.collections 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.collections import Array1_gp_Pnt as TColgp_Array1OfPnt
from OCP.collections import (
Array1_double as TColStd_Array1OfReal,
Array1_int as TColStd_Array1OfInteger,
)
from OCP.BRepBuilderAPI import BRepBuilderAPI_MakeEdge


Expand Down
11 changes: 7 additions & 4 deletions cadquery/occ_impl/nurbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@
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.collections import (
Array1_gp_Pnt as TColgp_Array1OfPnt,
Array2_gp_Pnt as TColgp_Array2OfPnt,
)
from OCP.collections 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
Expand Down
44 changes: 21 additions & 23 deletions cadquery/occ_impl/shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.collections import (
HArray1_gp_Pnt as TColgp_HArray1OfPnt,
HArray2_gp_Pnt as TColgp_HArray2OfPnt,
Array1_gp_Pnt as TColgp_Array1OfPnt,
HArray1_gp_Pnt2d as TColgp_HArray1OfPnt2d,
)

# Array of vectors (used for B-spline interpolation):
from OCP.TColgp import TColgp_Array1OfVec
from OCP.collections import Array1_gp_Vec as TColgp_Array1OfVec

# Array of booleans (used for B-spline interpolation):
from OCP.TColStd import TColStd_HArray1OfBoolean
from OCP.collections import HArray1_bool as TColStd_HArray1OfBoolean

# Array of floats (used for B-spline interpolation):
from OCP.TColStd import TColStd_HArray1OfReal
from OCP.collections import HArray1_double as TColStd_HArray1OfReal

from OCP.BRepAdaptor import (
BRepAdaptor_Curve,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -195,11 +194,10 @@
BRepFilletAPI_MakeFillet2d,
)

from OCP.TopTools import (
TopTools_IndexedDataMapOfShapeListOfShape,
TopTools_ListOfShape,
TopTools_MapOfShape,
TopTools_IndexedMapOfShape,
from OCP.collections import (
IndexedDataMap_TopoDS_Shape_List_TopoDS_Shape_TopTools_ShapeMapHasher as TopTools_IndexedDataMapOfShapeListOfShape,
List_TopoDS_Shape as TopTools_ListOfShape,
IndexedMap_TopoDS_Shape_TopTools_ShapeMapHasher as TopTools_IndexedMapOfShape,
)


Expand Down Expand Up @@ -242,7 +240,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

Expand Down Expand Up @@ -288,7 +286,7 @@
ShapeAnalysis,
ShapeAnalysis_WireOrder,
)
from OCP.TopTools import TopTools_HSequenceOfShape
from OCP.collections import HSequence_TopoDS_Shape as TopTools_HSequenceOfShape

from OCP.GCPnts import (
GCPnts_AbscissaPoint,
Expand Down Expand Up @@ -327,7 +325,7 @@

from OCP.Approx import Approx_ParametrizationType

from OCP.LProp3d import LProp3d_CLProps
from OCP.LProp import LProp_CLProps3d

from OCP.BinTools import BinTools

Expand Down Expand Up @@ -1797,7 +1795,7 @@ def siblings(
TopExp.MapShapesAndAncestors_s(
ctx.wrapped, inverse_shape_LUT[kind], shapetype(self.wrapped), shape_map,
)
exclude = TopTools_MapOfShape()
exclude = TopTools_IndexedMapOfShape()

def _siblings(shapes: Iterable[Shape], level: int) -> set[Shape]:

Expand Down Expand Up @@ -2590,7 +2588,7 @@ def curvatureAt(

curve, param = self._curve_and_param(d, mode)

props = LProp3d_CLProps(curve, param, 2, resolution)
props = LProp_CLProps3d(curve, param, 2, resolution)

return props.Curvature()

Expand Down Expand Up @@ -3158,7 +3156,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()

Expand Down Expand Up @@ -3897,7 +3895,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 = []
Expand Down Expand Up @@ -5034,7 +5032,7 @@ def siblings(
ctx.wrapped, inverse_shape_LUT[kind], t, shape_map,
)

exclude = TopTools_MapOfShape()
exclude = TopTools_IndexedMapOfShape()

def _siblings(shapes: Iterable[Shape], level: int) -> set[Shape]:

Expand Down
2 changes: 1 addition & 1 deletion cadquery/occ_impl/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions tests/test_cadquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -5200,6 +5200,8 @@ def testSplineApprox(self):
from .naca import naca5305
from math import pi, cos

import OCP

pts = [Vector(e[0], e[1], 0) for e in naca5305]

# spline
Expand All @@ -5211,7 +5213,7 @@ def testSplineApprox(self):
self.assertTrue(e2.isValid())
self.assertTrue(e1.Length() > e2.Length())

with raises(ValueError):
with raises(OCP.Standard.Standard_ConstructionError):
e4 = Edge.makeSplineApprox(pts, 1e-6, maxDeg=3, smoothing=(1, 1, 1.0))

pts_closed = pts + [pts[0]]
Expand Down Expand Up @@ -5258,7 +5260,7 @@ def testSplineApprox(self):
self.assertTrue(f1.isValid())
self.assertTrue(f2.isValid())

with raises(ValueError):
with raises(OCP.Standard.Standard_ConstructionError):
f3 = Face.makeSplineApprox(pts, smoothing=(1, 1, 1), maxDeg=3)

def testParametricSurface(self):
Expand Down
4 changes: 3 additions & 1 deletion tests/test_free_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,9 @@ def patch_find(monkeypatch):
Fixture for throwing exception during imprinting.
"""

from OCP.TopTools import TopTools_DataMapOfShapeListOfShape
from OCP.collections import (
DataMap_TopoDS_Shape_List_TopoDS_Shape_TopTools_ShapeMapHasher as TopTools_DataMapOfShapeListOfShape,
)
from OCP.Standard import Standard_NoSuchObject
from OCP.BOPAlgo import BOPAlgo_Builder

Expand Down
Loading