本文整理汇总了Python中OCC.Utils.Topology.Topo.next方法的典型用法代码示例。如果您正苦于以下问题:Python Topo.next方法的具体用法?Python Topo.next怎么用?Python Topo.next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCC.Utils.Topology.Topo
的用法示例。
在下文中一共展示了Topo.next方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: glue_solids
# 需要导入模块: from OCC.Utils.Topology import Topo [as 别名]
# 或者: from OCC.Utils.Topology.Topo import next [as 别名]
def glue_solids(event=None):
# Without common edges
S1 = BRepPrimAPI_MakeBox(gp_Pnt(500.,500.,0.),gp_Pnt(100.,250.,300.)).Shape()
facesA = Topo(S1).faces()
F1 = [facesA.next() for i in range(5)][-1]
S2 = BRepPrimAPI_MakeBox(gp_Pnt(400.,400.,300.),gp_Pnt(200.,300.,500.)).Shape()
facesB = Topo(S2).faces()
F2 = [facesB.next() for i in range(4)][-1]
glue1 = BRepFeat_Gluer(S2,S1)
glue1.Bind(F2,F1)
display.EraseAll()
display.DisplayShape(glue1.Shape())
示例2: test_glue_solids
# 需要导入模块: from OCC.Utils.Topology import Topo [as 别名]
# 或者: from OCC.Utils.Topology.Topo import next [as 别名]
def test_glue_solids(self):
print 'Test: glue solids'
# Without common edges
S1 = BRepPrimAPI_MakeBox(gp_Pnt(500., 500., 0.),
gp_Pnt(100., 250., 300.)).Shape()
facesA = Topo(S1).faces()
F1 = [facesA.next() for i in range(5)][-1]
S2 = BRepPrimAPI_MakeBox(gp_Pnt(400., 400., 300.),
gp_Pnt(200., 300., 500.)).Shape()
facesB = Topo(S2).faces()
F2 = [facesB.next() for i in range(4)][-1]
glue1 = BRepFeat_Gluer(S2, S1)
glue1.Bind(F2, F1)
glue1.Build()
self.assertTrue(glue1.IsDone())
示例3: test_brepfeat_prism
# 需要导入模块: from OCC.Utils.Topology import Topo [as 别名]
# 或者: from OCC.Utils.Topology.Topo import next [as 别名]
def test_brepfeat_prism(self):
print 'Test: brepfeat prism'
box = BRepPrimAPI_MakeBox(400, 250, 300).Shape()
faces = Topo(box).faces()
for i in range(5):
face = faces.next()
srf = BRep_Tool_Surface(face)
c = gp_Circ2d(gp_Ax2d(gp_Pnt2d(200, 130),
gp_Dir2d(1, 0)), 75)
circle = Geom2d_Circle(c).GetHandle()
wire = BRepBuilderAPI_MakeWire()
wire.Add(BRepBuilderAPI_MakeEdge(circle, srf, 0., pi).Edge())
wire.Add(BRepBuilderAPI_MakeEdge(circle, srf, pi, 2.*pi).Edge())
wire.Build()
mkf = BRepBuilderAPI_MakeFace()
mkf.Init(srf, False, TolDegen)
mkf.Add(wire.Wire())
mkf.Build()
self.assertTrue(mkf.IsDone())
prism = BRepFeat_MakeDPrism(box, mkf.Face(), face, 100, True, True)
prism.Perform(400)
self.assertTrue(prism.IsDone())
示例4: test_brep_feat_local_pipe
# 需要导入模块: from OCC.Utils.Topology import Topo [as 别名]
# 或者: from OCC.Utils.Topology.Topo import next [as 别名]
def test_brep_feat_local_pipe(self):
print 'Test: brep_feat local pipe'
S = BRepPrimAPI_MakeBox(400., 250., 300.).Shape()
faces = Topo(S).faces()
faces.next()
F1 = faces.next()
surf = BRep_Tool_Surface(F1)
MW1 = BRepBuilderAPI_MakeWire()
p1 = gp_Pnt2d(100., 100.)
p2 = gp_Pnt2d(200., 100.)
aline = GCE2d_MakeLine(p1, p2).Value()
MW1.Add(BRepBuilderAPI_MakeEdge(aline, surf, 0., p1.Distance(p2)).Edge())
p1 = gp_Pnt2d(200., 100.)
p2 = gp_Pnt2d(150., 200.)
aline = GCE2d_MakeLine(p1, p2).Value()
MW1.Add(BRepBuilderAPI_MakeEdge(aline, surf, 0., p1.Distance(p2)).Edge())
p1 = gp_Pnt2d(150., 200.)
p2 = gp_Pnt2d(100., 100.)
aline = GCE2d_MakeLine(p1, p2).Value()
MW1.Add(BRepBuilderAPI_MakeEdge(aline, surf, 0., p1.Distance(p2)).Edge())
MKF1 = BRepBuilderAPI_MakeFace()
MKF1.Init(surf, False, TolDegen)
MKF1.Add(MW1.Wire())
FP = MKF1.Face()
BRepLib_BuildCurves3d(FP)
CurvePoles = TColgp_Array1OfPnt(1, 3)
CurvePoles.SetValue(1, gp_Pnt(150., 0., 150.))
CurvePoles.SetValue(2, gp_Pnt(200., -100., 150.))
CurvePoles.SetValue(3, gp_Pnt(150., -200., 150.))
curve = Geom_BezierCurve(CurvePoles)
E = BRepBuilderAPI_MakeEdge(curve.GetHandle()).Edge()
W = BRepBuilderAPI_MakeWire(E).Wire()
MKPipe = BRepFeat_MakePipe(S, FP, F1, W, 1, True)
MKPipe.Perform()
self.assertTrue(MKPipe.IsDone())
示例5: brepfeat_prism
# 需要导入模块: from OCC.Utils.Topology import Topo [as 别名]
# 或者: from OCC.Utils.Topology.Topo import next [as 别名]
def brepfeat_prism(event=None):
box = BRepPrimAPI_MakeBox(400,250,300).Shape()
faces = Topo(box).faces()
for i in range(5):
face = faces.next()
srf = BRep_Tool_Surface(face)
c = gp_Circ2d(gp_Ax2d(gp_Pnt2d(200,130),
gp_Dir2d(1,0)),
75
)
circle = Geom2d_Circle(c).GetHandle()
wire = BRepBuilderAPI_MakeWire()
wire.Add( BRepBuilderAPI_MakeEdge( circle, srf, 0., pi ).Edge() )
wire.Add( BRepBuilderAPI_MakeEdge( circle, srf, pi, 2.*pi ).Edge() )
wire.Build()
display.DisplayShape(wire.Wire())
mkf = BRepBuilderAPI_MakeFace()
mkf.Init(srf, False , 1e-6)
mkf.Add(wire.Wire())
mkf.Build()
# bit obscure why this is nessecary...
# segfaults without...
new_face = mkf.Face()
BRepLib_BuildCurves3d(new_face)
display.DisplayShape(new_face)
prism = BRepFeat_MakeDPrism(box,
mkf.Face(),
face,
#gp_Dir(10,0,0),
100,
True,
True
)
prism.Perform(400)
display.EraseAll()
display.DisplayShape(prism.Shape())
display.DisplayColoredShape(wire.Wire(), 'RED')
示例6: test_brep_feat_extrusion_protrusion
# 需要导入模块: from OCC.Utils.Topology import Topo [as 别名]
# 或者: from OCC.Utils.Topology.Topo import next [as 别名]
def test_brep_feat_extrusion_protrusion(self):
print 'Test: brep_feat extrusion protusion'
#Extrusion
S = BRepPrimAPI_MakeBox(400., 250., 300.).Shape()
faces = Topo(S).faces()
F = faces.next()
surf1 = BRep_Tool_Surface(F)
Pl1 = Handle_Geom_Plane_DownCast(surf1).GetObject()
D1 = Pl1.Pln().Axis().Direction().Reversed()
MW = BRepBuilderAPI_MakeWire()
p1, p2 = gp_Pnt2d(200., -100.), gp_Pnt2d(100., -100.)
aline = GCE2d_MakeLine(p1, p2).Value()
MW.Add(BRepBuilderAPI_MakeEdge(aline, surf1, 0., p1.Distance(p2)).Edge())
p1, p2 = gp_Pnt2d(100., -100.), gp_Pnt2d(100., -200.)
aline = GCE2d_MakeLine(p1, p2).Value()
MW.Add(BRepBuilderAPI_MakeEdge(aline, surf1, 0., p1.Distance(p2)).Edge())
p1,p2 = gp_Pnt2d(100., -200.), gp_Pnt2d(200., -200.)
aline = GCE2d_MakeLine(p1, p2).Value()
MW.Add(BRepBuilderAPI_MakeEdge(aline, surf1, 0., p1.Distance(p2)).Edge())
p1,p2 = gp_Pnt2d(200., -200.), gp_Pnt2d(200., -100.)
aline = GCE2d_MakeLine(p1, p2).Value()
MW.Add(BRepBuilderAPI_MakeEdge(aline, surf1, 0., p1.Distance(p2)).Edge())
MKF = BRepBuilderAPI_MakeFace()
MKF.Init(surf1, False, TolDegen)
MKF.Add(MW.Wire())
FP = MKF.Face()
BRepLib_BuildCurves3d(FP)
MKP = BRepFeat_MakePrism(S, FP, F, D1, 0, True)
MKP.PerformThruAll()
self.assertTrue(MKP.IsDone())
self.assertFalse(MKP.Shape().IsNull())
res1 = MKP.Shape()
# Protrusion
faces.next()
F2 = faces.next()
surf2 = BRep_Tool_Surface(F2)
Pl2 = Handle_Geom_Plane_DownCast(surf2).GetObject()
D2 = Pl2.Pln().Axis().Direction().Reversed()
MW2 = BRepBuilderAPI_MakeWire()
p1, p2 = gp_Pnt2d(100., 100.), gp_Pnt2d(200., 100.)
aline = GCE2d_MakeLine(p1, p2).Value()
MW2.Add(BRepBuilderAPI_MakeEdge(aline, surf2, 0., p1.Distance(p2)).Edge())
p1, p2 = gp_Pnt2d(200., 100.), gp_Pnt2d(150., 200.)
aline = GCE2d_MakeLine(p1, p2).Value()
MW2.Add(BRepBuilderAPI_MakeEdge(aline, surf2, 0., p1.Distance(p2)).Edge())
p1, p2 = gp_Pnt2d(150., 200.), gp_Pnt2d(100., 100.)
aline = GCE2d_MakeLine(p1, p2).Value()
MW2.Add(BRepBuilderAPI_MakeEdge(aline, surf2, 0., p1.Distance(p2)).Edge())
MKF2 = BRepBuilderAPI_MakeFace()
MKF2.Init(surf2, False, TolDegen)
MKF2.Add(MW2.Wire())
MKF2.Build()
FP = MKF2.Face()
BRepLib_BuildCurves3d(FP)
MKP2 = BRepFeat_MakePrism(res1, FP, F2, D2, 0, True)
MKP2.PerformThruAll()
self.assertTrue(MKF2.IsDone())
trf = gp_Trsf()
trf.SetTranslation(gp_Vec(0, 0, 300))
gtrf = gp_GTrsf()
gtrf.SetTrsf(trf)
tr = BRepBuilderAPI_GTransform(MKP2.Shape(), gtrf, True)
from OCC.BRepAlgoAPI import BRepAlgoAPI_Fuse
fused = BRepAlgoAPI_Fuse(tr.Shape(), MKP2.Shape())
fused.RefineEdges()
fused.Build()
self.assertTrue(fused.IsDone())
self.assertFalse(fused.Shape().IsNull())
示例7: brep_feat_extrusion_protrusion
# 需要导入模块: from OCC.Utils.Topology import Topo [as 别名]
# 或者: from OCC.Utils.Topology.Topo import next [as 别名]
def brep_feat_extrusion_protrusion(event=None):
#Extrusion
S = BRepPrimAPI_MakeBox(400.,250.,300.).Shape()
faces = Topo(S).faces()
F = faces.next()
surf1 = BRep_Tool_Surface(F)
Pl1 = Handle_Geom_Plane_DownCast(surf1).GetObject()
D1 = Pl1.Pln().Axis().Direction().Reversed()
MW = BRepBuilderAPI_MakeWire()
p1,p2 = gp_Pnt2d(200.,-100.), gp_Pnt2d(100.,-100.)
aline = GCE2d_MakeLine(p1,p2).Value()
MW.Add(BRepBuilderAPI_MakeEdge(aline,surf1,0.,p1.Distance(p2)).Edge())
p1,p2 = gp_Pnt2d(100.,-100.), gp_Pnt2d(100.,-200.)
aline = GCE2d_MakeLine(p1,p2).Value()
MW.Add(BRepBuilderAPI_MakeEdge(aline,surf1,0.,p1.Distance(p2)).Edge())
p1,p2 = gp_Pnt2d(100.,-200.), gp_Pnt2d(200.,-200.)
aline = GCE2d_MakeLine(p1,p2).Value()
MW.Add(BRepBuilderAPI_MakeEdge(aline,surf1,0.,p1.Distance(p2)).Edge())
p1,p2 = gp_Pnt2d(200.,-200.), gp_Pnt2d(200.,-100.)
aline = GCE2d_MakeLine(p1,p2).Value()
MW.Add(BRepBuilderAPI_MakeEdge(aline,surf1,0.,p1.Distance(p2)).Edge())
MKF = BRepBuilderAPI_MakeFace()
MKF.Init(surf1,False,1e-6)
MKF.Add(MW.Wire())
FP = MKF.Face()
BRepLib_BuildCurves3d(FP)
# MKP = BRepFeat_MakePrism(S,FP,F,D1,0,True)
# MKP.Perform(-200)
# print 'depth 200'
# res1 = MKP.Shape()
# display.DisplayShape(res1)
# time.sleep(1)
display.EraseAll()
MKP = BRepFeat_MakePrism(S,FP,F,D1,0,True)
MKP.PerformThruAll()
print 'depth thru all'
res1 = MKP.Shape()
# display.DisplayShape(res1)
# Protrusion
faces.next()
F2 = faces.next()
surf2 = BRep_Tool_Surface(F2)
Pl2 = Handle_Geom_Plane_DownCast(surf2).GetObject()
D2 = Pl2.Pln().Axis().Direction().Reversed()
MW2 = BRepBuilderAPI_MakeWire()
p1, p2 = gp_Pnt2d(100.,100.), gp_Pnt2d(200.,100.)
# p1, p2 = gp_Pnt2d(100.,100.), gp_Pnt2d(150.,100.)
aline = GCE2d_MakeLine(p1,p2).Value()
MW2.Add(BRepBuilderAPI_MakeEdge(aline,surf2,0.,p1.Distance(p2)).Edge())
p1, p2 = gp_Pnt2d(200.,100.), gp_Pnt2d(150.,200.)
aline = GCE2d_MakeLine(p1,p2).Value()
MW2.Add(BRepBuilderAPI_MakeEdge(aline,surf2,0.,p1.Distance(p2)).Edge())
p1, p2 = gp_Pnt2d(150.,200.), gp_Pnt2d(100.,100.)
aline = GCE2d_MakeLine(p1,p2).Value()
MW2.Add(BRepBuilderAPI_MakeEdge(aline,surf2,0.,p1.Distance(p2)).Edge())
MKF2 = BRepBuilderAPI_MakeFace()
MKF2.Init(surf2,False,1e-6)
MKF2.Add(MW2.Wire())
MKF2.Build()
# display.DisplayShape(MW2.Wire())
FP = MKF2.Face()
BRepLib_BuildCurves3d(FP)
MKP2 = BRepFeat_MakePrism(res1,FP,F2,D2,0,True)
MKP2.PerformThruAll()
display.EraseAll()
# display.DisplayShape(MKP2.Shape())
trf = gp_Trsf()
trf.SetTranslation(gp_Vec(0,0,300))
gtrf = gp_GTrsf()
gtrf.SetTrsf(trf)
tr = BRepBuilderAPI_GTransform(MKP2.Shape(), gtrf, True)
from OCC.BRepAlgoAPI import BRepAlgoAPI_Fuse
fused = BRepAlgoAPI_Fuse(tr.Shape(), MKP2.Shape())
fused.RefineEdges()
fused.Build()
print 'boolean operation error status:', fused.ErrorStatus()
display.DisplayShape(fused.Shape())