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

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

    para_spline_surface = IGES.IGESTestSplineSurf()
    system.Commit(para_spline_surface)

    circle = IGES.IGESGeomCircle(IGESPoint(6, 7.25, 0), IGESPoint(6.25, 7.25))
    system.Commit(circle)

    para_spline_curve = IGES.IGESTestSplineCurve()
    system.Commit(para_spline_curve)

    curve_on_parametric_surface = IGES.IGESCurveOnParametricSurface(para_spline_surface,
                                                                    circle,
                                                                    para_spline_curve,
                                                                    2)
    system.Commit(curve_on_parametric_surface)

    trimmed_parametric_surface = IGES.IGESTrimmedParaSurface(para_spline_surface,
                                                             curve_on_parametric_surface)
    system.Commit(trimmed_parametric_surface)

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

    if not os.environ.get('READTHEDOCS', None):
        print(system)
        os.startfile("144-000-benchmark.igs")
Exemplo n.º 2
0
def testrun_random_surface(filename="IGESFile_random_surface.igs"):
    """draw a randomiced surface consisting of b spline surface segments"""
    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)

    scale = 2.5
    # data = numpy.zeros(shape=(3,5), dtype=int)
    data = numpy.random.rand(100, 100)
    # print("random data generated:", data.shape)

    for line_nr in range(0, data.shape[0]-1):
        # print("line number:", line_nr)
        for row_nr in range(0, data.shape[1]-1):
            x1 = line_nr * scale
            x2 = (line_nr + 1) * scale
            y1 = row_nr * scale
            y2 = (row_nr + 1) * scale
            p1 = IGESPoint(x1, y1, float(data[line_nr][row_nr]))
            p2 = IGESPoint(x2, y1, float(data[line_nr+1][row_nr]))
            p3 = IGESPoint(x1, y2, float(data[line_nr][row_nr+1]))
            p4 = IGESPoint(x2, y2, float(data[line_nr+1][row_nr+1]))
            square = IGES.IGESRationalBSplineSurface(p1, p2, p3, p4)
            system.Commit(square)

    # print("save file:", line_nr)
    system.save(filename)
Exemplo n.º 3
0
def iges_144_000():
    import pyiges.IGESGeomLib as IGES
    from pyiges.IGESCore import IGEStorage
    from pyiges.IGESGeomLib import IGESPoint

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

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

    # Circular flat surface profile
    circular_flat_surface_profile = IGES.IGESGeomCircle(IGESPoint(0, 0, 0),
                                                        IGESPoint(10, 10, 0))
    system.Commit(circular_flat_surface_profile)

    # Make the surface from out outer profile, this is to be trimmed
    circular_flat_surface = IGES.IGESGeomPlane(circular_flat_surface_profile)
    system.Commit(circular_flat_surface)

    # We're going to put a bunch of holes into the surface
    hole = []          # Hole profiles
    hole_copse = []    # Curve on Parametric Surface entries (required!)

    for i in range(0, 6):
        hole.append(IGES.IGESGeomCircle(IGESPoint(-5 + i * 3, 0, 0),
                                             IGESPoint(-5 + i * 3, 1, 0)))
        system.Commit(hole[-1])

        # Make those tubes, given we are not using them as a reference,
        # Lets directly add them to the system.
        system.Commit(IGES.IGESExtrude(hole[-1], IGESPoint(0, 0, i + 1)))
        system.Commit(IGES.IGESExtrude(hole[-1], IGESPoint(0, 0, -i - 1)))

        hole_copse.append(IGES.IGESCurveOnParametricSurface(circular_flat_surface,
                                                                 hole[-1],
                                                                 hole[-1],
                                                                 1))
        system.Commit(hole_copse[-1])

    # 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(circular_flat_surface,
                                                          0)
    trimmed_surface.N1 = 0

    # Lets put those holes in!
    for _hole in hole_copse:
        trimmed_surface.add_bounding_profile(_hole)

    system.Commit(trimmed_surface)

    system.save(filename)

    if not os.environ.get('READTHEDOCS', None):
        print(system)
        os.startfile(filename)
Exemplo n.º 4
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.º 5
0
def iges_144_000():
    import pyiges.IGESGeomLib as IGES
    from pyiges.IGESGeomLib import IGESPoint
    from pyiges.IGESCore import IGEStorage

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

    para_spline_surface = IGES.IGESTestSplineSurf()
    system.Commit(para_spline_surface)

    circle = IGES.IGESGeomCircle(IGESPoint(6, 7.25, 0), IGESPoint(6.25, 7.25))
    system.Commit(circle)

    para_spline_curve = IGES.IGESTestSplineCurve()
    system.Commit(para_spline_curve)

    curve_on_parametric_surface = IGES.IGESCurveOnParametricSurface(
        para_spline_surface, circle, para_spline_curve, 2)
    system.Commit(curve_on_parametric_surface)

    trimmed_parametric_surface = IGES.IGESTrimmedParaSurface(
        para_spline_surface, curve_on_parametric_surface)
    system.Commit(trimmed_parametric_surface)

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

    if not os.environ.get('READTHEDOCS', None):
        print(system)
        os.startfile("144-000-benchmark.igs")
Exemplo n.º 6
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.º 7
0
def testrun_torus(filename="IGESFile_torus.igs"):
    """Dont know if this works, neither FreeCAD not IGES Viewer will display anyting for a torus element"""
    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)

    torus = IGES.IGESGeomTorus(50, 10, IGESPoint(0,0,0), IGESVector(0,0,1))
    system.Commit(torus)
    system.save(filename)
Exemplo n.º 8
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.º 9
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.º 10
0
def testrun_spline_curve(filename="IGESFile_spline_curve.igs"):
    """draw a spline curve"""
    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)

    spline_curve = IGES.IGESSplineCurve(stype=3, h=1, ndim=3)
    spline_curve.addSegment(0., [5.817, 0.183686, 7.152560000000000E-007, 0.00391344,
                                 7.42046, 0.116096, -1.430510000000000E-006, -0.0365138,
                                 0.582714, 0.26764, -2.682210000000000E-007, -0.0384366])
    spline_curve.addSegment(1., [6.0046, 0.195428, 0.011741, -0.0231148,
                                 7.50004, 0.00655174, -0.109543, 0.0169944,
                                 0.811917, 0.15233, -0.11531, -0.00673003])
    spline_curve.addSegment(2., [6.18865, 0.149566, -0.0576034, -0.034095,
                                 7.41404, -0.161551, -0.0585597, 0.0144959,
                                 0.842207, - 0.0984805, -0.1355, 0.000767251])
    spline_curve.addSegment(3., [6.24652, -0.0679259, -0.159888, 0.0609804,
                                 7.20843, -0.235182, -0.0150719, 0.0548643,
                                 0.608993, - 0.367179, -0.133198, 0.11326])
    spline_curve.addSegment(4., [6.07969, -0.204761, 0.0230529, -0.00538516,
                                 7.01304, -0.100733, 0.149521, -0.0375805,
                                 0.221876, - 0.293796, 0.206582, -0.0375974])
    spline_curve.addSegment(5., [5.89259, -0.174811, 0.00689745, 0.041456,
                                 7.02425, 0.0855677, 0.0367796, 0.0150364,
                                 0.0970648, 0.00657602, 0.0937898, 0.0214335])
    spline_curve.addSegment(6., [5.76614, -0.0366479, 0.131266, -0.0437549,
                                 7.16163, 0.204236, 0.0818889, -0.0272963,
                                 0.218864, 0.258456, 0.15809, -0.0526968])
    spline_curve.addSegment(7., [5.817, 0.0946183, 1.430510000000000E-006, -0.26253,
                                 7.42046, 0.286125, 0., -0.163778,
                                 0.582714, 0.146546, -1.713630000000000E-007, -0.316181])

    system.Commit(spline_curve)

    system.save(filename)
Exemplo n.º 11
0
def testrun_extrude_polyline(filename="IGESFile_extrude_polyline.igs"):
    """draw a poly line and extrude it to a target points"""
    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)

    # extrude polyline to endpoint
    system.Commit(IGES.IGESExtrude(polyln, IGESPoint(0, 0, 15)))

    system.save(filename)
Exemplo n.º 12
0
def testrun_polyline(filename="IGESFile_polyline.igs"):
    """draw a poly line"""
    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)

    system.save(filename)
Exemplo n.º 13
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.º 14
0
def testrun_arc_circle(filename="IGESFile_arc_circle.igs"):
    """draw an arc and a circle, both in a plane paralell to the X-Y-plane"""
    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)

    arc = IGES.IGESGeomArc(-3, IGESPoint(2, 5, 0), IGESPoint(-3, 0, 0), IGESPoint(2, 10, 0))
    system.Commit(arc)

    circ = IGES.IGESGeomCircle(IGESPoint(5, 5, 5), 5)
    system.Commit(circ)

    system.save(filename)
Exemplo n.º 15
0
def testrun_extrude_arc(filename="IGESFile_extrude_arc.igs"):
    """draw arc and extrude it to a target points"""
    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)

    arc = IGES.IGESGeomArc(0, IGESPoint(20, 11, 0), IGESPoint(20.25, 11, 0), IGESPoint(19.75, 11, 0))
    system.Commit(arc)

    ext = IGES.IGESExtrude(arc, IGESPoint(20.4857, 11.2357, -0.9428))
    system.Commit(ext)

    system.save(filename)
Exemplo n.º 16
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.º 17
0
406,2,6.,8.;                                                           1P      1
410,1,3.,0,0,0,0,0,0;                                                  3P      2
404,1,3,0.,0.,0,0,1,1;                                                 5P      3
124,-1.,0.,0.,3.5,0.,1.,0.,15.,0.,0.,-1.,0.;                           7P      4
116,3.5,15.,0.,;                                                       9P      5
110,3.5,15.,0.,3.5,15.5,0.;                                           11P      6
100,0.,0.,0.,0.,0.5,-0.5,0.;                                          13P      7
112,3,1,3,2,0.,1.,2.,4.,0.5625,0.,-0.0625,15.,-0.312501,              15P      8
1.430510000000000E-006,0.0624995,0.,0.,0.,0.,4.5,0.375,-0.1875,       15P      9
0.0625,14.75,-0.125,0.1875,-0.0625005,0.,0.,0.,0.,4.75,0.1875,        15P     10
0.,0.375,14.75,0.062499,-2.861020000000000E-006,-0.375003,0.,0.,      15P     11
0.,0.;                                                                15P     12
102,4,9,11,13,15;                                                     17P     13
"""

system = IGEStorage()
system.GlobalSection.ParameterDelimiterCharacter = ","
system.GlobalSection.RecordDelimiter = ";"
system.GlobalSection.ProductIdentificationFromSender = filename.split(".")[0]
system.GlobalSection.FileName = filename
system.GlobalSection.NativeSystemID = filename
system.GlobalSection.PreprocessorVersion = "pyIGES"
system.GlobalSection.IntegerBits = 16
system.GlobalSection.SPMagnitude = 6
system.GlobalSection.SPSignificance = 15
system.GlobalSection.DPMagnitude = 13
system.GlobalSection.DPSignificance = 15
system.GlobalSection.ProductIdentificationForReceiver = filename.split(".")[0]
system.GlobalSection.ModelSpaceScale = 3.0
system.GlobalSection.Units.setInches()
system.GlobalSection.MaxNumberLineWeightGrads = 8
Exemplo n.º 18
0
Arquivo: face.py Projeto: lepy/pyIGES
# Internal Modules
from pyiges.IGESCore import IGEStorage
from pyiges.IGESGeomLib import IGESPoint
import pyiges.IGESGeomLib as IGES
import numpy

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)

from scipy.special import comb


def bernstein_poly(n, i, u):
    return comb(n, i) * u**(i) * (1 - u)**(n - i)


def bezier_curve(P, nTimes=1000, dC=False):

    n = len(P[1])
    u = numpy.linspace(0.0, 1.0, nTimes)
    polynomial_array = numpy.empty([n, nTimes])

    for i in range(0, n):
Exemplo n.º 19
0
406,2,6.,8.;                                                           1P      1
410,1,3.,0,0,0,0,0,0;                                                  3P      2
404,1,3,0.,0.,0,0,1,1;                                                 5P      3
124,-1.,0.,0.,3.5,0.,1.,0.,15.,0.,0.,-1.,0.;                           7P      4
116,3.5,15.,0.,;                                                       9P      5
110,3.5,15.,0.,3.5,15.5,0.;                                           11P      6
100,0.,0.,0.,0.,0.5,-0.5,0.;                                          13P      7
112,3,1,3,2,0.,1.,2.,4.,0.5625,0.,-0.0625,15.,-0.312501,              15P      8
1.430510000000000E-006,0.0624995,0.,0.,0.,0.,4.5,0.375,-0.1875,       15P      9
0.0625,14.75,-0.125,0.1875,-0.0625005,0.,0.,0.,0.,4.75,0.1875,        15P     10
0.,0.375,14.75,0.062499,-2.861020000000000E-006,-0.375003,0.,0.,      15P     11
0.,0.;                                                                15P     12
102,4,9,11,13,15;                                                     17P     13
"""

system = IGEStorage()
system.GlobalSection.ParameterDelimiterCharacter = ","
system.GlobalSection.RecordDelimiter = ";"
system.GlobalSection.ProductIdentificationFromSender = filename.split(".")[0]
system.GlobalSection.FileName = filename
system.GlobalSection.NativeSystemID = filename
system.GlobalSection.PreprocessorVersion = "pyIGES"
system.GlobalSection.IntegerBits = 16
system.GlobalSection.SPMagnitude = 6
system.GlobalSection.SPSignificance = 15
system.GlobalSection.DPMagnitude = 13
system.GlobalSection.DPSignificance = 15
system.GlobalSection.ProductIdentificationForReceiver = filename.split(".")[0]
system.GlobalSection.ModelSpaceScale = 3.0
system.GlobalSection.Units.setInches()
system.GlobalSection.MaxNumberLineWeightGrads = 8
Exemplo n.º 20
0
def iges_144_000():
    import pyiges.IGESGeomLib as IGES
    from pyiges.IGESCore import IGEStorage
    from pyiges.IGESGeomLib import IGESPoint

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

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

    # Circular flat surface profile
    circular_flat_surface_profile = IGES.IGESGeomCircle(
        IGESPoint(0, 0, 0), IGESPoint(10, 10, 0))
    system.Commit(circular_flat_surface_profile)

    # Make the surface from out outer profile, this is to be trimmed
    circular_flat_surface = IGES.IGESGeomPlane(circular_flat_surface_profile)
    system.Commit(circular_flat_surface)

    # We're going to put a bunch of holes into the surface
    hole = []  # Hole profiles
    hole_copse = []  # Curve on Parametric Surface entries (required!)

    for i in range(0, 6):
        hole.append(
            IGES.IGESGeomCircle(IGESPoint(-5 + i * 3, 0, 0),
                                IGESPoint(-5 + i * 3, 1, 0)))
        system.Commit(hole[-1])

        # Make those tubes, given we are not using them as a reference,
        # Lets directly add them to the system.
        system.Commit(IGES.IGESExtrude(hole[-1], IGESPoint(0, 0, i + 1)))
        system.Commit(IGES.IGESExtrude(hole[-1], IGESPoint(0, 0, -i - 1)))

        hole_copse.append(
            IGES.IGESCurveOnParametricSurface(circular_flat_surface, hole[-1],
                                              hole[-1], 1))
        system.Commit(hole_copse[-1])

    # 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(circular_flat_surface, 0)
    trimmed_surface.N1 = 0

    # Lets put those holes in!
    for _hole in hole_copse:
        trimmed_surface.add_bounding_profile(_hole)

    system.Commit(trimmed_surface)

    system.save(filename)

    if not os.environ.get('READTHEDOCS', None):
        print(system)
        os.startfile(filename)
Exemplo n.º 21
0
filename = "122_0.igs"
"""
1H,,1H;,7H122-000,11H122-000.IGS,9H{unknown},9H{unknown},16,6,15,13,15, G      1
7H122-000,1.,1,4HINCH,8,0.016,15H20020525.195625,0.0001,20.4857,        G      2
[email protected],23HLegacy PDD AP Committee,10,3,               G      3
13H920717.080000;                                                       G      4
     100       1       0       1       0       0       0       000010001D      1
     100       0       5       1       0                                D      2
     122       2       0       1       0       0       0       000000001D      3
     122       0       5       1       0                                D      4
100,0.,20.,11.,20.25,11.,19.75,11.;                                    1P      1
122,1,20.4857,11.2357,-0.9428;                                         3P      2
S      1G      4D      4P      2                                        T      1
"""

system = IGEStorage()
system.GlobalSection.ParameterDelimiterCharacter = ","
system.GlobalSection.RecordDelimiter = ";"
system.GlobalSection.ProductIdentificationFromSender = "122-000"
system.GlobalSection.FileName = "122-000.IGS"
system.GlobalSection.NativeSystemID = "122-000.IGS"
system.GlobalSection.PreprocessorVersion = "pyIGES"
system.GlobalSection.IntegerBits = 16
system.GlobalSection.SPMagnitude = 6
system.GlobalSection.SPSignificance = 15
system.GlobalSection.DPMagnitude = 13
system.GlobalSection.DPSignificance = 15
system.GlobalSection.ProductIdentificationForReceiver = "122-000"
system.GlobalSection.ModelSpaceScale = 1.0
system.GlobalSection.Units.setInches()
system.GlobalSection.MaxNumberLineWeightGrads = 8
Exemplo n.º 22
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)