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


Python Part.makeBox方法代码示例

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


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

示例1: execute

# 需要导入模块: import Part [as 别名]
# 或者: from Part import makeBox [as 别名]
def execute(self, fp):
    O=FreeCAD.Vector(0,0,0)
    vectL=FreeCAD.Vector(fp.L,0,0)
    vectW=FreeCAD.Vector(0,fp.W,0)
    vectH=FreeCAD.Vector(0,0,fp.H)
    base=[vectL,vectW,vectH]
    outline=[]
    for i in range(3):
      f1=Part.Face(Part.makePolygon([O,base[0],base[0]+base[1],base[1],O]))
      outline.append(f1)
      f2=f1.copy()
      f2.translate(base[2])
      outline.append(f2)
      base.append(base.pop(0))
    box=Part.Solid(Part.Shell(outline))
    tank=box.makeThickness([box.Faces[0],box.Faces[2]],-fp.thk1,1.e-3)
    top=Part.makeBox(fp.L-2*fp.thk1,fp.W-2*fp.thk1,fp.thk2,FreeCAD.Vector(fp.thk1,fp.thk1,fp.H-2*fp.thk2))
    fp.Shape=Part.makeCompound([tank,top]) 
开发者ID:oddtopus,项目名称:flamingo,代码行数:20,代码来源:pipeFeatures.py

示例2: box

# 需要导入模块: import Part [as 别名]
# 或者: from Part import makeBox [as 别名]
def box(x, y, z, rounding=None):
    """Create a box, optionally rounding the edges

    Parameters
    ----------
    x, y, z: float
        Size of the box in 3 dimensions
    rounding: float, optional
        If specified, the edges will be rounded with this radius
    """
    box = Part.makeBox(x, y, z)

    centre = FreeCAD.Vector(-0.5*x, -0.5*y, -0.5*z)
    box.Placement.Base = centre

    if rounding is not None:
        box = box.makeFillet(rounding, box.Edges)
    return box


#bar = box(500, 150, 200, 10)
#mesh = freecad_mesh(bar)

#MeshPart.meshFromShape(box,GrowthRate=0.3,SegPerEdge=1,SegPerRadius=2,SecondOrder=0,Optimize=1,AllowQuad=0) 
开发者ID:DavidPowell,项目名称:OpenModes,代码行数:26,代码来源:freecad.py

示例3: check_limit_z

# 需要导入模块: import Part [as 别名]
# 或者: from Part import makeBox [as 别名]
def check_limit_z(tab_face, width, pos_y, material_face, material_plane):
    box_x_size = material_plane.thickness / 2.0 # OK
    box_y_size = width / 2.0
    box_z_size = 0.1

    box_z_plus = Part.makeBox(box_x_size, box_y_size, box_z_size)
    box_z_plus.translate(FreeCAD.Vector(0.005, pos_y - box_y_size/2.0, material_face.thickness / 2.0))

    box_z_minus = Part.makeBox(box_x_size, box_y_size, box_z_size)
    box_z_minus.translate(FreeCAD.Vector(0.005, pos_y - box_y_size/2.0, -box_z_size - material_face.thickness / 2.0))

    z_plus_inside, toto1 = check_intersect(box_z_plus, tab_face, material_plane)
    z_minus_inside, toto2 = check_intersect(box_z_minus, tab_face, material_plane)

    #shapeobj = FreeCAD.ActiveDocument.addObject("Part::Feature","tstupdds_plus")
    #shapeobj.Shape = toto1
    #FreeCAD.ActiveDocument.recompute()

    #shapeobj = FreeCAD.ActiveDocument.addObject("Part::Feature","tstupddsd_minus")
    #shapeobj.Shape = toto2
    #FreeCAD.ActiveDocument.recompute()
    #print("z plus %r, minus %r" % (z_plus_inside, z_minus_inside))

    return z_plus_inside, z_minus_inside 
开发者ID:execuc,项目名称:LCInterlocking,代码行数:26,代码来源:helper.py

示例4: check_limit_y

# 需要导入模块: import Part [as 别名]
# 或者: from Part import makeBox [as 别名]
def check_limit_y(tab_face, height, pos_y, width, material_plane):
    box_x_size = material_plane.thickness / 2.0 # OK
    box_y_size = 0.1
    box_z_size = height / 2.0

    box_y_minus = Part.makeBox(box_x_size, box_y_size, box_z_size)
    box_y_minus.translate(FreeCAD.Vector(0.005, pos_y - width/2.0 - box_y_size, -box_z_size / 2.0))

    box_y_plus = Part.makeBox(box_x_size, box_y_size, box_z_size)
    box_y_plus.translate(FreeCAD.Vector(0.005, pos_y + width/2.0, -box_z_size / 2.0))

    y_plus_inside, toto1 = check_intersect(box_y_plus, tab_face, material_plane)
    y_minus_inside, toto2 = check_intersect(box_y_minus, tab_face, material_plane)

    #shapeobj = FreeCAD.ActiveDocument.addObject("Part::Feature","y_plus_inside")
    #shapeobj.Shape = toto1
    #FreeCAD.ActiveDocument.recompute()

    #shapeobj = FreeCAD.ActiveDocument.addObject("Part::Feature","y_minus_inside")
    #shapeobj.Shape = toto2
    #FreeCAD.ActiveDocument.recompute()
    #print("y plus %r, minus %r" % (y_plus_inside, y_minus_inside))

    return y_plus_inside, y_minus_inside 
开发者ID:execuc,项目名称:LCInterlocking,代码行数:26,代码来源:helper.py

示例5: check_limit_y_on_for_tab

# 需要导入模块: import Part [as 别名]
# 或者: from Part import makeBox [as 别名]
def check_limit_y_on_for_tab(tab_face, height, pos_y, width, thickness, material_face):
    box_x_size = thickness / 2.0 # OK
    box_y_size = 0.1
    box_z_size = height / 2.0

    box_y_minus = Part.makeBox(box_x_size, box_y_size, box_z_size)
    box_y_minus.translate(FreeCAD.Vector(-0.005 - box_x_size, pos_y - width/2.0 - box_y_size, -box_z_size / 2.0))

    box_y_plus = Part.makeBox(box_x_size, box_y_size, box_z_size)
    box_y_plus.translate(FreeCAD.Vector(-0.005 - box_x_size, pos_y + width/2.0, -box_z_size / 2.0))

    y_plus_inside, toto1 = check_intersect(box_y_plus, tab_face, material_face)
    y_minus_inside, toto2 = check_intersect(box_y_minus, tab_face, material_face)

    #shapeobj = FreeCAD.ActiveDocument.addObject("Part::Feature","y_plus_inside")
    #shapeobj.Shape = toto1
    #FreeCAD.ActiveDocument.recompute()

    #shapeobj = FreeCAD.ActiveDocument.addObject("Part::Feature","y_minus_inside")
    #shapeobj.Shape = toto2
    #FreeCAD.ActiveDocument.recompute()
    #print("y plus %r, minus %r" % (y_plus_inside, y_minus_inside))

    return y_plus_inside, y_minus_inside 
开发者ID:execuc,项目名称:LCInterlocking,代码行数:26,代码来源:helper.py

示例6: execute

# 需要导入模块: import Part [as 别名]
# 或者: from Part import makeBox [as 别名]
def execute(self, fp):
    '''"Print a short message when doing a recomputation, this method is mandatory" '''
    #fp.Shape = Part.makeBox(1,1,1 + len(fp.diameters))
    origshape = fp.baseObject[0].Shape
    shape = origshape
    for diam in fp.diameters:
      FreeCAD.Console.PrintLog("Generating hole tool for: " + diam + "\n")
      edge, m, f, o, type = cshSplitEdgeDiam(diam)
      cshole = cshMakeCSHole(m, type)
      FastenerBase.FSMoveToObject(cshole, origshape.getElement(edge), f == '1', float(o))
      shape = shape.cut(cshole)
    fp.Shape = shape 
开发者ID:shaise,项目名称:FreeCAD_FastenersWB,代码行数:14,代码来源:CountersunkHoles.py

示例7: makeBox

# 需要导入模块: import Part [as 别名]
# 或者: from Part import makeBox [as 别名]
def makeBox(cls, length, width, height, pnt=Vector(0, 0, 0), dir=Vector(0, 0, 1)):
        """
        makeBox(length,width,height,[pnt,dir]) -- Make a box located in pnt with the dimensions (length,width,height)
        By default pnt=Vector(0,0,0) and dir=Vector(0,0,1)'
        """
        return Shape.cast(FreeCADPart.makeBox(length, width, height, pnt.wrapped, dir.wrapped)) 
开发者ID:jmwright,项目名称:cadquery-freecad-module,代码行数:8,代码来源:shapes.py

示例8: create_flat_connection

# 需要导入模块: import Part [as 别名]
# 或者: from Part import makeBox [as 别名]
def create_flat_connection(hinge_properties, referentiel_face):
    box_x_size = hinge_properties.arc_length
    box_y_size = hinge_properties.extrustion_vector.Length
    box_z_size = hinge_properties.thickness
    box = Part.makeBox(box_x_size, box_y_size, box_z_size, FreeCAD.Vector(0., -box_y_size/2.0, -box_z_size/2.0))

    flat_connection = transform(box, referentiel_face)

    return flat_connection 
开发者ID:execuc,项目名称:LCInterlocking,代码行数:11,代码来源:makehinges.py

示例9: create_hole_hinge

# 需要导入模块: import Part [as 别名]
# 或者: from Part import makeBox [as 别名]
def create_hole_hinge(hinge_clearance, hinge_length, thickness, kerf_diameter):
    height = thickness * 2.0
    hinge_width = max(10e-3, hinge_clearance - kerf_diameter)
    if hinge_clearance < kerf_diameter:
        raise ValueError("Hinge clearance is less than kerf diameter")
    elif hinge_clearance < 2. * kerf_diameter:
        box_length = hinge_length - kerf_diameter
        hinge = Part.makeBox(hinge_width, box_length, height, FreeCAD.Vector(-hinge_width/2.0, -box_length/2.0, -height/2.0))
    else:
        box_length = hinge_length - hinge_width - kerf_diameter # hinge_width is for the two corner radius
        hinge = draw_rounded_hinge(hinge_width, box_length, height)

    return hinge 
开发者ID:execuc,项目名称:LCInterlocking,代码行数:15,代码来源:makehinges.py

示例10: screw_way_on_face

# 需要导入模块: import Part [as 别名]
# 或者: from Part import makeBox [as 别名]
def screw_way_on_face(material_face, material_plane, screw_nut_spec, pos_y, dog_bone=False):
    # horizontal hole
    vert_corrected_length = screw_nut_spec.screw_length - material_plane.thickness \
                            + material_plane.thickness_tolerance + screw_nut_spec.screw_length_tol
    corrected_width = screw_nut_spec.screw_diameter * 1.2 - material_face.laser_beam_diameter
    corrected_height = material_face.thickness  # + materialFace.tolerance
    screw_hole = Part.makeBox(vert_corrected_length, corrected_width, corrected_height,
                              FreeCAD.Vector(0.,
                                             -corrected_width / 2.0, -corrected_height / 2.0))
    if dog_bone:
        screw_hole = helper.make_dog_bone_on_limits_on_xy(screw_hole, corrected_height, True)
    x_pos = -vert_corrected_length
    screw_hole.translate(FreeCAD.Vector(x_pos, pos_y, 0))
    # Nut hole
    corrected_length = screw_nut_spec.nut_height - material_face.laser_beam_diameter + 0.1
    corrected_width = screw_nut_spec.nut_flat_flat - material_face.laser_beam_diameter + 0.1
    nut_hole = Part.makeBox(corrected_length, corrected_width, corrected_height,
                            FreeCAD.Vector(0,
                                           -corrected_width / 2.0, -corrected_height / 2.0))
    x_pos = -vert_corrected_length + screw_nut_spec.nut_height + screw_nut_spec.screw_length_tol
    nut_hole.translate(FreeCAD.Vector(x_pos, pos_y, 0))
    if dog_bone:
        nut_hole = helper.make_dog_bone_on_limits_on_xy(nut_hole, corrected_height)
    hole = screw_hole.fuse(nut_hole)
    return hole


#            X (Length)
#            |
#            |
#            |
#            |Z (Height)
#            ---------------------------> Y (Width)
# X est vers le haut
# Y est aligné sur la face
# Z est devant la camera 
开发者ID:execuc,项目名称:LCInterlocking,代码行数:38,代码来源:join.py

示例11: tab_join_create_tab_on_face

# 需要导入模块: import Part [as 别名]
# 或者: from Part import makeBox [as 别名]
def tab_join_create_tab_on_face(material_face, material_plane, width, pos_y, tab_face, dog_bone=False):

    y_plus_inside, y_minus_inside = helper.check_limit_y_on_for_tab(tab_face, material_face.thickness, pos_y, width,
                                                                    material_plane.thickness, material_face)
    # X Rien pr l'instant, mais on peut prendre en compte l'epaiseur variante de la piece opposé => length
    # Y Ajout d'un Kerf => width
    # Z Rien => height
    corrected_length = material_plane.thickness
    # corrected_width = width + materialFace.laser_beam_diameter
    corrected_height = material_face.thickness

    corrected_width = width  # - materialPlane.laser_beam_diameter
    corrected_width_center = corrected_width / 2.0
    if y_minus_inside and y_plus_inside:
        corrected_width += material_face.laser_beam_diameter
        corrected_width_center = corrected_width / 2.0
    elif y_minus_inside:
        corrected_width += material_face.laser_beam_diameter / 2.0
        corrected_width_center = (corrected_width + material_face.laser_beam_diameter / 2.0) / 2.0
    elif y_plus_inside:
        corrected_width += material_face.laser_beam_diameter / 2.0
        corrected_width_center = (corrected_width - material_face.laser_beam_diameter / 2.0) / 2.0

    #origin = FreeCAD.Vector(-corrected_length / 2.0, -corrected_width_center, -corrected_height / 2.0)
    origin = FreeCAD.Vector(0., -corrected_width_center, -corrected_height / 2.0)
    tab = Part.makeBox(corrected_length, corrected_width, corrected_height, origin)
    tab.translate(FreeCAD.Vector(0, pos_y, 0))

    hole = None
    left_hole = None
    right_hole = None

    if dog_bone:
        radius = min(corrected_width, corrected_length) * 2 / 30.
        if y_minus_inside:
            left_hole = Part.makeCylinder(radius, corrected_height,
                                          FreeCAD.Vector(0, -corrected_width_center + pos_y, -corrected_height / 2.0),
                                          FreeCAD.Vector(0, 0, 1.))
        if y_plus_inside:
            right_hole = Part.makeCylinder(radius, corrected_height,
                                           FreeCAD.Vector(0, -corrected_width_center + corrected_width + pos_y,
                                           -corrected_height / 2.0),
                                           FreeCAD.Vector(0, 0, 1.))
        hole = left_hole
        if hole and right_hole:
            hole = hole.fuse(right_hole)
        elif right_hole:
            hole = right_hole

    return tab, hole 
开发者ID:execuc,项目名称:LCInterlocking,代码行数:52,代码来源:join.py


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