当前位置: 首页>>代码示例>>Python>>正文


Python Topo.vertices方法代码示例

本文整理汇总了Python中OCC.Utils.Topology.Topo.vertices方法的典型用法代码示例。如果您正苦于以下问题:Python Topo.vertices方法的具体用法?Python Topo.vertices怎么用?Python Topo.vertices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OCC.Utils.Topology.Topo的用法示例。


在下文中一共展示了Topo.vertices方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_thick_solid

# 需要导入模块: from OCC.Utils.Topology import Topo [as 别名]
# 或者: from OCC.Utils.Topology.Topo import vertices [as 别名]
 def test_thick_solid(self):
     print 'Test: thick solid'
     S = BRepPrimAPI_MakeBox(150, 200, 110).Shape()
     topo = Topo(S)
     vert = topo.vertices().next()
     shapes = TopTools_ListOfShape()
     for f in topo.faces_from_vertex(vert):
         shapes.Append(f)
     _thick_solid = BRepOffsetAPI_MakeThickSolid(S, shapes, 15, 0.01)
     self.assertTrue(_thick_solid.IsDone())
开发者ID:imclab,项目名称:pythonocc,代码行数:12,代码来源:topology_local_operations_unittest.py

示例2: thick_solid

# 需要导入模块: from OCC.Utils.Topology import Topo [as 别名]
# 或者: from OCC.Utils.Topology.Topo import vertices [as 别名]
def thick_solid(event=None):
    S = BRepPrimAPI_MakeBox(150,200,110).Shape()
    
    topo = Topo(S)
    vert = topo.vertices().next()
    
    shapes = TopTools_ListOfShape()
    for f in topo.faces_from_vertex(vert):
        shapes.Append(f)
    
    _thick_solid = BRepOffsetAPI_MakeThickSolid(S,shapes, 15,0.01)
    display.EraseAll()
    display.DisplayShape(_thick_solid.Shape())
开发者ID:dbarbier,项目名称:pythonocc,代码行数:15,代码来源:topology_local_operations.py

示例3: nearestVertices

# 需要导入模块: from OCC.Utils.Topology import Topo [as 别名]
# 或者: from OCC.Utils.Topology.Topo import vertices [as 别名]
def nearestVertices(wireList,point,tolerance=9999999.0):

    points = [];
    for w in wireList:
        tw = Topo(w);
        for v in tw.vertices():                    
            p = brepTool.Pnt(v);
            d = point.Distance(p)
            if d < tolerance:
                points.append((w,v,p,d));                        
   
    #sort       
    return sorted(points,key=lambda v: v[3])
开发者ID:adam-urbanczyk,项目名称:emcfab,代码行数:15,代码来源:OCCUtil.py

示例4: TestTopology

# 需要导入模块: from OCC.Utils.Topology import Topo [as 别名]
# 或者: from OCC.Utils.Topology.Topo import vertices [as 别名]
class TestTopology(unittest.TestCase):
    def setUp(self):
        self.topo = Topo(BRepPrimAPI_MakeBox(10., 10., 10).Shape())

    def test_nested_iteration(self):
        '''check nested looping'''
        for f in self.topo.faces():
            for e in self.topo.edges():
                self.assert_(isinstance(f, TopoDS_Face))
                self.assert_(isinstance(e, TopoDS_Edge))

    def test_kept_reference(self):
        '''did we keep a reference after looping several time through a list
        of topological entities?'''
        _tmp = []
        _faces = [i for i in self.topo.faces()]
        for f in _faces:
            _tmp.append(0 == f.IsNull())
        for f in _faces:
            _tmp.append(0 == f.IsNull())
        self.assert_(all(_tmp))

    def test_number_of_topological_entities(self):
        self.assert_(self.topo.number_of_vertices() == 8)
        self.assert_(self.topo.number_of_edges() == 12)
        self.assert_(self.topo.number_of_wires() == 6)
        self.assert_(self.topo.number_of_faces() == 6)
        self.assert_(self.topo.number_of_solids() == 1)
        self.assert_(self.topo.number_of_comp_solids() == 0)
        self.assert_(self.topo.number_of_compounds() == 0)

    def test_edge_face(self):
        edg = self.topo.edges().next()
        face = self.topo.faces().next()
        faces_from_edge = [i for i in self.topo.faces_from_edge(edg)]
        self.assert_(len(faces_from_edge) == self.topo.number_of_faces_from_edge(edg))
        edges_from_face = [i for i in self.topo.edges_from_face(face)]
        self.assert_(len(edges_from_face) == self.topo.number_of_edges_from_face(face))

    def test_edge_wire(self):
        edg = self.topo.edges().next()
        wire = self.topo.wires().next()
        wires_from_edge = [i for i in self.topo.wires_from_edge(edg)]
        self.assert_(len(wires_from_edge) == self.topo.number_of_wires_from_edge(edg))
        edges_from_wire = [i for i in self.topo.edges_from_wire(wire)]
        self.assert_(len(edges_from_wire) == self.topo.number_of_edges_from_wire(wire))

    def test_vertex_edge(self):
        vert = self.topo.vertices().next()
        verts_from_edge = [i for i in self.topo.vertices_from_edge(vert)]
        self.assert_(len(verts_from_edge) == self.topo.number_of_vertices_from_edge(vert))
        edges_from_vert = [ i for i in self.topo.edges_from_vertex(vert)]
        self.assert_(len(edges_from_vert) == self.topo.number_of_edges_from_vertex(vert))

    def test_vertex_face(self):
        vert = self.topo.vertices().next()
        face = self.topo.faces().next()
        faces_from_vertex = [i for i in self.topo.faces_from_vertex(vert)]
        self.assert_(len(faces_from_vertex) == self.topo.number_of_faces_from_vertex(vert))
        verts_from_face = [i for i in self.topo.vertices_from_face(face)]
        self.assert_(len(verts_from_face) == self.topo.number_of_vertices_from_face(face))

    def test_face_solid(self):
        face = self.topo.faces().next()
        solid = self.topo.solids().next()
        faces_from_solid = [i for i in self.topo.faces_from_solids(solid)]
        self.assert_(len(faces_from_solid) == self.topo.number_of_faces_from_solids(solid))
        solids_from_face = [i for i in self.topo.solids_from_face(face)]
        self.assert_(len(solids_from_face) == self.topo.number_of_solids_from_face(face))

    def test_wire_face(self):
        wire = self.topo.wires().next()
        face = self.topo.faces().next()
        faces_from_wire = [i for i in self.topo.faces_from_wire(wire)]
        self.assert_(len(faces_from_wire) == self.topo.number_of_faces_from_wires(wire))
        wires_from_face = [i for i in self.topo.wires_from_face(face)]
        self.assert_(len(wires_from_face) == self.topo.number_of_wires_from_face(face))

    def test_edges_out_of_scope(self):
        face = self.topo.faces().next()
        _edges = []
        for edg in Topo(face).edges():
            _edges.append(edg)
        for edg in _edges:
            self.assert_(edg.IsNull() == False)

    def test_wires_out_of_scope(self):
        face = self.topo.wires().next()
        _edges = []
        for edg in WireExplorer(face).ordered_edges():
            _edges.append(edg)
        for edg in _edges:
            self.assert_(edg.IsNull() == False)
开发者ID:imclab,项目名称:pythonocc,代码行数:95,代码来源:topology_unittest.py

示例5: Feringa

# 需要导入模块: from OCC.Utils.Topology import Topo [as 别名]
# 或者: from OCC.Utils.Topology.Topo import vertices [as 别名]
##Copyright 2008 Jelle Feringa ([email protected])
##
##This file is part of pythonOCC.
##
##pythonOCC is free software: you can redistribute it and/or modify
##it under the terms of the GNU Lesser General Public License as published by
##the Free Software Foundation, either version 3 of the License, or
##(at your option) any later version.
##
##pythonOCC is distributed in the hope that it will be useful,
##but WITHOUT ANY WARRANTY; without even the implied warranty of
##MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##GNU Lesser General Public License for more details.
##
##You should have received a copy of the GNU Lesser General Public License
##along with pythonOCC.  If not, see <http://www.gnu.org/licenses/>.
# A sample that shows how to generate the gear geometry according
# to knowledge
from OCC.BRepPrimAPI import *
from OCC.BRepFilletAPI import *
from OCC.TColgp import *
from OCC.gp import *
from OCC.TopExp import *
from OCC.BRep import *
from OCC.Utils.Topology import Topo
from OCC.Display.SimpleGui import *
display, start_display, add_menu, add_function_to_menu = init_display()

cube = BRepPrimAPI_MakeBox(100,100,100).Shape()
topo = Topo(cube)
开发者ID:dbarbier,项目名称:pythonocc,代码行数:32,代码来源:vertex_filleting.py


注:本文中的OCC.Utils.Topology.Topo.vertices方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。