Esempio n. 1
0
    def create(cls, scene_root = None, fixed_nodes = None, scale = 0.5):
        arranger = Arrange(220, 220, 110, 110, scale = scale)
        arranger.centerFirst()

        if fixed_nodes is None:
            fixed_nodes = []
            for node_ in DepthFirstIterator(scene_root):
                # Only count sliceable objects
                if node_.callDecoration("isSliceable"):
                    fixed_nodes.append(node_)

        # Place all objects fixed nodes
        for fixed_node in fixed_nodes:
            vertices = fixed_node.callDecoration("getConvexHull")
            if not vertices:
                continue
            points = copy.deepcopy(vertices._points)
            shape_arr = ShapeArray.fromPolygon(points, scale = scale)
            arranger.place(0, 0, shape_arr)

        # If a build volume was set, add the disallowed areas
        if Arrange.build_volume:
            disallowed_areas = Arrange.build_volume.getDisallowedAreas()
            for area in disallowed_areas:
                points = copy.deepcopy(area._points)
                shape_arr = ShapeArray.fromPolygon(points, scale = scale)
                arranger.place(0, 0, shape_arr)
        return arranger
    def create(cls, scene_root=None, fixed_nodes=None, scale=0.5):
        arranger = Arrange(220, 220, 110, 110, scale=scale)
        arranger.centerFirst()

        if fixed_nodes is None:
            fixed_nodes = []
            for node_ in DepthFirstIterator(scene_root):
                # Only count sliceable objects
                if node_.callDecoration("isSliceable"):
                    fixed_nodes.append(node_)

        # Place all objects fixed nodes
        for fixed_node in fixed_nodes:
            vertices = fixed_node.callDecoration("getConvexHull")
            points = copy.deepcopy(vertices._points)
            shape_arr = ShapeArray.fromPolygon(points, scale=scale)
            arranger.place(0, 0, shape_arr)

        # If a build volume was set, add the disallowed areas
        if Arrange.build_volume:
            disallowed_areas = Arrange.build_volume.getDisallowedAreas()
            for area in disallowed_areas:
                points = copy.deepcopy(area._points)
                shape_arr = ShapeArray.fromPolygon(points, scale=scale)
                arranger.place(0, 0, shape_arr)
        return arranger
Esempio n. 3
0
    def create(cls, scene_root=None, fixed_nodes=None, scale=1.0):
        global_stack = Application.getInstance().getGlobalContainerStack()
        machine_width = int(global_stack.getProperty("machine_width", "value"))
        machine_depth = int(global_stack.getProperty("machine_depth", "value"))
        arranger = Arrange(machine_depth,
                           machine_width,
                           int(machine_width / 2),
                           int(machine_depth / 2),
                           scale=scale)
        arranger.centerFirst()

        if fixed_nodes is None:
            fixed_nodes = []
            for node_ in DepthFirstIterator(scene_root):
                # Only count sliceable objects
                if node_.callDecoration("isSliceable") and not isinstance(
                        node_, DuplicatedNode):
                    fixed_nodes.append(node_)

        # Place all objects fixed nodes
        for fixed_node in fixed_nodes:
            arrange_align = Preferences.getInstance().getValue(
                "mesh/arrange_align")
            if arrange_align:
                bb = fixed_node.getBoundingBox()
                points = numpy.array(
                    [[bb.right, bb.back], [bb.left, bb.back],
                     [bb.left, bb.front], [bb.right, bb.front]],
                    dtype=numpy.float32)
            else:
                vertices = fixed_node.callDecoration("getConvexHull")
                points = copy.deepcopy(vertices._points)

            shape_arr = ShapeArray.fromPolygon(points, scale=scale)
            arranger.place(0, 0, shape_arr)

        # If a build volume was set, add the disallowed areas
        if Arrange.build_volume:
            disallowed_areas = Arrange.build_volume.getDisallowedAreas()
            for area in disallowed_areas:
                points = copy.deepcopy(area._points)
                shape_arr = ShapeArray.fromPolygon(points, scale=scale)
                arranger.place(0, 0, shape_arr)
        return arranger
Esempio n. 4
0
def gimmeShapeArray():
    vertices = numpy.array([[-3, 1], [3, 1], [0, -3]])
    shape_arr = ShapeArray.fromPolygon(vertices)
    return shape_arr
Esempio n. 5
0
def gimmeShapeArray():
    vertices = numpy.array([[-3, 1], [3, 1], [0, -3]])
    shape_arr = ShapeArray.fromPolygon(vertices)
    return shape_arr