add comment to the epattern add-on
@@ -11,35 +11,23 @@ from ezdxf.lldxf.tagwriter import TagWriter, AbstractTagWriter
__all__ = ["export_file", "export_stream"]
+# This add-on was created to solve this problem: https://github.com/mozman/ezdxf/discussions/789
+# But it turned out that this add-on is not needed at all, the files generated by Gerber
+# Technology do not follow the ASTM-D6673-10 standard.
+#
+# This add-on creates non-DXF files to accommodate Gerber Technology's software, but I
+# hate creating invalid DXF files, so this add-on will not be merged into the master
+# branch nor further maintained.
+#
+# Use at your own risk!
-def export_file(doc: Drawing, filename: str | os.PathLike) -> None:
- """Exports ASTM/AAMA compliant DXF R12 files (ASTM-DXF/D6673).
- The input document must correspond to the DXF R12 format.
-
- Args:
- doc: DXF document of type :class:`ezdxf.document.Drawing`
- filename: filename as string or a path-like object
- Raises:
- DXFVersionError: invalid DXF version of the input document
-
- """
+def export_file(doc: Drawing, filename: str | os.PathLike) -> None:
fp = io.open(filename, mode="wt", encoding="ascii", errors="dxfreplace")
export_stream(doc, fp)
def export_stream(doc: Drawing, stream: TextIO) -> None:
- """Exports ASTM/AAMA compliant DXF R12 files (ASTM-DXF/D6673) to the given `stream`
- instance. The input document must correspond to the DXF R12 format.
-
- Args:
- doc: DXF document of type :class:`ezdxf.document.Drawing`
- stream: text stream with "ascii" encoding
-
- Raises:
- DXFVersionError: invalid DXF version of the input document
-
- """
if doc.dxfversion != ezdxf.const.DXF12:
raise ezdxf.DXFVersionError("only DXF R12 format is supported")
tagwriter = TagWriter(stream, write_handles=False, dxfversion=ezdxf.const.DXF12)
@@ -47,8 +35,10 @@ def export_stream(doc: Drawing, stream: TextIO) -> None:
def _export_sections(doc: Drawing, tagwriter: AbstractTagWriter) -> None:
- """DXF export sections. (internal API)"""
# export empty header section
+ tagwriter.write_str(
+ "999\ninvalid DXF file created for usage by Gerber Technology software\n"
+ )
tagwriter.write_str(" 0\nSECTION\n 2\nHEADER\n")
tagwriter.write_tag2(0, "ENDSEC")
# export block definitions
@@ -66,4 +56,3 @@ def _export_blocks(doc: Drawing, tagwriter: AbstractTagWriter) -> None:
if block_record.is_block_layout:
block_record.export_block_definition(tagwriter)
tagwriter.write_tag2(0, "ENDSEC")
-
