Closed cococosusu closed 11 months ago
There is a template for creating an issue - the important part is data or code to reproduce the error, without this information I can't help.
@mozman Oh, I'm sorry. I have attached the DWG file and included the code.
Hi!
This is a huge DXF file 59MB when converted from DWG.
Ezdxf
is maybe not the right kind of tool to handle such huge and complex drawing.
I have no idea which application created this drawing (it's not AutoCAD) but my computer still tries to render this file while writing this comment.
I already condensed the file to 29MB by using the PURGE
and WBLOCK
commands in BricsCAD.
-- still rendering
I don't see any chance to fix this. I don't have the time and the will to debug a 29MB DXF file. Sorry.
-- still rendering ...
The process uses all available memory which means heavy page swapping and a massive slowdown...
-- after 25 min. I stopped the process...
I can and will only help if you can create a small example to reproduce the error.
@mozman I really appreciate your hard work in answering!
I reorganized a specific block in autoCAD and made it smaller. Here is the download link for the DWG file.
I also ran the code again and the results are as follows.
AutoCAD screen
Export to PDF from AutoCAD
code result
Which ezdxf
version do you use, because the current version renders nothing for "sample_small.dwg" converted by BricsCAD to DXF R2013.
I use version '1.1.3'
and
I modified some of the attached code. Frontend(ctx, out, config=config).draw_layout(layout, finalize=True) # finalize False -> True
I made a mistake
OK, I can reproduce the error and get the same result as you.
That's good to hear!
As far as I've checked, it seems that ezdxf draws all possible information when creating a drawing. This implies that the issue isn't related to problems arising from PNG conversion. It appears that ezdxf draws even hidden information.
When checking the CAD screen shown by the 'ezdxf view' command, it's similar to the PNG conversion results.
ezdxf view
A quick fix in AutoCAD is to save the visible content via WBLOCK
in a new DXF file.
The file size goes down to 3.5MB from 20MB and ezdxf
renders only the visible part:
It seems this file uses SPATIAL_FILTER
objects to clip parts of the modelspace. This is not supported by ezdxf
- I don't even know how this works.
Wow! Thank you so much! You're a lifesaver! 😄 As you mentioned, I was able to get information about the cropped area by checking the spatial filter. I really appreciate your help!!
Describe the bug The result of converting to png is different from the CAD file! I've confirmed that the conversion works well by referring to the drawing-related documentation. However, the output seems to be different.
When I exploded something in AutoCAD, something came out. (Like the converted image below) Your code seems to draw even the hidden objects inside.
How do I draw only the objects that are clearly visible in CAD?
Result Screenshots
CAD
converted image
Code
DWG File link