Skip to content

Batch Import - Complete Documentation

PLACE IMAGE OF THE IMPORT PANEL IN THE DAMTools NPANEL HERE

The DAMTools Batch Import tool allows importing multiple OBJ and STL files in bulk, applying automatic offsets by folder or by name, and supporting recursive search in subfolders. It is ideal for engineering, 3D printing, and organizing large volumes of files.


Index


What is Batch Import?

It allows importing dozens or hundreds of OBJ/STL files in a single operation, automatically organizing the objects in 3D space according to the folder structure or filename. It supports: - Automatic X offset by folder or by the ending number in the name. - Recursive import in subfolders. - Selection of formats to import (OBJ, STL). - Full integration with DAMTools' sidebar panel and pie menu.

PLACE IMAGE OF THE IMPORT FOLDER SELECTION WINDOW HERE


Workflow

  1. Open the DAMTools sidebar panel (N Panel).
  2. Go to the "Batch Import" section.
  3. Configure the formats and search/offset options.
  4. Press "Import from Folder..." and select the base folder.
  5. The files are imported and automatically distributed along X according to the configuration.

PLACE GIF OR IMAGE SEQUENCE OF THE IMPORT WORKFLOW HERE


Options and Parameters

  • Formats: OBJ, STL (can be enabled/disabled).
  • Recursive Search: Imports files in subfolders.
  • Offset by Folder: Applies X offset for each folder or group.
  • Offset by Name: If there are no subfolders, uses the ending number in the filename for grouping.
  • Offset Value: X spacing between groups.

Shortcuts and Access

  • DAMTools Sidebar Panel: "Batch Import" section.
  • DAMTools Pie Menu (Shift+W): "Import Batch" option.
  • Operator: object.batch_import_files

PLACE IMAGE OF THE DAMTools PIE MENU WITH THE IMPORT OPTION IN FOCUS HERE


Functionality Explanation

Offset by Folder or Name

  • If there are subfolders, each folder receives a different X offset.
  • If there are no subfolders, it groups by the ending number in the filename.
  • The offset is configurable.

Recursive Import

  • Allows importing files from all subfolders of the base folder.
  • Ideal for projects with a hierarchical structure.

Format Support

  • OBJ and/or STL files can be imported.
  • The user can enable/disable each format as needed.

Key Code Snippets

File Search and Grouping

def process_file(filepath, root_dir):
    filename = os.path.basename(filepath)
    group_key = root_dir # Default
    if self._use_name_pattern_for_offset:
        group_key = get_grouping_key_from_name(filename)
    if group_key is not None:
        self._files_to_process.append((filepath, group_key))
        temp_group_keys.add(group_key)

Applying Offset on Import

if imported_ok:
    self._imported_count += 1
    if x_offset != 0.0:
        context.view_layer.update()
        objects_after_import = set(context.scene.objects); newly_imported_objects = objects_after_import - objects_before_import
        for obj in newly_imported_objects:
            obj.location.x += x_offset

Suggested Images

  • PLACE IMAGE OF THE IMPORT PANEL IN THE NPANEL
  • PLACE IMAGE OF THE FOLDER SELECTION WINDOW
  • PLACE GIF OF THE BATCH IMPORT WORKFLOW
  • PLACE IMAGE OF THE DAMTools PIE MENU WITH IMPORT IN FOCUS

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