• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python SimpleGui.init_display函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中OCC.Display.SimpleGui.init_display函数的典型用法代码示例。如果您正苦于以下问题:Python init_display函数的具体用法?Python init_display怎么用?Python init_display使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: main

def main(argv):
  step_reader = STEPControl_Reader()
  status = step_reader.ReadFile(argv[0])

  if status == IFSelect_RetDone:  # check status
      failsonly = False
      step_reader.PrintCheckLoad(failsonly, IFSelect_ItemsByEntity)
      step_reader.PrintCheckTransfer(failsonly, IFSelect_ItemsByEntity)

      number_of_roots = step_reader.NbRootsForTransfer()

      ok = False
      i = 1

      while not ok and i <= number_of_roots:
        ok = step_reader.TransferRoot(i)
        i += 1

      _nbs = step_reader.NbShapes()
      aResShape = step_reader.Shape(1)
  else:
      print("Error: can't read file.")
      sys.exit(0)

  display, start_display, add_menu, add_function_to_menu = init_display()
  display.DisplayShape(aResShape, update=True)
  start_display()
开发者ID:jdlubrano,项目名称:cad_volume,代码行数:27,代码来源:step_viewer.py


示例2: display_terrain

 def display_terrain(self):
     """
     Try to display terrain
     """
     display, start_display, add_menu, add_function_to_menu = init_display()
     display.EraseAll()
     display.DisplayShape(self.surface, update=True)
     for river in self.rivers.values():
         display.DisplayShape(river, update=True)
     start_display()
开发者ID:GeoMop,项目名称:PythonOCC_Examples,代码行数:10,代码来源:load_points-occ.py


示例3: update_display

  def update_display(self):
    if self.display_list == None:
      # returns: display, start_display, add_menu, add_function_to_menu
      from OCC.Display.SimpleGui import init_display
      self.display_list = init_display(self.display_driver)

    # ask all modules to add shapes to display
    display = self.display_list[0]
    display.EraseAll()
    for m in self.modules:
      self.modules[m].add_shapes(display = display)
开发者ID:MarcWeber,项目名称:vim-addon-pythonocc,代码行数:11,代码来源:vim_pythonocc_support.py


示例4: display_configuration

def display_configuration(tigl_handle):
    """
    This is an example how to use the internal tigl/pyocc API
    to display all wing and fuselage segments
    """

    from OCC.Display.SimpleGui import init_display

    # get the configuration manager
    mgr = tigl.configuration.CCPACSConfigurationManager_get_instance()

    # get the CPACS configuration, defined by the tigl handle
    # we need to access the underlying tigl handle (that is used in the C/C++ API)
    config = mgr.get_configuration(tigl_handle._handle.value)

    display, start_display, add_menu, add_function_to_menu = init_display()

    for ifuse in range(1, config.get_fuselage_count() + 1):
        fuselage = config.get_fuselage(ifuse)
        for isegment in range(1, fuselage.get_segment_count() + 1):
            segment = fuselage.get_segment(isegment)
            display.DisplayShape(segment.get_loft().shape(), update=True)

            mirrored_shape = segment.get_mirrored_loft()
            if mirrored_shape is not None:
                display.DisplayShape(mirrored_shape.shape(), update=True)

    for iwing in range(1, config.get_wing_count() + 1):
        wing = config.get_wing(iwing)

        for isegment in range(1, wing.get_segment_count() + 1):
            segment = wing.get_segment(isegment)

            display.DisplayShape(segment.get_loft().shape(), update=True)

            mirrored_shape = segment.get_mirrored_loft()
            if mirrored_shape is not None:
                display.DisplayShape(mirrored_shape.shape(), update=True)

    for iobj in range(1, config.get_external_object_count()+1):
        obj = config.get_external_object(iobj)
        shape = obj.get_loft()

        if shape is not None:
            display.DisplayShape(shape.shape(), update=True)

        mirrored_shape = obj.get_mirrored_loft()

        if mirrored_shape is not None:
            display.DisplayShape(mirrored_shape.shape(), update=True)

    display.FitAll()

    start_display()
开发者ID:DLR-SC,项目名称:tigl,代码行数:54,代码来源:example_visualization.py


示例5: solid_compound

def solid_compound(filename=None):
    """
    Generate and display solid object created from bspline surface.
    """

    # Create Builder first
    builder = BRep_Builder()

    # Base box
    points_1 = [
        gp_Pnt(0.0, 0.0, 0.0),
        gp_Pnt(1.0, 0.0, 0.0),
        gp_Pnt(1.0, 1.0, 0.0),
        gp_Pnt(0.0, 1.0, 0.0),
        gp_Pnt(0.0, 0.0, 1.0),
        gp_Pnt(1.0, 0.0, 1.0),
        gp_Pnt(1.0, 1.0, 1.0),
        gp_Pnt(0.0, 1.0, 1.0)
    ]
    
    solid_box1 = make_box(builder, points_1)
  
    compound = TopoDS_Compound()
    builder.MakeCompound(compound)
    builder.Add(compound, solid_box1)

    base_primitives = brep_explorer.shape_disassembly(solid_box1)

    # Get some testing elements
    face = base_primitives[4].values()[0]
    wire = wires_of_face(face)[0]
    edges = edges_of_wire(wire)
    for ed_id, edge in enumerate(edges):
        print('edge', ed_id, edge.Orientation())
        verts = verts_of_edge(edge)
        for vert in verts:
            coo = coords_from_vert(vert)
            print(coo, vert.Orientation())

    print('Final compound')
    stat = brep_explorer.create_shape_stat(compound)
    brep_explorer.print_stat(stat)

    if filename is not None:
         breptools_Write(compound, filename)

    display, start_display, add_menu, add_function_to_menu = init_display()
    display.EraseAll()

    display.DisplayShape(solid_box1, color='red', update=True)

    start_display()
开发者ID:GeoMop,项目名称:PythonOCC_Examples,代码行数:52,代码来源:orientation_experiment.py


示例6: test_with_viewer_after

 def test_with_viewer_after():
     # create parameters
     p = Parameters()
     c = ParametricModelingContext(p)
     # create simple box
     p.X1, p.Y1, p.Z1, p.X2, p.Y2, p.Z2, p.RADIUS = 12,70,12,30,30,30,4  
     my_pnt1 = c.basic_operations.MakePointXYZ(p.X1,p.Y1,p.Z1, name="Pnt1", show=True)
     my_pnt2 = c.basic_operations.MakePointXYZ(p.X2,p.Y2,p.Z2, name="Pnt2", show=True)   # Create the second point
     my_box = c.prim_operations.MakeBoxTwoPnt(my_pnt1,my_pnt2,name="Box1", show=True)
     #Init display after geometry is created
     from OCC.Display.SimpleGui import init_display
     display, start_display, add_menu, add_function_to_menu = init_display()
     c.set_display(display)
     start_display()
开发者ID:ashoka2015,项目名称:pythonocc,代码行数:14,代码来源:Context.py


示例7: display_result

def display_result(shapes):
    """
    Display results
    """
    display, start_display, add_menu, add_function_to_menu = init_display()
    display.EraseAll()

    # Display results
    colors = ['red', 'green', 'blue', 'yellow', 'orange']
    col_len = len(colors)
    for color_id, shape in enumerate(shapes):
        _color_id = color_id % col_len
        ais_shell = display.DisplayShape(shape, color=colors[_color_id], update=True)
        # display.Context.SetTransparency(ais_shell, 0.7)
    start_display()
开发者ID:GeoMop,项目名称:PythonOCC_Examples,代码行数:15,代码来源:bspline_solid_boolean.py


示例8: test_with_viewer

 def test_with_viewer():
      # init viewer
     from OCC.Display.SimpleGui import init_display
     display, start_display, add_menu, add_function_to_menu = init_display()
     # create parameters
     p = Parameters()
     # create parametric modeling context
     c = ParametricModelingContext(p)
     # set graphics
     c.set_display(display)
     # create simple box
     p.X1, p.Y1, p.Z1, p.X2, p.Y2, p.Z2, p.RADIUS = 12, 70, 12, 30, 30, 30, 4  
     my_pnt1 = c.basic_operations.MakePointXYZ(p.X1, p.Y1, p.Z1, name="Pnt1", show=True)
     my_pnt2 = c.basic_operations.MakePointXYZ(p.X2, p.Y2, p.Z2, name="Pnt2", show=True)
     my_box = c.prim_operations.MakeBoxTwoPnt(my_pnt1, my_pnt2, name="Box1", show=True)
开发者ID:ashoka2015,项目名称:pythonocc,代码行数:15,代码来源:Context.py


示例9: show

	def show(self, show_file=None):
		"""
		Method to show a file. If `show_file` is not given it plots `self.shape`.

		:param string show_file: the filename you want to show.
		"""
		if show_file is None:
			shape = self.shape
		else:
			shape = self.load_shape_from_file(show_file)

		display, start_display, __, __ = init_display()
		display.FitAll()
		display.DisplayShape(shape, update=True)

		# Show the plot to the screen
		start_display()
开发者ID:e-dub,项目名称:PyGeM,代码行数:17,代码来源:nurbshandler.py


示例10: visualise

def visualise(occtopo_2dlist, colour_list = None, backend = "qt-pyqt5"):
    """
    This function visualise a 3D model using the PythonOCC viewer.
 
    Parameters
    ----------
    occtopo_2dlist : 2d list of OCCtopologies
        Geometries to be visualised together with the results.
        OCCtopology includes: OCCshape, OCCcompound, OCCcompsolid, OCCsolid, OCCshell, OCCface, OCCwire, OCCedge, OCCvertex 
        
    colour_list : list of str, optional
        The colours of the occtopo_2dlist, Default = None. If None all the geometries are displayed in white.
        The colour strings include: "WHITE", "BLUE", "RED", "GREEN", "YELLOW", "CYAN", "BLACK", "ORANGE". 
        The number of colours must correspond to the number of list in the other_topo2dlist. 
        
    backend : str, optional
        The graphic interface to use for visualisation, Default = qt-pyqt5. Other options include:"qt-pyqt4", "qt-pyside", "wx"
        
    Returns
    -------
    None : None
        A qt window pops up displaying the geometries.
    """       
    display, start_display, add_menu, add_function_to_menu = init_display(backend_str = backend)
    
    if colour_list == None:
        colour_list = []
        for _ in range(len(occtopo_2dlist)):
            colour_list.append("WHITE")
            
    sc_cnt = 0
    for shape_list in occtopo_2dlist:
        compound = construct.make_compound(shape_list)
        colour = colour_list[sc_cnt]
        display.DisplayColoredShape(compound, color = colour, update=True)
        sc_cnt+=1
        
    display.set_bg_gradient_color(250, 250, 250, 250, 250, 250)
    display.View_Iso()
    display.FitAll()
    start_display()
开发者ID:chenkianwee,项目名称:envuo,代码行数:41,代码来源:utility.py


示例11: display_results

def display_results(occ_bspline, points):
    """
    Try to display OCC
    :param occ_bspline:
    :param points:
    :return:
    """

    # Initialize displaying
    from OCC.Display.SimpleGui import init_display
    display, start_display, add_menu, add_function_to_menu = init_display()
    display.EraseAll()

    # Draw b-spline surfaces
    display.DisplayShape(occ_bspline.GetHandle(), update=True)

    # # Draw points of B-Spline
    import OCC.Prs3d
    import OCC.Quantity
    import OCC.Graphic3d
    import OCC.Aspect
    import OCC.gp

    a_presentation = OCC.Prs3d.Prs3d_Presentation(display._struc_mgr)
    group = OCC.Prs3d.Prs3d_Root_CurrentGroup(a_presentation.GetHandle()).GetObject()
    black = OCC.Quantity.Quantity_Color(OCC.Quantity.Quantity_NOC_BLACK)
    asp = OCC.Graphic3d.Graphic3d_AspectLine3d(black, OCC.Aspect.Aspect_TOL_SOLID, 1)

    gg = OCC.Graphic3d.Graphic3d_ArrayOfPoints(len(points),
                                               False,  # hasVColors
                                               )

    for point in points:
        pnt = OCC.gp.gp_Pnt(point[0], point[1], point[2])
        gg.AddVertex(pnt)

    group.SetPrimitivesAspect(asp.GetHandle())
    group.AddPrimitiveArray(gg.GetHandle())
    a_presentation.Display()

    start_display()
开发者ID:GeoMop,项目名称:bapprox,代码行数:41,代码来源:test_terrain_approx.py


示例12: split_shape

def split_shape(event=None):
    """
    Example of spliting shape
    """
    display, start_display, add_menu, add_function_to_menu = init_display()

    S = BRepPrimAPI_MakeBox(gp_Pnt(-100, -60, -80), 150, 200, 170).Shape()
    asect = BRepAlgoAPI_Section(S, gp_Pln(1, 2, 1, -15), False)
    asect.ComputePCurveOn1(True)
    asect.Approximation(True)
    asect.Build()
    R = asect.Shape()

    asplit = BRepFeat_SplitShape(S)

    wire1 = BRepBuilderAPI_MakeWire()

    i = 0
    for edg in Topo(R).edges():
        print(edg)
        face = TopoDS_Face()
        if asect.HasAncestorFaceOn1(edg, face):
            print('Adding edge on face and wire: ', face, i)
            asplit.Add(edg, face)
            # Add edge to wire
            if i > 0:
                wire1.Add(edg)
        i += 1
    asplit.Build()
    wire1.Build()

    display.EraseAll()
    display.DisplayShape(asplit.Shape())
    display.DisplayShape(wire1.Shape(), color='blue')
    # display.FitAll()

    start_display()

    breptools_Write(asplit.Shape(), "split1.brep")
开发者ID:GeoMop,项目名称:PythonOCC_Examples,代码行数:39,代码来源:bspline_surface_split.py


示例13: show

	def show(self, show_file=None):
		"""
		Method to show an iges file. If `show_file` is not given it plots `self.infile`.

		:param string show_file: the iges filename you want to show.
		"""
		if show_file is None:
			show_file = self.infile
		else:
			self._check_filename_type(show_file)

		# read in the IGES file
		reader = IGESControl_Reader()
		reader.ReadFile(show_file)
		reader.TransferRoots()
		shape = reader.Shape()

		display, start_display, __, __ = init_display()
		display.FitAll()
		display.DisplayShape(shape, update=True)

		# Show the plot to the screen
		start_display()
开发者ID:fsalmoir,项目名称:PyGeM,代码行数:23,代码来源:igeshandler.py


示例14: print

##along with pythonOCC.  If not, see <http://www.gnu.org/licenses/>.

from __future__ import print_function

import sys
print(sys.path)
# required by travis to find SimpleGui module
# both on py2 and py3
sys.path.append('/home/travis/virtualenv/python2.7.8/lib/python2.7/site-packages')
sys.path.append('/home/travis/virtualenv/python3.3.5/lib/python3.3/site-packages')
from OCC.Display.SimpleGui import init_display
from OCC.BRepPrimAPI import BRepPrimAPI_MakeBox

# pyside test
print('pyside test')
pyside_display, start_display, add_menu, add_function_to_menu = init_display('qt-pyside')
my_box_1 = BRepPrimAPI_MakeBox(10., 20., 30.).Shape()
pyside_display.DisplayShape(my_box_1, update=True)

# pyqt4 test
print('pyqt4 test')
pyqt4_display, start_display, add_menu, add_function_to_menu = init_display('qt-pyqt4')
my_box_2 = BRepPrimAPI_MakeBox(10., 20., 30.).Shape()
pyqt4_display.DisplayShape(my_box_2, update=True)

# wx test
print('wx test')
wx_display, start_display, add_menu, add_function_to_menu = init_display('wx')
my_box_3 = BRepPrimAPI_MakeBox(10., 20., 30.).Shape()
wx_display.DisplayShape(my_box_3, update=True)
开发者ID:alfonsotames,项目名称:pythonocc-core,代码行数:30,代码来源:core_display_unittest.py


示例15: __init__

 def __init__(self):
     self.display, self.start_display, self.add_menu, self.add_function_to_menu = init_display()
开发者ID:NiSchultz,项目名称:pythonocc,代码行数:2,代码来源:base.py


示例16: solid_compound

def solid_compound(filename=None):
    """
    Generate and display solid object created from b-spline surface.
    """

    # Create Builder first
    builder = BRep_Builder()

    # Base box
    points_1 = [
        gp_Pnt(0.0, 0.0, 0.0),
        gp_Pnt(1.0, 0.0, 0.0),
        gp_Pnt(1.0, 1.0, 0.0),
        gp_Pnt(0.0, 1.0, 0.0),
        gp_Pnt(0.0, 0.0, 1.0),
        gp_Pnt(1.0, 0.0, 1.0),
        gp_Pnt(1.0, 1.0, 1.0),
        gp_Pnt(0.0, 1.0, 1.0)
    ]

    # Definition of boxes used for splitting base box
    dx = 0.5
    dy = 0.01
    dz = 0.01
    points_2 = [
        gp_Pnt(0.0+dx, 0.0-dy, 0.0-dz),
        gp_Pnt(1.0+dx, 0.0-dy, 0.0-dz),
        gp_Pnt(1.0+dx, 1.0+dy, 0.0-dz),
        gp_Pnt(0.0+dx, 1.0+dy, 0.0-dz),
        gp_Pnt(0.0+dx, 0.0-dy, 1.0+dz),
        gp_Pnt(1.0+dx, 0.0-dy, 1.0+dz),
        gp_Pnt(1.0+dx, 1.0+dy, 1.0+dz),
        gp_Pnt(0.0+dx, 1.0+dy, 1.0+dz)
    ]
    
    solids = make_two_boxes(builder, points_1, points_2)

    solids, dup_faces = remove_duple_face_shapes(solids[0], (solids[1],))

    # It would be logical to create "compsolid". Composition of solids sharing
    # one common face, but I did find any Python nor C++ example creating such
    # object.
    #
    # Following code does not work, because builder.Add(compsolid, solids[0])
    # raises error:
    # RuntimeError: TopoDS_UnCompatibleShapes
    # ... it also does not accept shells. OCC is simply horrible library!
    #
    # compsolid = TopoDS_CompSolid()
    # builder.MakeCompSolid(compsolid)
    # builder.Add(compsolid, solids[0])
    # builder.Add(compsolid, solids[1])

    compound = TopoDS_Compound()
    builder.MakeCompound(compound)
    # builder.Add(compound, compsolid)
    builder.Add(compound, solids[0])
    builder.Add(compound, solids[1])

    print('Final compound')
    stat = brep_explorer.create_shape_stat(compound)
    brep_explorer.print_stat(stat)

    if filename is not None:
         breptools_Write(compound, filename)

    display, start_display, add_menu, add_function_to_menu = init_display()
    display.EraseAll()

    display.DisplayShape(solids[0], color='red', update=True)
    display.DisplayShape(solids[1], color='blue', update=True)

    start_display()
开发者ID:GeoMop,项目名称:PythonOCC_Examples,代码行数:73,代码来源:bspline_solid_boolean_simple.py


示例17: bspline_surface

def bspline_surface():
    """
    Try to create B-spline surface directly
    """

    # Set U and V degree to 2
    udeg = 2
    vdeg = 2

    # Non-periodic surface
    uperiod = False
    vperiod = False

    # Create 2D array of poles (control points)
    poles = TColgp_Array2OfPnt(1, 3, 1, 3)
    poles.SetValue(1, 1, gp_Pnt(1, 1, 1))
    poles.SetValue(1, 2, gp_Pnt(2, 1, 2))
    poles.SetValue(1, 3, gp_Pnt(3, 1, 1))
    poles.SetValue(2, 1, gp_Pnt(1, 2, 1))
    poles.SetValue(2, 2, gp_Pnt(2, 2, 2))
    poles.SetValue(2, 3, gp_Pnt(3, 2, 0))
    poles.SetValue(3, 1, gp_Pnt(1, 3, 2))
    poles.SetValue(3, 2, gp_Pnt(2, 3, 1))
    poles.SetValue(3, 3, gp_Pnt(3, 3, 0))

    # Create 2D array of weights
    weights = TColStd_Array2OfReal(1, 3, 1, 3)
    weights.SetValue(1, 1, 1.0)
    weights.SetValue(1, 2, 1.0)
    weights.SetValue(1, 3, 1.0)
    weights.SetValue(2, 1, 1.0)
    weights.SetValue(2, 2, 1.0)
    weights.SetValue(2, 3, 1.0)
    weights.SetValue(3, 1, 1.0)
    weights.SetValue(3, 2, 1.0)
    weights.SetValue(3, 3, 1.0)

    # Length of uknots and umult has to be same
    # Same rule is for vknots and vmult
    uknot_len = umult_len = 2
    vknot_len = vmult_len = 2

    # Knots for U and V direction
    uknots = TColStd_Array1OfReal(1, uknot_len)
    vknots = TColStd_Array1OfReal(1, vknot_len)

    # Main curves begins and ends at first and last points
    uknots.SetValue(1, 0.0)
    uknots.SetValue(2, 1.0)
    vknots.SetValue(1, 0.0)
    vknots.SetValue(2, 1.0)

    # Multiplicities for U and V direction
    umult = TColStd_Array1OfInteger(1, umult_len)
    vmult = TColStd_Array1OfInteger(1, vmult_len)

    # First and last multiplicities are set to udeg + 1 (vdeg respectively),
    # because we want main curves to start and finish on the first and
    # the last points
    umult.SetValue(1, udeg + 1)
    umult.SetValue(2, udeg + 1)
    vmult.SetValue(1, vdeg + 1)
    vmult.SetValue(2, vdeg + 1)

    # Some other rules, that has to hold:
    # poles.ColLength == sum(umult(i)) - udeg - 1 (e.g.: 3 == 6 - 2 - 1)

    # Try to create surface (no weight)
    #BSPLSURF = Geom_BSplineSurface(poles, uknots, vknots, umult, vmult, udeg, vdeg, uperiod, vperiod)
    # Try to create surface (weights to default values)
    BSPLSURF = Geom_BSplineSurface(poles, weights, uknots, vknots, umult, vmult, udeg, vdeg, uperiod, vperiod)

    # Display surface
    from OCC.Display.SimpleGui import init_display
    display, start_display, add_menu, add_function_to_menu = init_display()
    display.EraseAll()
    display.DisplayShape(BSPLSURF.GetHandle(), update=True)
    start_display()
开发者ID:GeoMop,项目名称:PythonOCC_Examples,代码行数:78,代码来源:bspline_surface_pure.py


示例18: display_shapes

def display_shapes(shapes):
  from OCC.Display.SimpleGui import init_display
  display, start_display, add_menu, add_function_to_menu = init_display()
  [display.DisplayShape(shape, update=True) for shape in shapes]
  start_display()
开发者ID:jdlubrano,项目名称:cad_volume,代码行数:5,代码来源:volume.py


示例19: run

def run(n_procs, compare_by_number_of_processors=False):
    shape = get_brep()
    x_min, y_min, z_min, x_max, y_max, z_max = get_boundingbox(shape)
    z_delta = abs(z_min - z_max)

    init_time = time.time()  # for total time computation

    def get_z_coords_for_n_procs(n_slices, n_procs):
        z_slices = drange(z_min, z_max, z_delta/n_slices)

        slices = []
        n = len(z_slices) // n_procs

        _str_slices = []
        for i in range(1, n_procs+1):
            if i == 1:
                slices.append(z_slices[:i*n])
                _str_slices.append(':'+str(i*n)+' ')
            elif i == n_procs:
                # does a little extra work if the number of slices
                # isnt divisible by n_procs
                slices.append(z_slices[(i-1)*n:])
                _str_slices.append(str((i-1)*n)+': ')
                print('last slice', len(z_slices[(i-1)*n:]))
            else:
                slices.append(z_slices[(i-1)*n:i*n])
                _str_slices.append(' %s:%s ' % ((i-1)*n, i*n))
        print('the z-index array is sliced over %s processors like this: \n %s' % (n_procs, _str_slices))
        print('number of slices:', z_slices[-1])
        return slices

    def arguments(n_slices, n_procs):
        _tmp = []
        slices = get_z_coords_for_n_procs(n_slices, n_procs)
        for i in slices:
            _tmp.append([i, shape])
        return _tmp

    n_slice = 50

    if not compare_by_number_of_processors:
        _results = []
        P = processing.Pool(n_procs)
        _results = P.map(vectorized_slicer, arguments(n_slice, n_procs))

    else:
        arr = [[i, shape] for i in drange(z_min, z_max, z_delta/n_slice)]
        for i in range(1, 9):
            tA = time.time()
            _results = []
            if i == 1:
                _results = vectorized_slicer([drange(z_min, z_max, z_delta/n_slice), shape])
            else:
                P = processing.Pool(n_procs)
                _results = P.map(vectorized_slicer, arguments(n_slice, i))
            print('slicing took %s seconds for %s processors' % (time.time() - tA, i))
        sys.exit()

    print('\n\n\n DONE SLICING ON %i CORES \n\n\n' % nprocs)

    # Display result
    display, start_display, add_menu, add_function_to_menu = init_display()
    print('displaying original shape')
    display.DisplayShape(shape)
    for n, result_shp in enumerate(_results):
        print('displaying results from process {0}'.format(n))
        display.DisplayShape(result_shp, update=True)

    # update viewer when all is added:
    display.Repaint()
    total_time = time.time() - init_time
    print("%s necessary to perform slice with %s processor(s)." % (total_time, n_procs))
    start_display()
开发者ID:CrazyHeex,项目名称:pythonocc-core,代码行数:73,代码来源:core_parallel_slicer.py


示例20: have_pyqt4

##
##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/>.

from __future__ import print_function
import sys

from OCC.Display.backend import have_pyqt4
from OCC.Display.SimpleGui import init_display
from OCC.BRepPrimAPI import BRepPrimAPI_MakeBox

# check for pyqt4
if not have_pyqt4():
    print("pyqt4 required to run this test")
    sys.exit()

print('pyqt4 test')
pyqt4_display, start_display, add_menu, add_function_to_menu = init_display('qt-pyqt4')
my_box_1 = BRepPrimAPI_MakeBox(10., 20., 30.).Shape()
pyqt4_display.DisplayShape(my_box_1, update=True)
开发者ID:anwar-hegazy,项目名称:pythonocc-core,代码行数:30,代码来源:core_display_pyqt4_unittest.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python Context.assert_isdone函数代码示例发布时间:2022-05-24
下一篇:
Python Numeric.zeros函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap