GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fixed classic bottle · hovedguy/pythonocc-demos@1bcec6b

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • examples
    • core_classic_occ_bottle.py
    • core_geometry_surface_from_curves.py
    • core_load_step_ap203_ocaf.py
    • core_load_step_with_colors.py
    • core_modeling_sprocket.py
    • core_topology_draft_angle.py
    • core_topology_local_ops.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎examples/core_classic_occ_bottle.py‎

Copy file name to clipboardExpand all lines: examples/core_classic_occ_bottle.py
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def face_is_plane(face):
4444
hs = BRep_Tool_Surface(face)
4545
downcast_result = Geom_Plane.DownCast(hs)
4646
# The handle is null if downcast failed or is not possible, that is to say the face is not a plane
47-
if downcast_result.IsNull():
47+
if downcast_result is None:
4848
return False
4949
else:
5050
return True
@@ -176,19 +176,19 @@ def geom_plane_from_face(aFace):
176176
anEllipse1 = Geom2d_Ellipse(anAx2d, aMajor, aMinor)
177177
anEllipse2 = Geom2d_Ellipse(anAx2d, aMajor, aMinor / 4.0)
178178

179-
anArc1 = Geom2d_TrimmedCurve(Geom2d_Ellipse(anEllipse1), 0, math.pi)
180-
anArc2 = Geom2d_TrimmedCurve(Geom2d_Ellipse(anEllipse2), 0, math.pi)
179+
anArc1 = Geom2d_TrimmedCurve(anEllipse1, 0, math.pi)
180+
anArc2 = Geom2d_TrimmedCurve(anEllipse2, 0, math.pi)
181181

182182
anEllipsePnt1 = anEllipse1.Value(0)
183183
anEllipsePnt2 = anEllipse1.Value(math.pi)
184184

185185
aSegment = GCE2d_MakeSegment(anEllipsePnt1, anEllipsePnt2)
186186

187187
# Build edges and wires for threading
188-
anEdge1OnSurf1 = BRepBuilderAPI_MakeEdge(Geom2d_Curve(anArc1), Geom_Surface(aCyl1))
189-
anEdge2OnSurf1 = BRepBuilderAPI_MakeEdge(aSegment.Value(), Geom_Surface(aCyl1))
190-
anEdge1OnSurf2 = BRepBuilderAPI_MakeEdge(Geom2d_Curve(anArc2), Geom_Surface(aCyl2))
191-
anEdge2OnSurf2 = BRepBuilderAPI_MakeEdge(aSegment.Value(), Geom_Surface(aCyl2))
188+
anEdge1OnSurf1 = BRepBuilderAPI_MakeEdge(anArc1, aCyl1)
189+
anEdge2OnSurf1 = BRepBuilderAPI_MakeEdge(aSegment.Value(), aCyl1)
190+
anEdge1OnSurf2 = BRepBuilderAPI_MakeEdge(anArc2, aCyl2)
191+
anEdge2OnSurf2 = BRepBuilderAPI_MakeEdge(aSegment.Value(), aCyl2)
192192

193193
threadingWire1 = BRepBuilderAPI_MakeWire(anEdge1OnSurf1.Edge(), anEdge2OnSurf1.Edge())
194194
threadingWire2 = BRepBuilderAPI_MakeWire(anEdge1OnSurf2.Edge(), anEdge2OnSurf2.Edge())
Collapse file

‎examples/core_geometry_surface_from_curves.py‎

Copy file name to clipboardExpand all lines: examples/core_geometry_surface_from_curves.py
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
GeomFill_CoonsStyle,
2626
GeomFill_CurvedStyle)
2727
from OCC.Core.GeomAPI import GeomAPI_PointsToBSpline
28-
from OCC.Core.Geom import Geom_BSplineCurve_DownCast
28+
from OCC.Core.Geom import Geom_BSplineCurve
2929

3030
from OCC.Display.SimpleGui import init_display
3131

@@ -64,14 +64,14 @@ def surface_from_curves():
6464
SPL2,
6565
GeomFill_StretchStyle)
6666

67-
SPL3 = Geom_BSplineCurve_DownCast(SPL1.Translated(gp_Vec(10, 0, 0)))
68-
SPL4 = Geom_BSplineCurve_DownCast(SPL2.Translated(gp_Vec(10, 0, 0)))
67+
SPL3 = Geom_BSplineCurve.DownCast(SPL1.Translated(gp_Vec(10, 0, 0)))
68+
SPL4 = Geom_BSplineCurve.DownCast(SPL2.Translated(gp_Vec(10, 0, 0)))
6969
# Fill with CoonsStyle
7070
aGeomFill2 = GeomFill_BSplineCurves(SPL3,
7171
SPL4,
7272
GeomFill_CoonsStyle)
73-
SPL5 = Geom_BSplineCurve_DownCast(SPL1.Translated(gp_Vec(20, 0, 0)))
74-
SPL6 = Geom_BSplineCurve_DownCast(SPL2.Translated(gp_Vec(20, 0, 0)))
73+
SPL5 = Geom_BSplineCurve.DownCast(SPL1.Translated(gp_Vec(20, 0, 0)))
74+
SPL6 = Geom_BSplineCurve.DownCast(SPL2.Translated(gp_Vec(20, 0, 0)))
7575
# Fill with CurvedStyle
7676
aGeomFill3 = GeomFill_BSplineCurves(SPL5,
7777
SPL6,
Collapse file

‎examples/core_load_step_ap203_ocaf.py‎

Copy file name to clipboardExpand all lines: examples/core_load_step_ap203_ocaf.py
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@
3636
_shapes = []
3737

3838
# create an handle to a document
39-
doc = TDocStd_Document()
40-
41-
# Create the application
42-
app = XCAFApp_Application.GetApplication()
43-
app.NewDocument(TCollection_ExtendedString("MDTV-CAF"), doc)
39+
doc = TDocStd_Document(TCollection_ExtendedString("pythonocc-doc"))
4440

4541
# Get root assembly
4642
shape_tool = XCAFDoc_DocumentTool_ShapeTool(doc.Main())
Collapse file

‎examples/core_load_step_with_colors.py‎

Copy file name to clipboardExpand all lines: examples/core_load_step_with_colors.py
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
##along with pythonOCC. If not, see <http://www.gnu.org/licenses/>.
1717

1818
from OCC.Extend.DataExchange import read_step_file_with_names_colors
19-
from OCC.Display.WebGl import x3dom_renderer
19+
from OCC.Core.Quantity import Quantity_Color, Quantity_TOC_RGB
20+
from OCC.Display.SimpleGui import init_display
2021

2122
filename = '../assets/models/as1-oc-214.stp'
2223
shapes_labels_colors = read_step_file_with_names_colors(filename)
@@ -28,6 +29,9 @@
2829
# traverse shapes, render in "face" mode
2930
for shpt_lbl_color in shapes_labels_colors:
3031
shape, label, c = shpt_lbl_color
31-
display.DisplayColoredShape(shape, color=(c.Red(), c.Green(), c.Blue()))
32+
display.DisplayColoredShape(shape, color=Quantity_Color(c.Red(),
33+
c.Green(),
34+
c.Blue(),
35+
Quantity_TOC_RGB))
3236

3337
start_display()
Collapse file

‎examples/core_modeling_sprocket.py‎

Copy file name to clipboardExpand all lines: examples/core_modeling_sprocket.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,14 @@ def build_tooth():
161161
arc4 = BRepBuilderAPI_MakeEdge(geomapi_To3d(mirror_profile, plane)).Edge()
162162
arc5 = BRepBuilderAPI_MakeEdge(geomapi_To3d(mirror_base, plane)).Edge()
163163

164-
p4 = Proxy(mirror_base).EndPoint()
165-
p5 = Proxy(inner_arc).StartPoint()
164+
p4 = mirror_base.EndPoint()
165+
p5 = inner_arc.StartPoint()
166166

167167
lin1 = BRepBuilderAPI_MakeEdge(gp_Pnt(p4.X(), p4.Y(), 0),
168168
gp_Pnt(p5.X(), p5.Y(), 0)).Edge()
169169
arc6 = BRepBuilderAPI_MakeEdge(geomapi_To3d(inner_arc, plane)).Edge()
170170

171-
p6 = Proxy(inner_arc).EndPoint()
171+
p6 = inner_arc.EndPoint()
172172
lin2 = BRepBuilderAPI_MakeEdge(gp_Pnt(p6.X(), p6.Y(), 0),
173173
gp_Pnt(p0.X(), p0.Y(), 0)).Edge()
174174

@@ -322,7 +322,7 @@ def cut_out(base):
322322

323323
geom_outer = GCE2d_MakeCircle(outer).Value()
324324
geom_inner = GCE2d_MakeCircle(inner).Value()
325-
Proxy(geom_inner).Reverse()
325+
geom_inner.Reverse()
326326

327327
base_angle = (2. * M_PI) / mounting_hole_count
328328
hole_angle = atan(hole_radius / mounting_radius)
Collapse file

‎examples/core_topology_draft_angle.py‎

Copy file name to clipboardExpand all lines: examples/core_topology_draft_angle.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from OCC.Core.BRep import BRep_Tool_Surface
2424
from OCC.Core.TopExp import TopExp_Explorer
2525
from OCC.Core.TopAbs import TopAbs_FACE
26-
from OCC.Core.Geom import Geom_Plane_DownCast
26+
from OCC.Core.Geom import Geom_Plane
2727
from OCC.Core.TopoDS import topods_Face
2828

2929
from OCC.Display.SimpleGui import init_display
@@ -37,7 +37,7 @@ def draft_angle(event=None):
3737
topExp.Init(S, TopAbs_FACE)
3838
while topExp.More():
3939
face = topods_Face(topExp.Current())
40-
surf = Geom_Plane_DownCast(BRep_Tool_Surface(face))
40+
surf = Geom_Plane.DownCast(BRep_Tool_Surface(face))
4141
dirf = surf.Pln().Axis().Direction()
4242
ddd = gp_Dir(0, 0, 1)
4343
if dirf.IsNormal(ddd, precision_Angular()):
Collapse file

‎examples/core_topology_local_ops.py‎

Copy file name to clipboardExpand all lines: examples/core_topology_local_ops.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakeBox, BRepPrimAPI_MakePrism
3030
from OCC.Display.SimpleGui import init_display
3131
from OCC.Core.GCE2d import GCE2d_MakeLine
32-
from OCC.Core.Geom import Geom_Plane_DownCast, Geom_Plane
32+
from OCC.Core.Geom import Geom_Plane, Geom_Plane
3333
from OCC.Core.Geom2d import Geom2d_Circle
3434
from OCC.Core.GeomAbs import GeomAbs_Arc
3535
from OCC.Core.TopTools import TopTools_ListOfShape
@@ -52,7 +52,7 @@ def extrusion(event=None):
5252
surf = BRep_Tool_Surface(F)
5353

5454
# Make a plane from this face
55-
Pl = Geom_Plane_DownCast(surf)
55+
Pln = Geom_Plane.DownCast(surf)
5656

5757
# Get the normal of this plane. This will be the direction of extrusion.
5858
D = Pln.Axis().Direction()
@@ -261,7 +261,7 @@ def brep_feat_extrusion_protrusion(event=None):
261261
F = next(faces)
262262
surf1 = BRep_Tool_Surface(F)
263263

264-
Pl1 = Geom_Plane_DownCast(surf1)
264+
Pl1 = Geom_Plane.DownCast(surf1)
265265

266266
D1 = Pl1.Pln().Axis().Direction().Reversed()
267267
MW = BRepBuilderAPI_MakeWire()
@@ -298,7 +298,7 @@ def brep_feat_extrusion_protrusion(event=None):
298298
next(faces)
299299
F2 = next(faces)
300300
surf2 = BRep_Tool_Surface(F2)
301-
Pl2 = Geom_Plane_DownCast(surf2)
301+
Pl2 = Geom_Plane.DownCast(surf2)
302302
D2 = Pl2.Pln().Axis().Direction().Reversed()
303303
MW2 = BRepBuilderAPI_MakeWire()
304304
p1, p2 = gp_Pnt2d(100., 100.), gp_Pnt2d(200., 100.)

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.