This document describes the new assembly image creation functionality added to PyInventor.
The new feature allows you to automatically create images of Autodesk Inventor assembly files (IAM) from six different perspectives with various rendering options. This addresses the requirement to batch process assemblies and generate documentation images.
A new class for handling Inventor assembly documents, similar to the existing iPart class but specifically for assemblies.
__init__(path, prefix, overwrite=False)- Initialize and open an assemblyset_view_orientation(view_type)- Set camera to standard views ('front', 'back', 'left', 'right', 'top', 'bottom', 'iso')set_visual_style(shaded, edges, hidden_edges, realistic)- Control rendering appearanceexport_image(filename, file_path, image_format, width, height)- Export current view as imagecreate_perspective_images(...)- Create images from multiple perspectives automaticallyclose(save=False)- Close the assembly document
A utility function for batch processing multiple assembly files in a folder.
from PyInventor import iAssembly
# Open an assembly
assembly = iAssembly(path='C:\\assemblies', prefix='my_assembly.iam')
# Create images from all six perspectives with realistic rendering
images = assembly.create_perspective_images(
base_filename='my_assembly_realistic',
views=['front', 'back', 'left', 'right', 'top', 'bottom'],
realistic=True,
wireframe=False
)
# Create wireframe images for technical documentation
wireframe_images = assembly.create_perspective_images(
base_filename='my_assembly_wireframe',
views=['front', 'top', 'right'],
realistic=False,
wireframe=True
)
assembly.close()from PyInventor import create_assembly_images_batch
# Process all IAM files in a folder
results = create_assembly_images_batch(
assembly_folder='C:\\my_assemblies',
output_folder='C:\\output_images',
views=['front', 'back', 'left', 'right', 'top', 'bottom'],
realistic=True,
wireframe=False
)
# Process with wireframe rendering
wireframe_results = create_assembly_images_batch(
assembly_folder='C:\\my_assemblies',
output_folder='C:\\wireframe_images',
views=['front', 'top', 'iso'],
realistic=False,
wireframe=True
)- Front - Front view of the assembly
- Back - Back view of the assembly
- Left - Left side view
- Right - Right side view
- Top - Top view (plan view)
- Bottom - Bottom view
- Iso - Isometric view (3D perspective)
- Realistic - Photorealistic rendering with materials and lighting
- Wireframe - Line-based technical drawing style
- Shaded - Standard shaded view with or without edges
- Hidden edges - Control visibility of hidden edges
- PNG (default, best quality)
- JPG/JPEG (smaller file size)
- BMP (uncompressed)
- TIF/TIFF (high quality)
- Custom width and height in pixels
- Common presets:
- HD: 1920x1080
- 4K: 3840x2160
- Preview: 800x600
- Technical: 2048x1536
- Windows operating system
- Autodesk Inventor installed (2017 or later, 2019+ recommended)
- PyInventor dependencies (win32com, etc.)
- Assembly files (.iam) to process
The functions include comprehensive error handling:
- Invalid file paths or missing assemblies
- Unsupported view orientations
- Image export failures
- COM interface errors
Errors are reported with descriptive messages, and batch processing continues even if individual assemblies fail.
Images are automatically organized into folders:
- Single assembly: Creates subfolders by rendering type
- Batch processing: Creates subfolders for each assembly
- Naming convention:
{assembly_name}_{view_type}.{format}
The new functionality is fully integrated with the existing PyInventor codebase:
- Uses the same COM initialization (
com_objbase class) - Compatible visual style settings
- Consistent file handling patterns
- Same error handling approach
This maintains backward compatibility while adding powerful new capabilities for assembly documentation and visualization.