예제 #1
0
def arc(radius, startAngle, endAngle, height, thickness):
    """ Create an arc

    :param radius: radius of the arc
    :param startAngle: angle from which the arc is created
    :param endAngle: angle to which the arc is created
    :param height: Height of volume
    :param thickness:
    :return: created volume
    """
    center = _system.cubitWrapper.create_vertex(0, 0, height / 2)
    points = [
        _system.cubitWrapper.create_vertex(math.cos(startAngle) * radius, math.sin(startAngle) * radius, height / 2),
        _system.cubitWrapper.create_vertex(math.cos(endAngle) * radius, math.sin(endAngle) * radius, height / 2),
        _system.cubitWrapper.create_vertex(math.cos(endAngle) * (radius + thickness),
                                          math.sin(endAngle) * (radius + thickness), height / 2),
        _system.cubitWrapper.create_vertex(math.cos(startAngle) * (radius + thickness),
                                          math.sin(startAngle) * (radius + thickness), height / 2)
    ]

    curves = [_curve.createArc(center, points[0], points[1]),
              _system.cubitWrapper.create_curve(points[1], points[2]),
              _curve.createArc(center, points[2], points[3]),
              _system.cubitWrapper.create_curve(points[3], points[0])
              ]

    normal = _system.cubitWrapper.create_curve(center, _system.cubitWrapper.create_vertex(0, 0, -height / 2))
    surface = _system.cubitWrapper.create_surface(curves).surfaces()[0]
    body = sweepCurve(surface, normal)
    _transform.delete(normal, 'curve')

    return body
예제 #2
0
def createCircle(radius, z=0.0):
    """ Creates a cirle in the xy plane

    :param radius: circle radius
    :param z: z offset
    :return: created curve
    """
    vertexCenter = _system.cubitWrapper.create_vertex(0, 0, z)
    vertexOuter = _system.cubitWrapper.create_vertex(radius, 0, z)
    circle = createArc(vertexCenter, vertexOuter, vertexOuter)
    _transform.delete(vertexCenter)
    return circle
예제 #3
0
def createCircle(radius, z=0.0):
    """ Creates a cirle in the xy plane

    :param radius: circle radius
    :param z: z offset
    :return: created curve
    """
    vertexCenter = _system.cubitWrapper.create_vertex(0, 0, z)
    vertexOuter = _system.cubitWrapper.create_vertex(radius, 0, z)
    circle = createArc(vertexCenter, vertexOuter, vertexOuter)
    _transform.delete(vertexCenter)
    return circle
예제 #4
0
def arc(radius, startAngle, endAngle, height, thickness):
    """ Create an arc

    :param radius: radius of the arc
    :param startAngle: angle from which the arc is created
    :param endAngle: angle to which the arc is created
    :param height: Height of volume
    :param thickness:
    :return: created volume
    """
    center = _system.cubitWrapper.create_vertex(0, 0, height / 2)
    points = [
        _system.cubitWrapper.create_vertex(
            math.cos(startAngle) * radius,
            math.sin(startAngle) * radius, height / 2),
        _system.cubitWrapper.create_vertex(
            math.cos(endAngle) * radius,
            math.sin(endAngle) * radius, height / 2),
        _system.cubitWrapper.create_vertex(
            math.cos(endAngle) * (radius + thickness),
            math.sin(endAngle) * (radius + thickness), height / 2),
        _system.cubitWrapper.create_vertex(
            math.cos(startAngle) * (radius + thickness),
            math.sin(startAngle) * (radius + thickness), height / 2)
    ]

    curves = [
        _curve.createArc(center, points[0], points[1]),
        _system.cubitWrapper.create_curve(points[1], points[2]),
        _curve.createArc(center, points[2], points[3]),
        _system.cubitWrapper.create_curve(points[3], points[0])
    ]

    normal = _system.cubitWrapper.create_curve(
        center, _system.cubitWrapper.create_vertex(0, 0, -height / 2))
    surface = _system.cubitWrapper.create_surface(curves).surfaces()[0]
    body = sweepCurve(surface, normal)
    _transform.delete(normal, 'curve')

    return body