Skip to content

Join Nearby Objects - Complete Documentation

The "Join Nearby Objects" tool in DAMTools allows automatically grouping and joining mesh objects whose bounding boxes are close or overlapping, facilitating the cleanup and organization of complex scenes.


Index


What is Join Nearby Objects?

It allows selecting multiple mesh objects and automatically joining those that are close to each other, using a configurable proximity threshold based on bounding boxes. It's ideal for cleaning up imported scenes or fragmented models.


Workflow

  1. Select two or more mesh objects.
  2. Configure the proximity threshold in the sidebar panel.
  3. Activate the "Join Nearby Objects" operator from the sidebar panel or pie menu.
  4. Nearby objects are grouped and automatically joined.

Shortcuts and Access

  • DAMTools Sidebar Panel: "Join Nearby Objects" option.
  • DAMTools Pie Menu (Shift+W): "Join Nearby" option.
  • Operator: object.join_nearby

Functionality Explanation

Proximity Grouping

  • Uses the objects' bounding boxes to determine if they are close or overlapping.
  • The proximity threshold is configurable by the user.

Automatic Group Joining

  • Grouped objects are selected, and the join operator (bpy.ops.object.join()) is applied.
  • All found groups in the selection are processed.

Selection Restoration

  • Upon completion, the selection and active object are restored to avoid interrupting the workflow.

Key Code Snippets

Object Grouping by Bounding Box

def are_bboxes_close(obj1, obj2, threshold=0.001):
    # Returns True if the bounding boxes of obj1 and obj2 are close according to the threshold

Group Joining

for i, group_names in enumerate(original_names_in_groups):
    group_objs = {bpy.data.objects.get(name) for name in group_names}
    # Select and join objects in the group
    bpy.ops.object.join()

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