From 0561cf7899e728d4b80dbcab108ce880fcafbf8c Mon Sep 17 00:00:00 2001 From: Thomas Kremer <-> Date: Thu, 24 Sep 2020 21:58:49 +0200 Subject: initial commit --- dxf2xml.pl | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 dxf2xml.pl (limited to 'dxf2xml.pl') diff --git a/dxf2xml.pl b/dxf2xml.pl new file mode 100755 index 0000000..4ed31af --- /dev/null +++ b/dxf2xml.pl @@ -0,0 +1,29 @@ +#!/usr/bin/perl + +# converts a DXF file to XML for viewing and editing. + +## Copyright (c) 2018-2020 by Thomas Kremer +## License: GPL ver. 2 or 3 + +# usage: +# dxf2xml.pl infile.dxf > outfile.xml +# dxf2xml.pl < infile.dxf > outfile.xml + +use strict; +use warnings; + +use DXF; +use XML::DOM; +use IO::Handle; + +my $file = shift; +my $f; +if (defined $file) { + open($f, "<", $file) or die "cannot open file"; +} else { + $f = \*STDIN; +} +my $lol = DXF::parse_dxf($f); +my $xml = DXF::lol2xml($lol); +print $xml->toString; + -- cgit v1.2.3