summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan McInerney <ian.s.mcinerney@ieee.org>2023-09-16 10:47:25 +0000
committerDavid Faure <faure@kde.org>2023-09-16 10:47:25 +0000
commit5a2232d5cd3a3ceae8e07982b73c095eb5627302 (patch)
tree28b607c41769fe1e9a534caa8f14d5d052fb2ffb
parentc9ea6166e05f01cebfaab369c1f64886481990d2 (diff)
Add Gerber and Excellon drill files
-rw-r--r--data/freedesktop.org.xml.in35
-rw-r--r--tests/mime-detection/list16
-rw-r--r--tests/mime-detection/pcb-drillFile.drl10
-rw-r--r--tests/mime-detection/pcb-drillFileNoExt10
-rw-r--r--tests/mime-detection/pcb-gerber-CommentNoExt5
-rw-r--r--tests/mime-detection/pcb-gerber-FSLANoExt5
-rw-r--r--tests/mime-detection/pcb-gerber-G75NoExt7
-rw-r--r--tests/mime-detection/pcb-gerber-MONoExt5
-rw-r--r--tests/mime-detection/pcb-gerber-TFNoExt15
-rw-r--r--tests/mime-detection/pcb-gerber.gbr5
-rw-r--r--tests/mime-detection/pcb-gerber.gts8
-rw-r--r--tests/mime-detection/pcb-gerberjob.gbrjob119
12 files changed, 240 insertions, 0 deletions
diff --git a/data/freedesktop.org.xml.in b/data/freedesktop.org.xml.in
index c3e8e6c..9e7979a 100644
--- a/data/freedesktop.org.xml.in
+++ b/data/freedesktop.org.xml.in
@@ -8212,4 +8212,39 @@ command to generate the output files.
<match type="string" value="\xD9\xD9\xF7\x84\xD9\x01\x14\x58\x42" offset="0"/>
</magic>
</mime-type>
+ <mime-type type="application/vnd.gerber">
+ <comment>Gerber file</comment>
+ <sub-class-of type="text/plain"/>
+ <glob pattern="*.gbr"/>
+ <!--Try to match with some common opening commands-->
+ <magic>
+ <!--A comment line-->
+ <match type="string" value="G04 " offset="0"/>
+ <!--Some setup macros-->
+ <match type="string" value="%FSLA" offset="0"/>
+ <match type="string" value="%MO" offset="0"/>
+ <match type="string" value="%TF." offset="0"/>
+ <!--Seems to be common with files exported from some programs-->
+ <match type="string" value="G75*" offset="0"/>
+ </magic>
+ <generic-icon name="text-x-generic"/>
+ <!--Already being used as the MIME identifier by some programs-->
+ <alias type="application/x-gerber"/>
+ </mime-type>
+ <mime-type type="application/x-gerber-job">
+ <comment>Gerber job file</comment>
+ <sub-class-of type="application/json"/>
+ <glob pattern="*.gbrjob"/>
+ <generic-icon name="text-x-generic"/>
+ </mime-type>
+ <mime-type type="application/x-excellon">
+ <comment>Excellon drill file</comment>
+ <sub-class-of type="text/plain"/>
+ <glob pattern="*.drl"/>
+ <magic>
+ <!--This is always the header for an excellon drill file-->
+ <match type="string" value="M48\n" offset="0"/>
+ </magic>
+ <generic-icon name="text-x-generic"/>
+ </mime-type>
</mime-info>
diff --git a/tests/mime-detection/list b/tests/mime-detection/list
index 499fbde..2148dcc 100644
--- a/tests/mime-detection/list
+++ b/tests/mime-detection/list
@@ -978,3 +978,19 @@ test.nimble text/x-nimscript ox
# Typst document
test.typ text/x-typst ox
+
+# PCB Fabrication data transfer formats
+# Both GIMP brush and Gerber files share the glob for .gbr, so we can't use filename-based
+# tests here because the files are identified as GIMP brushes using the glob.
+pcb-gerber.gbr application/vnd.gerber x
+pcb-gerber.gts application/vnd.gerber x
+pcb-gerber-CommentNoExt application/vnd.gerber x
+pcb-gerber-FSLANoExt application/vnd.gerber x
+pcb-gerber-G75NoExt application/vnd.gerber x
+pcb-gerber-MONoExt application/vnd.gerber x
+pcb-gerber-TFNoExt application/vnd.gerber x
+
+pcb-gerberjob.gbrjob application/x-gerber-job ox
+
+pcb-drillFile.drl application/x-excellon
+pcb-drillFileNoExt application/x-excellon x
diff --git a/tests/mime-detection/pcb-drillFile.drl b/tests/mime-detection/pcb-drillFile.drl
new file mode 100644
index 0000000..85110e7
--- /dev/null
+++ b/tests/mime-detection/pcb-drillFile.drl
@@ -0,0 +1,10 @@
+M48
+;DRILL file {Pcbnew (2013-june-11)-stable} date Sun 22 Dec 2013 07:48:59 PM CST
+;FORMAT={-:-/ absolute / inch / decimal}
+FMAT,2
+INCH,TZ
+T1C0.025
+T2C0.032
+T3C0.032
+T4C0.120
+T5C0.126
diff --git a/tests/mime-detection/pcb-drillFileNoExt b/tests/mime-detection/pcb-drillFileNoExt
new file mode 100644
index 0000000..85110e7
--- /dev/null
+++ b/tests/mime-detection/pcb-drillFileNoExt
@@ -0,0 +1,10 @@
+M48
+;DRILL file {Pcbnew (2013-june-11)-stable} date Sun 22 Dec 2013 07:48:59 PM CST
+;FORMAT={-:-/ absolute / inch / decimal}
+FMAT,2
+INCH,TZ
+T1C0.025
+T2C0.032
+T3C0.032
+T4C0.120
+T5C0.126
diff --git a/tests/mime-detection/pcb-gerber-CommentNoExt b/tests/mime-detection/pcb-gerber-CommentNoExt
new file mode 100644
index 0000000..3045ff1
--- /dev/null
+++ b/tests/mime-detection/pcb-gerber-CommentNoExt
@@ -0,0 +1,5 @@
+G04 (created by PCBNEW (2013-june-11)-stable) date Sun 22 Dec 2013 07:48:57 PM CST*
+%MOIN*%
+G04 Gerber Fmt 3.4, Leading zero omitted, Abs format*
+%FSLAX34Y34*%
+G01*
diff --git a/tests/mime-detection/pcb-gerber-FSLANoExt b/tests/mime-detection/pcb-gerber-FSLANoExt
new file mode 100644
index 0000000..be23765
--- /dev/null
+++ b/tests/mime-detection/pcb-gerber-FSLANoExt
@@ -0,0 +1,5 @@
+%FSLAX34Y34*%
+G04 (created by PCBNEW (2013-june-11)-stable) date Sun 22 Dec 2013 07:48:57 PM CST*
+%MOIN*%
+G04 Gerber Fmt 3.4, Leading zero omitted, Abs format*
+G01*
diff --git a/tests/mime-detection/pcb-gerber-G75NoExt b/tests/mime-detection/pcb-gerber-G75NoExt
new file mode 100644
index 0000000..3b819a6
--- /dev/null
+++ b/tests/mime-detection/pcb-gerber-G75NoExt
@@ -0,0 +1,7 @@
+G75*
+G70*
+%OFA0B0*%
+%FSLAX24Y24*%
+%IPPOS*%
+%LPD*%
+%AMOC8*
diff --git a/tests/mime-detection/pcb-gerber-MONoExt b/tests/mime-detection/pcb-gerber-MONoExt
new file mode 100644
index 0000000..5b36cb8
--- /dev/null
+++ b/tests/mime-detection/pcb-gerber-MONoExt
@@ -0,0 +1,5 @@
+%MOIN*%
+%FSLAX34Y34*%
+G04 (created by PCBNEW (2013-june-11)-stable) date Sun 22 Dec 2013 07:48:57 PM CST*
+G04 Gerber Fmt 3.4, Leading zero omitted, Abs format*
+G01*
diff --git a/tests/mime-detection/pcb-gerber-TFNoExt b/tests/mime-detection/pcb-gerber-TFNoExt
new file mode 100644
index 0000000..d7f1a93
--- /dev/null
+++ b/tests/mime-detection/pcb-gerber-TFNoExt
@@ -0,0 +1,15 @@
+%TF.GenerationSoftware,KiCad,Pcbnew,(5.99.0-9879-gcc9787e47a)*%
+%TF.CreationDate,2021-03-20T01:50:30+00:00*%
+%TF.ProjectId,pic_programmer,7069635f-7072-46f6-9772-616d6d65722e,rev?*%
+%TF.SameCoordinates,Original*%
+%TF.FileFunction,Copper,L2,Bot*%
+%TF.FilePolarity,Positive*%
+%FSLAX46Y46*%
+G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
+G04 Created by KiCad (PCBNEW (5.99.0-9879-gcc9787e47a)) date 2021-03-20 01:50:30*
+%MOMM*%
+%LPD*%
+G01*
+G04 APERTURE LIST*
+G04 Aperture macros list*
+%AMRoundRect*
diff --git a/tests/mime-detection/pcb-gerber.gbr b/tests/mime-detection/pcb-gerber.gbr
new file mode 100644
index 0000000..3045ff1
--- /dev/null
+++ b/tests/mime-detection/pcb-gerber.gbr
@@ -0,0 +1,5 @@
+G04 (created by PCBNEW (2013-june-11)-stable) date Sun 22 Dec 2013 07:48:57 PM CST*
+%MOIN*%
+G04 Gerber Fmt 3.4, Leading zero omitted, Abs format*
+%FSLAX34Y34*%
+G01*
diff --git a/tests/mime-detection/pcb-gerber.gts b/tests/mime-detection/pcb-gerber.gts
new file mode 100644
index 0000000..5c9fd0b
--- /dev/null
+++ b/tests/mime-detection/pcb-gerber.gts
@@ -0,0 +1,8 @@
+G04 (created by PCBNEW (2013-june-11)-stable) date Sun 22 Dec 2013 07:48:57 PM CST*
+%MOIN*%
+G04 Gerber Fmt 3.4, Leading zero omitted, Abs format*
+%FSLAX34Y34*%
+G01*
+G70*
+G90*
+G04 APERTURE LIST*
diff --git a/tests/mime-detection/pcb-gerberjob.gbrjob b/tests/mime-detection/pcb-gerberjob.gbrjob
new file mode 100644
index 0000000..3eac85a
--- /dev/null
+++ b/tests/mime-detection/pcb-gerberjob.gbrjob
@@ -0,0 +1,119 @@
+{
+ "Header": {
+ "GenerationSoftware": {
+ "Vendor": "KiCad",
+ "Application": "Pcbnew",
+ "Version": "(5.99.0-10960-g5f1e9bc8a7-dirty)"
+ },
+ "CreationDate": "2021-07-08T02:55:20+01:00"
+ },
+ "GeneralSpecs": {
+ "ProjectId": {
+ "Name": "",
+ "GUID": "58585858-5858-4585-9858-585858585858",
+ "Revision": "rev?"
+ },
+ "Size": {
+ "X": 0.0,
+ "Y": 0.0
+ },
+ "LayerNumber": 2,
+ "BoardThickness": 1.6,
+ "Finish": "None"
+ },
+ "DesignRules": [
+ {
+ "Layers": "Outer",
+ "PadToPad": 0.2,
+ "PadToTrack": 0.2,
+ "TrackToTrack": 0.2
+ }
+ ],
+ "FilesAttributes": [
+ {
+ "Path": "-F_Cu.gbr",
+ "FileFunction": "Copper,L1,Top",
+ "FilePolarity": "Positive"
+ },
+ {
+ "Path": "-B_Cu.gbr",
+ "FileFunction": "Copper,L2,Bot",
+ "FilePolarity": "Positive"
+ },
+ {
+ "Path": "-F_Paste.gbr",
+ "FileFunction": "SolderPaste,Top",
+ "FilePolarity": "Positive"
+ },
+ {
+ "Path": "-B_Paste.gbr",
+ "FileFunction": "SolderPaste,Bot",
+ "FilePolarity": "Positive"
+ },
+ {
+ "Path": "-F_Silkscreen.gbr",
+ "FileFunction": "Legend,Top",
+ "FilePolarity": "Positive"
+ },
+ {
+ "Path": "-B_Silkscreen.gbr",
+ "FileFunction": "Legend,Bot",
+ "FilePolarity": "Positive"
+ },
+ {
+ "Path": "-F_Mask.gbr",
+ "FileFunction": "SolderMask,Top",
+ "FilePolarity": "Negative"
+ },
+ {
+ "Path": "-B_Mask.gbr",
+ "FileFunction": "SolderMask,Bot",
+ "FilePolarity": "Negative"
+ },
+ {
+ "Path": "-Edge_Cuts.gbr",
+ "FileFunction": "Profile",
+ "FilePolarity": "Positive"
+ }
+ ],
+ "MaterialStackup": [
+ {
+ "Type": "Legend",
+ "Name": "Top Silk Screen"
+ },
+ {
+ "Type": "SolderPaste",
+ "Name": "Top Solder Paste"
+ },
+ {
+ "Type": "SolderMask",
+ "Name": "Top Solder Mask"
+ },
+ {
+ "Type": "Copper",
+ "Name": "F.Cu"
+ },
+ {
+ "Type": "Dielectric",
+ "Material": "FR4",
+ "Name": "F.Cu/B.Cu",
+ "Notes": "Type: dielectric layer 1 (from F.Cu to B.Cu)"
+ },
+ {
+ "Type": "Copper",
+ "Name": "B.Cu"
+ },
+ {
+ "Type": "SolderMask",
+ "Name": "Bottom Solder Mask"
+ },
+ {
+ "Type": "SolderPaste",
+ "Name": "Bottom Solder Paste"
+ },
+ {
+ "Type": "Legend",
+ "Name": "Bottom Silk Screen"
+ }
+ ]
+}