Replies: 2 comments 1 reply
-
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Gashmen
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello @mozman.
I encountered a peculiarity when Importing a block after renaming in library_doc.
So I have dxf_file_lib like a lib, with all blocks. And when I want to import block that I need importer won't add in doc.blocks.
Previous, I changed names in dxf_file_lib with using function doc.blocks.rename_block(old_name,new_name).
I changed all names that started with U, and create some structures in block like: if block has inserts, that need to rename it.
And example I has blocks like : 'Main_name', 'Main_name_U45', 'Main_name_U587', 'Main_name_U587_U659' and ...
On JPG N1 I want to show all names of block_layout.
After I used code:
doc = ezdxf.readfile(dxf_file_lib)
doc_new_file = ezdxf.new(dxfversion='AC1024')
importer = Importer(doc, doc_new_file)
list_with_block_names = [block.dxf.name for block in doc.blocks if '*' not in block.dxf.name]
for i in list_with_block_names:
importer.import_block(i)
importer.finalize()
And then:
I was checked the dxf_file_lib in Notepad and I saw, that they have names U22 and U22 is AcDbBlockReference or Insert

What I need to do for fix it? Easy way is to change it with open dxf like txt file and search U_blocks, but mb you have a solution.
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions