示例#1
0
    def test_pipe_straight(self):
        a = Assembly("MyTest")

        p = Part("MyPart")
        a.add_part(p)
        z = 3.2
        y0 = -200e-3
        pipe1 = Pipe("Pipe1", [(0, y0, 0), (0, y0, z)],
                     Section("PSec", "PIPE", r=0.10, wt=5e-3))
        p.add_pipe(pipe1)
        a.to_ifc(test_folder / "pipe_straight.ifc")
        a._repr_html_()
示例#2
0
def test_pipe_straight(dummy_display):
    a = Assembly("MyTest")

    p = Part("MyPart")
    a.add_part(p)
    z = 3.2
    y0 = -200e-3
    pipe1 = Pipe("Pipe1", [(0, y0, 0), (0, y0, z)],
                 Section("PSec", "PIPE", r=0.10, wt=5e-3))
    p.add_pipe(pipe1)
    _ = a.to_ifc(test_dir / "pipe_straight.ifc", return_file_obj=True)
    dummy_display(a)
示例#3
0
def test_ifc_reimport():
    # Model to be re-imported
    a = Assembly("my_test_assembly") / SimpleStru("my_simple_stru")
    fp = a.to_ifc(test_folder / "my_exported_param_model.ifc",
                  return_file_obj=True)

    points = [(0, 0, 0), (5, 0, 0), (5, 5, 0)]
    w = Wall("MyWall", points, 3, 0.15, offset="LEFT")
    wi = Window("MyWindow1", 1.5, 1, 0.15)
    wi2 = Window("MyWindow2", 2, 1, 0.15)
    door = Door("Door1", 1.5, 2, 0.2)
    w.add_insert(wi, 0, 1, 1.2)
    w.add_insert(wi2, 1, 1, 1.2)
    w.add_insert(door, 0, 3.25, 0)

    p = Part("MyPart")

    p.add_elements_from_ifc(fp)
    p.add_wall(w)

    z = 3.2
    y0 = -200e-3
    x0 = -y0
    pipe1 = Pipe(
        "Pipe1",
        [
            (0, y0, z),
            (5 + x0, y0, z),
            (5 + x0, y0 + 5, z),
            (10, y0 + 5, z + 2),
            (10, y0 + 5, z + 10),
        ],
        Section("PSec1", "PIPE", r=0.10, wt=5e-3),
    )
    p.add_pipe(pipe1)

    b = Assembly("MyTest") / p

    b.units = "mm"
    b.to_ifc(test_folder / "my_reimport_of_elements_mm.ifc")
    # TODO: Re-import is still not supported. Should look into same approach as BlenderBIM by
    #       only communicating and updating the ifcopenshell file object.
    b.units = "m"
示例#4
0
 def test_pipe_bend(self):
     a = Assembly("MyTest")
     p = Part("MyPart")
     a.add_part(p)
     z = 3.2
     y0 = -200e-3
     x0 = -y0
     pipe1 = Pipe(
         "Pipe1",
         [
             (0, y0, z),
             (5 + x0, y0, z),
             (5 + x0, y0 + 5, z),
             (10, y0 + 5, z + 2),
             (10, y0 + 5, z + 10),
         ],
         Section("PSec", "PIPE", r=0.10, wt=5e-3),
     )
     p.add_pipe(pipe1)
     a.to_ifc(test_folder / "pipe_bend.ifc")
     a._repr_html_()
示例#5
0
    def test_ifc_reimport(self):
        # Model to be re-imported
        a = Assembly("my_test_assembly") / SimpleStru("my_simple_stru")
        a.to_ifc(test_folder / "my_exported_param_model.ifc")

        points = [(0, 0, 0), (5, 0, 0), (5, 5, 0)]
        w = Wall("MyWall", points, 3, 0.15, offset="LEFT")
        wi = Window("MyWindow1", 1.5, 1, 0.15)
        wi2 = Window("MyWindow2", 2, 1, 0.15)
        door = Door("Door1", 1.5, 2, 0.2)
        w.add_insert(wi, 0, 1, 1.2)
        w.add_insert(wi2, 1, 1, 1.2)
        w.add_insert(door, 0, 3.25, 0)

        p = Part("MyPart")

        p.add_elements_from_ifc(test_folder / "my_exported_param_model.ifc")
        p.add_wall(w)

        z = 3.2
        y0 = -200e-3
        x0 = -y0
        pipe1 = Pipe(
            "Pipe1",
            [
                (0, y0, z),
                (5 + x0, y0, z),
                (5 + x0, y0 + 5, z),
                (10, y0 + 5, z + 2),
                (10, y0 + 5, z + 10),
            ],
            Section("PSec1", "PIPE", r=0.10, wt=5e-3),
        )
        p.add_pipe(pipe1)

        b = Assembly("MyTest") / p

        b.units = "mm"
        b.to_ifc(test_folder / "my_reimport_of_elements_mm.ifc")