Пример #1
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)
Пример #2
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)
Пример #3
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)
Пример #4
0
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
system.GlobalSection.WidthMaxLineWeightUnits = 0.016
system.GlobalSection.MaxUserResolution = 0.0001
system.GlobalSection.MaxCoordValue = 20.4857
system.GlobalSection.NameOfAuthor = "github.com"
system.GlobalSection.AuthorOrg = "pyIGES"
system.GlobalSection.VersionFlag = 11
system.GlobalSection.DraftStandardFlag = 3
system.GlobalSection.AppProtocol = "pyIGES"

arc = IGES.IGESGeomArc(0, IGES.IGESPoint(20, 11), IGES.IGESPoint(20.25, 11),
                       IGES.IGESPoint(19.75, 11))
arc.Color.setYellow()
arc.StatusNumber.Hierachy.setGlobalDefer()
arc.StatusNumber.EntityUseFlag.setGeometry()
arc.StatusNumber.Subordinate.setPhysicallyDependent()
arc.StatusNumber.Visablilty.setVisible()
system.Commit(arc)

extr = IGES.IGESExtrude(arc, IGES.IGESPoint(20.4857, 11.2357, -0.9428))
arc.Color.setYellow()
system.Commit(extr)

system.save(filename=filename)