def test_slicing(self):
        """Test initial slicer prototype"""
        stl = helpers.get_box()
        model = Model.from_stl(stl)
        layers = model.generate_planar_intersections(0.4, 1, 31)

        for (zlevel, intersections) in layers:
            for intersection in intersections:
                start, end = intersection
                assert start != end
Пример #2
0
    def test_01_generate_insets(self):
        """Generate some layers and inset them"""
        print "\nUltra simple box model, planar inset testing."
        stl = helpers.get_box()
        model = Model.from_stl(stl)
        now = time.time()
        layers = [
            Layer.from_CGAL_intersections(plane[1])
            for plane in model.generate_planar_intersections(0, 0.1, 30)
            if len(plane[1])
        ]
        for layer in layers:
            eroded_layer = layer.eroded(0.2)
            for poly in eroded_layer.polys:
                exterior = tuple(poly.exterior.coords)
                self.assertEquals(exterior,
                                  ((9.8, -9.8), (-9.8, -9.8), (-9.8, 9.8),
                                   (9.8, 9.8), (9.8, -9.8)))

        print "Generating eroded layer planes took %5.5f seconds" % (
            time.time() - now)
    def test_01_generate_insets(self):
        """Generate some layers and inset them"""
        print "\nUltra simple box model, planar inset testing."
        stl = helpers.get_box()
        model = Model.from_stl(stl)
        now=time.time()
        layers = [
                Layer.from_CGAL_intersections(plane[1]) for
                    plane in
                    model.generate_planar_intersections(0, 0.1, 30)
                    if len(plane[1])]
        for layer in layers:
            eroded_layer = layer.eroded(0.2)
            for poly in eroded_layer.polys:
                exterior = tuple(poly.exterior.coords)
                self.assertEquals(exterior,
                    (
                        (9.8, -9.8), (-9.8, -9.8),
                        (-9.8, 9.8), (9.8, 9.8),
                        (9.8, -9.8)))

        print "Generating eroded layer planes took %5.5f seconds" % (time.time()-now)
 def test_model_numpy(self):
     """Test that the numpy model is structured right."""
     stl = helpers.get_box()
     model = Model.from_stl(stl)
     self.assertEquals(BOX_MODEL_OUT, model.mesh)
 def test_stl2model(self):
     """Test loading an stl and making a model"""
     stl = helpers.get_box()
     model = Model.from_stl(stl)
Пример #6
0
 def test_stl2project_(self):
     """Test loading an stl and making a project"""
     stl = helpers.get_box()
     prj = Project.from_stl(stl)
     print prj, prj.model
Пример #7
0
 def test_stl2project_(self):
     """Test loading an stl and making a project"""
     stl = helpers.get_box()
     prj = Project.from_stl(stl)
     print prj, prj.model