Skip to content

Arrange in X - Complete Documentation

PLACE IMAGE OF THE SIDEBAR PANEL WITH THE "Arrange in X" OPTION IN FOCUS HERE

The "Arrange in X" tool in DAMTools allows distributing selected objects in a row along the X axis, with configurable spacing and options to reset Y/Z and sort by name. It's ideal for organizing parts, imported models, or preparing scenes for 3D printing.


Index


What is Arrange in X?

It allows distributing selected objects in a row along the X axis, automatically calculating the offset based on each object's size (bounding box) and applying a user-defined spacing. Optionally, it can reset Y/Z and rotation.

PLACE IMAGE OF OBJECTS BEFORE AND AFTER ARRANGING IN X HERE


Workflow

  1. Select the objects to arrange.
  2. Activate the "Arrange in X" operator from the sidebar panel or pie menu.
  3. Configure spacing, reset Y/Z, and order in the pop-up dialog.
  4. Objects are automatically distributed along X.

PLACE GIF OR IMAGE SEQUENCE OF THE ARRANGING WORKFLOW HERE


Shortcuts and Access

  • DAMTools Sidebar Panel: "Arrange in X" option.
  • DAMTools Pie Menu (Shift+W): "Arrange in X" option.
  • Operator: object.arrange_selected_x
  • Arrange + Reset Rotation: Alt+Click in the menu or use object.arrange_selected_x_reset_rot

Functionality Explanation

Configurable Spacing

  • The user can define the X spacing between objects.
  • The offset is calculated using each object's bounding box.

Reset Y/Z

  • Option to place all objects at Y=0 and Z=0 (base).
  • Useful for aligning objects on the base plane.

Sort by Name

  • Option to sort objects alphabetically before arranging them.
  • Provides a logical and predictable order.

Arrange + Reset Rotation Alt

  • If Alt+Click is used, in addition to arranging in X, the objects' rotation is reset to (0,0,0).

Key Code Snippets

Distribute Objects in X

def execute(self, context):
    # ...
    objects_to_arrange = sorted(selected_objects, key=lambda obj: obj.name) if self.sort_by_name else selected_objects
    current_x_cursor = 0.0
    for i, obj in enumerate(objects_to_arrange):
        # Calculate BBox and extremes
        world_corners = get_world_bbox_corners(obj)
        min_x, max_x, min_y, max_y, min_z, max_z = get_world_bbox_extremes(world_corners)
        shift_x = current_x_cursor - min_x
        shift_y = 0.0 - min_y if self.reset_y_z else 0.0
        shift_z = 0.0 - min_z if self.reset_y_z else 0.0
        obj.matrix_world.translation += Vector((shift_x, shift_y, shift_z))
        # Update X cursor for the next object
        world_corners_after_move = get_world_bbox_corners(obj)
        _, final_max_x, _, _, _, _ = get_world_bbox_extremes(world_corners_after_move)
        current_x_cursor = final_max_x + self.spacing

Reset Rotation (Alt)

def execute(self, context):
    bpy.ops.object.arrange_selected_x()
    for obj in context.selected_objects:
        obj.rotation_euler = (0.0, 0.0, 0.0)

Suggested Images

  • PLACE IMAGE OF THE SIDEBAR PANEL WITH THE OPTION IN FOCUS
  • PLACE GIF OF THE ARRANGING IN X WORKFLOW
  • PLACE IMAGE OF OBJECTS BEFORE AND AFTER USING THE TOOL
  • PLACE IMAGE OF THE DAMTools PIE MENU WITH "Arrange in X" IN FOCUS

For technical details and explanation of each file, see the technical documentation in the [DOCUMENTATION] folder.