How can I divide a DXF image into smaller blocks through scripting?
My QCAD DXF File consists of many closed regions enclosed by polylines. What I need to do is split this large DXF image into many 10x10 blocks and export each as a separate DXF file (or BMP, if possible).
How can I achieve this? If there’s a way to do it using a script in QCAD, that would be ideal. If there’s no QCAD script available, how can I accomplish this through programming? A1_Copy.DXF (1.98 MB)
Hi, Before this was 4080 by 4080, now 10200 by 10200, exploded and scaled up by 2.5
Before it were 2 hatches, now exploded to 7335 logically closed polylines.
If 10x10 is in units, then that would mean 1040400 blocks, and thus 1040400 files (DWG/DXF or BMP).
Preferably in the BMP format because that stores only 100 pixels and not all drawing related.
An empty DXF is already about 100kb large, all files together already 99Gb … But still empty.
The original and this file have ‘A1’ in the file name.
Presumably not related to a paper size ‘ISO A1’ because that is limited to 594mm.
Besides that, the drawing unit is ‘None’.
The function Clip To Rectangle (CLR) comes to my mind.
A) That would clip a hatch by exploding it and then clip the contours.
B) Clipping the contours like in this file will leave clipped polylines open.
If not intended to fill again (BMP format) then you need to account for the Lineweight what is set to ‘Default’.
What that is depends on your Application Preference.
As DXF/DWG snippets there are no means of filling the original areas again.
For a filled or not filled export:
The solution is thus to create a batch file that calls dwg2bmp to export a specific area defined in the -w, -window=X,Y,W,H switch.
Iterating X and Y nested, just over a million times