Skip to content

Bug Fix: Block Export - AttributeError: Item.Export

Latest

Choose a tag to compare

@Jones-peter Jones-peter released this 14 Mar 10:38

Release Notes - v0.1.12

Bug Fix: Block Export - AttributeError: Item.Export

Fixed: export_block_to_file() was throwing AttributeError: Item.Export when trying to export blocks from a template .dwg to a new file. This has been resolved.

Thanks to @VinhHWork for reporting this bug in [Issue #6](#6).

What changed: The old export_block_to_file() has been replaced with a new export_blocks_to_file() method that supports exporting multiple blocks at once to a .dwg file.

Usage:

from AutoCAD import AutoCAD

acad = AutoCAD()
acad.open_file(r"C:\Templates\Template.dwg")

# Export a single block
acad.export_blocks_to_file(
    block_names=["New_Print_Block"],
    file_path=r"C:\Output\new.dwg"
)

# Export multiple blocks at once
acad.export_blocks_to_file(
    block_names=["Block_A", "Block_B", "Block_C"],
    file_path=r"C:\Output\exported.dwg"
)

Note: If the target file already exists, the blocks are merged into it. If it doesn't exist, a new file is created.