Exemplo n.º 1
0
def iges_414_000():
    import pyiges.IGESGeomLib as IGES
    from pyiges.IGESCore import IGEStorage
    from pyiges.IGESGeomLib import IGESPoint

    system = IGEStorage()
    examples.benchmarks.standard_iges_setup(system, "414-000-benchmark.igs")

    line_1 = IGES.IGESGeomLine(IGESPoint(-0.13, 0, 0), IGESPoint(0, 0.25, 0))

    line_2 = IGES.IGESGeomLine(IGESPoint(0, 0.25, 0), IGESPoint(0.13, 0, 0))

    line_3 = IGES.IGESGeomLine(IGESPoint(0, 0.25, 0), IGESPoint(0, 0.44, 0))

    line_4 = IGES.IGESGeomLine(IGESPoint(0, 0.38, 0), IGESPoint(0.09, 0.28, 0))

    line_5 = IGES.IGESGeomLine(IGESPoint(0, 0.38, 0),
                               IGESPoint(-0.09, 0.28, 0))

    circle_1 = IGES.IGESGeomArc(0, IGESPoint(0, 0.5), IGESPoint(0.06, 0.5),
                                IGESPoint(0.06, 0.5))

    system.Commit(line_1)
    system.Commit(line_2)
    system.Commit(line_3)
    system.Commit(line_4)
    system.Commit(line_5)
    system.Commit(circle_1)

    person_group = IGES.IGESGroup("PERSON", line_1, line_2, line_3, line_4,
                                  line_5, circle_1)

    system.Commit(person_group)

    person_array = IGES.IGESCircularArray(person_group, 3,
                                          IGESPoint(5.5, 1.5, 0), 0.5, 0.52,
                                          2.09)

    system.Commit(person_array)

    system.save("414-000-benchmark.igs")

    if not os.environ.get('READTHEDOCS', None):
        print(system)
        os.startfile("414-000-benchmark.igs")
Exemplo n.º 2
0
def testrun(filename="IGESFile.igs"):
    system = IGEStorage()
    system.StartSection.Prolog = " "
    system.GlobalSection.IntegerBits = int(32)
    system.GlobalSection.SPMagnitude = int(38)
    system.GlobalSection.SPSignificance = int(6)
    system.GlobalSection.DPMagnitude = int(38)
    system.GlobalSection.DPSignificance = int(15)
    system.GlobalSection.MaxNumberLineWeightGrads = int(8)
    system.GlobalSection.WidthMaxLineWeightUnits = float(0.016)
    system.GlobalSection.MaxCoordValue = float(71)

    P = [[0, 0], [numpy.divide(1, 3),
                  numpy.divide(numpy.pi, 6)], [numpy.divide(2, 3), 1], [1, 1],
         [1 + numpy.divide(1, 3), 1],
         [1 + numpy.divide(2, 3),
          numpy.divide(numpy.pi, 6)], [2, 0],
         [2 + numpy.divide(1, 3), 0 - numpy.divide(numpy.pi, 6)],
         [2 + numpy.divide(2, 3), 0 - 1], [3, 0 - 1],
         [3 + numpy.divide(1, 3), 0 - 1],
         [3 + numpy.divide(2, 3), 0 - numpy.divide(numpy.pi, 6)], [4, 0]]

    for i in range(0, 1):
        P.extend

    P = numpy.transpose(P)
    bezi = bezier_curve(P, nTimes=50)

    polyln = IGES.IGESGeomPolyline()

    for n in range(0, 5):
        for i in range(0, len(bezi[0])):
            polyln.AddPoint(IGESPoint(bezi[0][i], bezi[1][i], 10))
        bezi[0] = bezi[0] + 4

    system.Commit(polyln)

    line = IGES.IGESGeomLine(IGESPoint(-2, -5, 0), IGESPoint(22, -5, 0))
    system.Commit(line)

    #system.Commit(IGES.IGESRevolve(polyln, line))

    #system.Commit(IGES.IGESExtrude(polyln.DirectoryDataPointer.data, IGESPoint(0,0,10)))
    print(system)

    system.save(filename)

    if not environ.get('READTHEDOCS', None) == 'True':
        startfile(filename)
Exemplo n.º 3
0
def testrun_rotate_polyline(filename="IGESFile_rotate_polyline.igs"):
    """draw a poly line and rotate it around a line to for a cylindrical object"""
    system = IGEStorage()
    system.StartSection.Prolog = " "
    system.GlobalSection.IntegerBits = int(32)
    system.GlobalSection.SPMagnitude = int(38)
    system.GlobalSection.SPSignificance = int(6)
    system.GlobalSection.DPMagnitude = int(38)
    system.GlobalSection.DPSignificance = int(15)
    system.GlobalSection.MaxNumberLineWeightGrads = int(8)
    system.GlobalSection.WidthMaxLineWeightUnits = float(0.016)
    system.GlobalSection.MaxCoordValue = float(71)

    # add poly line from numpy array
    P = [[0, 0],
         [numpy.divide(1, 3), numpy.divide(numpy.pi, 6)],
         [numpy.divide(2, 3), 1],
         [1, 1],
         [1 + numpy.divide(1, 3), 1],
         [1 + numpy.divide(2, 3), numpy.divide(numpy.pi, 6)],
         [2, 0],
         [2 + numpy.divide(1, 3), 0 - numpy.divide(numpy.pi, 6)],
         [2 + numpy.divide(2, 3), 0 - 1],
         [3, 0 - 1],
         [3 + numpy.divide(1, 3), 0 - 1],
         [3 + numpy.divide(2, 3), 0 - numpy.divide(numpy.pi, 6)],
         [4, 0]]
    for i in range(0, 1):
        P.extend
    P = numpy.transpose(P)
    bezi = bezier_curve(P, nTimes = 50)
    polyln = IGES.IGESGeomPolyline()
    for n in range(0, 5):
        for i in range(0, len(bezi[0])):
            polyln.AddPoint(IGESPoint(bezi[0][i], bezi[1][i], 10))
        bezi[0] = bezi[0] + 4
    system.Commit(polyln)

    # add straight line
    line = IGES.IGESGeomLine(IGESPoint(-2, -5, 0), IGESPoint(22, -5, 0))
    system.Commit(line)

    # revolve polyline around line
    system.Commit(IGES.IGESRevolve(polyln, line))

    system.save(filename)
Exemplo n.º 4
0
def iges_144_000():
    import pyiges.IGESGeomLib as IGES
    from pyiges.IGESCore import IGEStorage
    from pyiges.IGESGeomLib import IGESPoint

    filename = "144-000-example-2.igs"

    system = IGEStorage()
    examples.benchmarks.standard_iges_setup(system, filename)

    # Setup a cone like surface, the cone is boring but whatever!
    cone_surface_profile = IGES.IGESGeomPolyline(IGESPoint(-10, 0, 0),
                                                 IGESPoint(0, 0, 10))
    system.Commit(cone_surface_profile)

    # The centre of the revolve
    center_line = IGES.IGESGeomLine(IGESPoint(0, 0, 0), IGESPoint(0, 0, 10))
    system.Commit(center_line)

    # Make the surface from the profile, this is to be trimmed
    cone_surface = IGES.IGESRevolve(cone_surface_profile, center_line)
    system.Commit(cone_surface)

    #Setup the surface we are to put holes into, we're using the whole surface,
    #  as indicated by the 0 in the outer profile parameter
    trimmed_surface = IGES.IGESTrimmedParaSurface(cone_surface, 0)
    trimmed_surface.N1 = 0

    hole = []
    hole_copse = []

    # We're going to put a bunch of holes into the surface, because we don't
    # care about the index of the hole we can get away with specifying -8 to 8
    for holenum in range(-8, 8):
        hole.append(IGES.IGESGeomPolyline())
        hole_data = [[], [], []]

        # Top line following the cone profile
        for i in range(21 * holenum, 20 + 21 * holenum):
            hole_data[0].append(3)
            hole_data[1].append(i)
            hole_data[2].append(7)

        # Line down the cone profile
        hole_data[0].append(7)
        hole_data[1].append(hole_data[1][-1])
        hole_data[2].append(3)

        # Bottom line following the cone profile
        for i in range(20 + 21 * holenum, 21 * holenum, -1):
            hole_data[0].append(7)
            hole_data[1].append(i)
            hole_data[2].append(3)

        # Line back to start of the cone profile
        hole_data[0].append(hole_data[0][0])
        hole_data[1].append(hole_data[1][0])
        hole_data[2].append(hole_data[2][0])

        # Convert to rectangular coordinate system
        hole_rect_cs = cyl_to_rect(hole_data)

        # Push the points into the common format
        for i in range(0, len(hole_rect_cs[0])):
            hole[-1].AddPoint(
                IGESPoint(hole_rect_cs[0][i], hole_rect_cs[1][i],
                          hole_rect_cs[2][i]))

        # Commit this hole
        system.Commit(hole[-1])

        # Lets make a really very crazy looking thing!
        # And revolve the cutting profile by a bit
        # Setup Revolve Line data
        random_line_data = cyl_to_rect([[-10, 10],
                                        [(20 * holenum) + 90,
                                         (20 * holenum) + 90], [10, 10]])

        # Make revolve line
        revolve_line = IGES.IGESGeomLine(
            IGESPoint(random_line_data[0][0], random_line_data[1][0],
                      random_line_data[2][0]),
            IGESPoint(random_line_data[0][1], random_line_data[1][1],
                      random_line_data[2][1]))

        # Commit revolve line
        system.Commit(revolve_line)

        # Make the revolve
        system.Commit(IGES.IGESRevolve(hole[-1], revolve_line, -1, 0))

        # Create the Curve on Parametric Surface
        hole_copse.append(
            IGES.IGESCurveOnParametricSurface(cone_surface, hole[-1], hole[-1],
                                              2))
        system.Commit(hole_copse[-1])

        # Lets put that holes in!
        trimmed_surface.add_bounding_profile(hole_copse[-1])

    # commit that surface!
    system.Commit(trimmed_surface)

    system.save(filename)

    if not os.environ.get('READTHEDOCS', None):
        print(system)
        os.startfile(filename)
Exemplo n.º 5
0
Arquivo: face.py Projeto: lepy/pyIGES
      numpy.divide(numpy.pi, 6)], [2, 0],
     [2 + numpy.divide(1, 3), 0 - numpy.divide(numpy.pi, 6)],
     [2 + numpy.divide(2, 3), 0 - 1], [3, 0 - 1],
     [3 + numpy.divide(1, 3), 0 - 1],
     [3 + numpy.divide(2, 3), 0 - numpy.divide(numpy.pi, 6)], [4, 0]]

for i in range(0, 1):
    P.extend

P = numpy.transpose(P)
bezi = bezier_curve(P, nTimes=50)

polyln = IGES.IGESGeomPolyline()
system.Commit(polyln)

line = IGES.IGESGeomLine(IGESPoint(-2, -5, 0), IGESPoint(22, -5, 0))
print(line)
system.Commit(line)

line = IGES.IGESGeomLine(IGESPoint(-2, -1, 0), IGESPoint(22, -3, 3))
print(line)
system.Commit(line)

system.Commit(IGES.IGESRevolve(polyln, line))

# system.Commit(IGES.IGESExtrude(polyln.DirectoryDataPointer.data, IGESPoint(0,0,10)))

# system.Commit(IGES.IGESRevolve(line0, line))
#system.Commit(IGES.IGESRevolve(polyln, line))

#system.Commit(IGES.IGESExtrude(polyln.DirectoryDataPointer.data, IGESPoint(0,0,10)))
Exemplo n.º 6
0
trans.StatusNumber.Hierachy.setGlobalDefer()
trans.LineWeightNum = 2
trans.Color.setCyan()
system.Commit(trans)

point = IGES.IGESGeomPoint(IGES.IGESPoint(3.5, 15.0, 0.0))
point.LineFontPattern.setNone()
point.LineWeightNum = 2
point.Color.setGreen()
point.StatusNumber.Hierachy.setGlobalDefer()
point.StatusNumber.EntityUseFlag.setGeometry()
point.StatusNumber.Subordinate.setPhysicallyDependent()
point.StatusNumber.Visablilty.setVisible()
system.Commit(point)

line = IGES.IGESGeomLine(IGES.IGESPoint(3.5, 15.0, 0.0),
                         IGES.IGESPoint(3.5, 15.5, 0.0))
line.LineFontPattern.setSolid()
line.LineWeightNum = 2
line.Color.setBlue()
line.StatusNumber.Hierachy.setGlobalDefer()
line.StatusNumber.EntityUseFlag.setGeometry()
line.StatusNumber.Subordinate.setPhysicallyDependent()
line.StatusNumber.Visablilty.setVisible()
system.Commit(line)

arc = IGES.IGESGeomArc(0.0, IGES.IGESPoint(0.0, 0.0, 0.0),
                       IGES.IGESPoint(0.0, 0.5, 0.0),
                       IGES.IGESPoint(-0.5, 0.0, 0.0))
arc.TransfrmMat = trans.DirectoryDataPointer.data
arc.LineFontPattern.setSolid()
arc.LineWeightNum = 2