Skip to content

Commit efc2a24

Browse files
kshitij-mathsndem0
authored andcommitted
fix: adpat pythonocc api changes
1 parent 48180d6 commit efc2a24

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

pygem/cad/cad_deformation.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import os
55
import numpy as np
66
from itertools import product
7-
from OCC.Core.TopoDS import (TopoDS_Shape, topods_Wire, TopoDS_Compound,
8-
topods_Face, topods_Edge, TopoDS_Face, TopoDS_Wire)
7+
from OCC.Core.TopoDS import (TopoDS_Shape, TopoDS_Wire, TopoDS_Compound,
8+
TopoDS_Face, TopoDS_Edge, TopoDS_Face, TopoDS_Wire)
99
from OCC.Core.BRep import BRep_Builder
1010
from OCC.Core.TopExp import TopExp_Explorer
1111
from OCC.Core.TopAbs import (TopAbs_EDGE, TopAbs_FACE, TopAbs_WIRE)
@@ -87,7 +87,7 @@ def __init__(self,
8787
@staticmethod
8888
def read_shape(filename):
8989
"""
90-
Static method to load the `topoDS_Shape` from a file.
90+
Static method to load the `TopoDS_Shape` from a file.
9191
Supported extensions are: ".iges", ".step".
9292
9393
:param str filename: the name of the file containing the geometry.
@@ -126,7 +126,7 @@ def read_shape(filename):
126126
@staticmethod
127127
def write_shape(filename, shape):
128128
"""
129-
Static method to save a `topoDS_Shape` object to a file.
129+
Static method to save a `TopoDS_Shape` object to a file.
130130
Supported extensions are: ".iges", ".step".
131131
132132
:param str filename: the name of the file where the shape will be saved.
@@ -177,7 +177,7 @@ def _bspline_surface_from_face(self, face):
177177
if not isinstance(face, TopoDS_Face):
178178
raise TypeError("face must be a TopoDS_Face")
179179
# TopoDS_Face converted to Nurbs
180-
nurbs_face = topods_Face(BRepBuilderAPI_NurbsConvert(face).Shape())
180+
nurbs_face = BRepBuilderAPI_NurbsConvert(face).Shape()
181181
# GeomSurface obtained from Nurbs face
182182
surface = BRep_Tool.Surface(nurbs_face)
183183
# surface is now further converted to a bspline surface
@@ -203,7 +203,7 @@ def _bspline_curve_from_wire(self, wire):
203203
edge_explorer = TopExp_Explorer(wire, TopAbs_EDGE)
204204
while edge_explorer.More():
205205
# getting the edge from the iterator
206-
edge = topods_Edge(edge_explorer.Current())
206+
edge = edge_explorer.Current()
207207

208208
# edge can be joined only if it is not degenerated (zero length)
209209
if BRep_Tool.Degenerated(edge):
@@ -213,7 +213,7 @@ def _bspline_curve_from_wire(self, wire):
213213
# the edge must be converted to Nurbs edge
214214
nurbs_converter = BRepBuilderAPI_NurbsConvert(edge)
215215
nurbs_converter.Perform(edge)
216-
nurbs_edge = topods_Edge(nurbs_converter.Shape())
216+
nurbs_edge = nurbs_converter.Shape()
217217

218218
# here we extract the underlying curve from the Nurbs edge
219219
nurbs_curve = BRep_Tool_Curve(nurbs_edge)[0]
@@ -381,7 +381,7 @@ def __call__(self, obj, dst=None):
381381
# performing some conversions to get the right
382382
# format (BSplineSurface)
383383
# TopoDS_Face obtained from iterator
384-
face = topods_Face(faces_explorer.Current())
384+
face = faces_explorer.Current()
385385
# performing some conversions to get the right
386386
# format (BSplineSurface)
387387
bspline_surface = self._bspline_surface_from_face(face)
@@ -411,7 +411,7 @@ def __call__(self, obj, dst=None):
411411
wire_explorer = TopExp_Explorer(face, TopAbs_WIRE)
412412
while wire_explorer.More():
413413
# wire obtained from the iterator
414-
wire = topods_Wire(wire_explorer.Current())
414+
wire = wire_explorer.Current()
415415

416416
# getting a bpline curve joining all the edges of the wire
417417
composite_curve = self._bspline_curve_from_wire(wire)

0 commit comments

Comments
 (0)