adding back more extensions
This commit is contained in:
parent
81fbfad31a
commit
1c9bd9e355
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||||
|
<name>AI compatible EPS output</name>
|
||||||
|
<id>fablabchemnitz.de.ai_compatible_eps_output</id>
|
||||||
|
<output>
|
||||||
|
<extension>.eps</extension>
|
||||||
|
<mimetype>application/eps</mimetype>
|
||||||
|
<filetypename>Encapsulated PostScript - AI compatible (*.eps)</filetypename>
|
||||||
|
<filetypetooltip>Adobe Illustrator 7 compatible EPS</filetypetooltip>
|
||||||
|
</output>
|
||||||
|
<script>
|
||||||
|
<command location="inx" interpreter="python">ai_compatible_eps_output.py</command>
|
||||||
|
</script>
|
||||||
|
</inkscape-extension>
|
File diff suppressed because it is too large
Load Diff
21
extensions/fablabchemnitz/ai_compatible_eps_output/meta.json
Normal file
21
extensions/fablabchemnitz/ai_compatible_eps_output/meta.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "AI compatible EPS output",
|
||||||
|
"id": "fablabchemnitz.de.ai_compatible_eps_output",
|
||||||
|
"path": "ai_compatible_eps_output",
|
||||||
|
"dependent_extensions": null,
|
||||||
|
"original_name": "AI compatible EPS output",
|
||||||
|
"original_id": "org.inkscape.output.ai_eps",
|
||||||
|
"license": "MIT License",
|
||||||
|
"license_url": "https://github.com/tzunghaor/inkscape-eps-export/blob/master/aieps_output.py",
|
||||||
|
"comment": "",
|
||||||
|
"source_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.X/src/branch/master/extensions/fablabchemnitz/ai_compatible_eps_output",
|
||||||
|
"fork_url": "https://github.com/tzunghaor/inkscape-eps-export",
|
||||||
|
"documentation_url": "https://stadtfabrikanten.org/pages/viewpage.action?pageId=55018922&searchId=UF0RDT9E0",
|
||||||
|
"inkscape_gallery_url": null,
|
||||||
|
"main_authors": [
|
||||||
|
"github.com/tzunghaor",
|
||||||
|
"github.com/vmario89"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
@ -15,29 +15,30 @@ class BoundingBox(inkex.EffectExtension):
|
|||||||
pars.add_argument('--split', type = inkex.Boolean, default = True, help = 'Handle selection as group')
|
pars.add_argument('--split', type = inkex.Boolean, default = True, help = 'Handle selection as group')
|
||||||
|
|
||||||
def drawBBox(self, bbox):
|
def drawBBox(self, bbox):
|
||||||
so = self.options
|
if bbox is not None: #bbox might be None in case of shape elements like pointy paths
|
||||||
offset = self.svg.unittouu(str(so.offset) + so.unit)
|
so = self.options
|
||||||
if self.options.box:
|
offset = self.svg.unittouu(str(so.offset) + so.unit)
|
||||||
attribs = {
|
if self.options.box:
|
||||||
'style' : str(inkex.Style({'stroke':'#ff0000','stroke-width':str(self.svg.unittouu("1px")),'fill':'none'})),
|
attribs = {
|
||||||
'x' : str(bbox.left - offset),
|
'style' : str(inkex.Style({'stroke':'#ff0000','stroke-width':str(self.svg.unittouu("1px")),'fill':'none'})),
|
||||||
'y' : str(bbox.top - offset),
|
'x' : str(bbox.left - offset),
|
||||||
'width' : str(bbox.width + 2 * offset),
|
'y' : str(bbox.top - offset),
|
||||||
'height': str(bbox.height + 2 * offset),
|
'width' : str(bbox.width + 2 * offset),
|
||||||
'ry' : str(self.options.corner_radius),
|
'height': str(bbox.height + 2 * offset),
|
||||||
'rx' : str(self.options.corner_radius)
|
'ry' : str(self.options.corner_radius),
|
||||||
}
|
'rx' : str(self.options.corner_radius)
|
||||||
etree.SubElement(self.svg.get_current_layer(), inkex.addNS('rect','svg'), attribs)
|
}
|
||||||
|
etree.SubElement(self.svg.get_current_layer(), inkex.addNS('rect','svg'), attribs)
|
||||||
|
|
||||||
if self.options.circle:
|
if self.options.circle:
|
||||||
attribs = {
|
attribs = {
|
||||||
'style': str(inkex.Style({'stroke':'#ff0000','stroke-width':str(self.svg.unittouu("1px")),'fill':'none'})),
|
'style': str(inkex.Style({'stroke':'#ff0000','stroke-width':str(self.svg.unittouu("1px")),'fill':'none'})),
|
||||||
'cx' : str(bbox.center_x),
|
'cx' : str(bbox.center_x),
|
||||||
'cy' : str(bbox.center_y),
|
'cy' : str(bbox.center_y),
|
||||||
#'r' : str(bbox.width / 2 + offset),
|
#'r' : str(bbox.width / 2 + offset),
|
||||||
'r' : str(math.sqrt((bbox.width + 2 * offset)* (bbox.width + 2 * offset) + (bbox.height + 2 * self.options.offset) * (bbox.height + 2 * self.options.offset)) / 2),
|
'r' : str(math.sqrt((bbox.width + 2 * offset)* (bbox.width + 2 * offset) + (bbox.height + 2 * self.options.offset) * (bbox.height + 2 * self.options.offset)) / 2),
|
||||||
}
|
}
|
||||||
etree.SubElement(self.svg.get_current_layer(), inkex.addNS('circle','svg'), attribs)
|
etree.SubElement(self.svg.get_current_layer(), inkex.addNS('circle','svg'), attribs)
|
||||||
|
|
||||||
|
|
||||||
def effect(self):
|
def effect(self):
|
||||||
|
197
extensions/fablabchemnitz/dxf_dwg_importer/dxf_dwg_importer.inx
Normal file
197
extensions/fablabchemnitz/dxf_dwg_importer/dxf_dwg_importer.inx
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||||
|
<name>DXF/DWG Importer</name>
|
||||||
|
<id>fablabchemnitz.de.dxf_dwg_importer</id>
|
||||||
|
<param name="tab" type="notebook">
|
||||||
|
<page name="tab_general" gui-text="Input / General">
|
||||||
|
<label>The parser is the heart of your input-output chain because depending on the selection your result will greatly vary. You might receive no or bad results (e.g. wrong scalings, aborted imports, missing lines, duplicated lines, wrong rotations and other issues. Serious tip: ask the person who gave the input file to you about some measurement which you can compare with the processed file to ensure correct sizes)</label>
|
||||||
|
<param name="dxf_to_svg_parser" gui-text="DXF to SVG parser" type="optiongroup" appearance="combo">
|
||||||
|
<option value="bjnortier">bjnortier DXF (good quality, some polygon artifacts)</option>
|
||||||
|
<option value="sk1">sk1 UniConverter (best output, but fails for all unknown/unfiltered entities)</option>
|
||||||
|
<option value="ezdxf">ezdxf (higher quality, many single nodes)</option>
|
||||||
|
<option value="kabeja">kabeja (Java library)</option>
|
||||||
|
<option value="vpype_dxf">vpype-dxf (Note: DXF to SVG 'Filter entities with ezdxf' disabled)</option>
|
||||||
|
<option value="legacy">legacy InkScape importer</option>
|
||||||
|
</param>
|
||||||
|
<param name="resizetoimport" type="bool" gui-text="Resize the canvas to the imported drawing's bounding box">true</param>
|
||||||
|
<param name="extraborder" type="float" precision="3" gui-text="Add extra border around fitted canvas">0.0</param>
|
||||||
|
<param name="extraborder_units" type="optiongroup" appearance="combo" gui-text="Border offset units">
|
||||||
|
<option value="mm">mm</option>
|
||||||
|
<option value="cm">cm</option>
|
||||||
|
<option value="in">in</option>
|
||||||
|
<option value="pt">pt</option>
|
||||||
|
<option value="px">px</option>
|
||||||
|
</param>
|
||||||
|
<param name="inputfile" type="path" gui-text="Import File (*.dxf, .dwg)" gui-description="Full path to your file, e.g. 'C:\Users\Username\Documents\myimage.jpg'" filetypes="dxf,dwg" mode="file">C:\Users\</param>
|
||||||
|
<param name="opendironerror" type="bool" gui-text="Open containing output directory on conversion errors">true</param>
|
||||||
|
</page>
|
||||||
|
<page name="tab_dwg_dxf" gui-text="DWG to DXF / DXF to DXF">
|
||||||
|
<label appearance="header">Open Design Alliance (ODA) File Converter</label>
|
||||||
|
<param name="oda_skip_dxf_to_dxf" type="bool" gui-text="Skip ODA conversion from DXF to DXF (keep input as is)" gui-description="This will skip ODA File Converter execution if input is already DXF file. If your input is DWG this option will not apply. Might save some seconds of time and maybe prevents errors.">false</param>
|
||||||
|
<param name="oda_fileconverter" type="path" gui-text="ODAFileConverter executable" gui-description="Full path to 'ODAFileConverter' executable. On Linux this usually should be '/usr/bin/ODAFileConverter' and on Windows it's 'C:\Program Files\ODA\OdaFileConverter_title XX.Y.Z\ODAFileConverter.exe'" filetypes="" mode="file">C:\Program Files\ODA\ODAFileConverter_title 21.6.0\ODAFileConverter.exe</param>
|
||||||
|
<param name="oda_keepconverted_dxf" type="bool" gui-text="Keep ODA converted DXF file" gui-description="Will put a copy of the converted DXF into the directory where your input file is located.">true</param>
|
||||||
|
<param name="oda_outputformat" gui-text="AutoCAD output version" type="optiongroup" appearance="combo">
|
||||||
|
<option value="ACAD2018_DXF">2018 ASCII DXF</option>
|
||||||
|
<option value="ACAD2013_DXF">2013 ASCII DXF</option>
|
||||||
|
<option value="ACAD2010_DXF">2010 ASCII DXF</option>
|
||||||
|
<option value="ACAD2007_DXF">2007 ASCII DXF</option>
|
||||||
|
<option value="ACAD2004_DXF">2004 ASCII DXF</option>
|
||||||
|
<option value="ACAD2000_DXF">2000 ASCII DXF</option>
|
||||||
|
<option value="ACAD14_DXF" >R14 ASCII DXF</option>
|
||||||
|
<option value="ACAD13_DXF" >R13 ASCII DXF</option>
|
||||||
|
<option value="ACAD12_DXF" >R12 ASCII DXF</option>
|
||||||
|
<option value="ACAD10_DXF" >R10 ASCII DXF</option>
|
||||||
|
<option value="ACAD9_DXF" >R9 ASCII DXF</option>
|
||||||
|
<!-- Unsupported stuff:
|
||||||
|
<option value="ACAD2018_DWG">2018 DWG</option>
|
||||||
|
<option value="ACAD2013_DWG">2013 DWG</option>
|
||||||
|
<option value="ACAD2010_DWG">2010 DWG</option>
|
||||||
|
<option value="ACAD2007_DWG">2007 DWG</option>
|
||||||
|
<option value="ACAD2004_DWG">2004 DWF</option>
|
||||||
|
<option value="ACAD2000_DWG">2000 DWG</option>
|
||||||
|
<option value="ACAD14_DWG" >R14 DWG</option>
|
||||||
|
<option value="ACAD13_DWG" >R13 DWG</option>
|
||||||
|
<option value="ACAD12_DWG" >R12 DWG</option>
|
||||||
|
<option value="ACAD2018_DXB">2018 Binary DXF</option>
|
||||||
|
<option value="ACAD2013_DXB">2013 Binary DXF</option>
|
||||||
|
<option value="ACAD2010_DXB">2010 Binary DXF</option>
|
||||||
|
<option value="ACAD2007_DXB">2007 Binary DXF</option>
|
||||||
|
<option value="ACAD2004_DXB">2004 Binary DXF</option>
|
||||||
|
<option value="ACAD2000_DXB">2000 Binary DXF</option>
|
||||||
|
<option value="ACAD14_DXB" >R14 Binary DXF</option>
|
||||||
|
<option value="ACAD13_DXB" >R13 Binary DXF</option>
|
||||||
|
<option value="ACAD12_DXB" >R12 Binary DXF</option>
|
||||||
|
<option value="ACAD10_DXB" >R10 Binary DXF</option>
|
||||||
|
-->
|
||||||
|
</param>
|
||||||
|
<param name="oda_hidewindow" type="bool" gui-text="Hide ODA GUI window (Windows OS only)" gui-description="Hide ODA GUI window. This does not work for Linux OS.">true</param>
|
||||||
|
<param name="oda_audit_repair" type="bool" gui-text="Perform audit (auto-repair)">true</param>
|
||||||
|
</page>
|
||||||
|
<page name="tab_dxf_svg" gui-text="DXF to SVG">
|
||||||
|
<label appearance="header">ezdxf DXF to DXF Pre-Processing (Filter)</label>
|
||||||
|
<separator/>
|
||||||
|
<param name="ezdxf_preprocessing" type="bool" gui-text="Filter entities with ezdxf (recommended if you use sk1 UniConverter)">true</param>
|
||||||
|
<label>Note: This will apply regardless of the choice of the DXF to SVG converter. It will also preprocess if you select ezdxf as tool for DXF to SVG (means you run ezdxf twice. Once for entity filtering, once for conversion).</label>
|
||||||
|
<param name="ezdfx_keep_preprocessed" type="bool" gui-text="Keep ezdxf preprocessed DXF file" gui-description="Will put a copy of the converted DXF into the directory where your input file is located.">true</param>
|
||||||
|
<param name="ezdxf_output_version" type="optiongroup" appearance="combo" gui-text="ezdxf output version">
|
||||||
|
<option value="SAME">Same as AutoCAD output version</option>
|
||||||
|
<option value="R2018">2018 ASCII DXF</option>
|
||||||
|
<option value="R2013">2013 ASCII DXF</option>
|
||||||
|
<option value="R2010">2010 ASCII DXF</option>
|
||||||
|
<option value="R2007">2007 ASCII DXF</option>
|
||||||
|
<option value="R2004">2004 ASCII DXF</option>
|
||||||
|
<option value="R2000">2000 ASCII DXF</option>
|
||||||
|
</param>
|
||||||
|
<label appearance="header">ezdxf Entity Filter</label>
|
||||||
|
<label>What entity types do you want to filter? Only the listed one's are possible at the moment.</label>
|
||||||
|
<param name="allentities" type="bool" gui-text="Keep all listed entity types (override filter selection)">false</param>
|
||||||
|
<label>Or select the entity types you want to keep. Checked items will not be dropped while processing.</label>
|
||||||
|
<hbox>
|
||||||
|
<hbox>
|
||||||
|
<label appearance="header">sk1 Supported</label>
|
||||||
|
<separator/>
|
||||||
|
<vbox>
|
||||||
|
<param type="bool" gui-text="3DFACE" name="THREE_DFACE">true</param>
|
||||||
|
<param type="bool" gui-text="ARC" name="ARC">true</param>
|
||||||
|
<param type="bool" gui-text="BLOCK" name="BLOCK">true</param>
|
||||||
|
<param type="bool" gui-text="CIRCLE" name="CIRCLE">true</param>
|
||||||
|
<param type="bool" gui-text="ELLIPSE" name="ELLIPSE">true</param>
|
||||||
|
<param type="bool" gui-text="LINE" name="LINE">true</param>
|
||||||
|
<param type="bool" gui-text="LWPOLYLINE" name="LWPOLYLINE">true</param>
|
||||||
|
<param type="bool" gui-text="POINT" name="POINT">true</param>
|
||||||
|
</vbox>
|
||||||
|
<separator/>
|
||||||
|
<vbox>
|
||||||
|
<param type="bool" gui-text="POLYLINE" name="POLYLINE">true</param>
|
||||||
|
<param type="bool" gui-text="POP_TRAFO" name="POP_TRAFO">true</param>
|
||||||
|
<param type="bool" gui-text="SEQEND" name="SEQEND">true</param>
|
||||||
|
<param type="bool" gui-text="SOLID" name="SOLID">true</param>
|
||||||
|
<param type="bool" gui-text="SPLINE" name="SPLINE">true</param>
|
||||||
|
<param type="bool" gui-text="TABLE" name="TABLE">true</param>
|
||||||
|
<param type="bool" gui-text="VERTEX" name="VERTEX">true</param>
|
||||||
|
<param type="bool" gui-text="VIEWPORT" name="VIEWPORT">true</param>
|
||||||
|
</vbox>
|
||||||
|
</hbox>
|
||||||
|
<hbox>
|
||||||
|
<label appearance="header">Other Entities</label>
|
||||||
|
<separator/>
|
||||||
|
<vbox>
|
||||||
|
<param type="bool" gui-text="3DSOLID" name="THREE_DSOLID">true</param>
|
||||||
|
<param type="bool" gui-text="ATTRIB" name="ATTRIB">true</param>
|
||||||
|
<param type="bool" gui-text="BODY" name="BODY">true</param>
|
||||||
|
<param type="bool" gui-text="ARC_DIMENSION" name="ARC_DIMENSION">true</param>
|
||||||
|
<param type="bool" gui-text="HATCH" name="HATCH">true</param>
|
||||||
|
<param type="bool" gui-text="IMAGE" name="IMAGE">true</param>
|
||||||
|
<param type="bool" gui-text="INSERT" name="INSERT">true</param>
|
||||||
|
<param type="bool" gui-text="MESH" name="MESH">true</param>
|
||||||
|
</vbox>
|
||||||
|
<separator/>
|
||||||
|
<vbox>
|
||||||
|
<param type="bool" gui-text="MTEXT" name="MTEXT">true</param>
|
||||||
|
<param type="bool" gui-text="RAY" name="RAY">true</param>
|
||||||
|
<param type="bool" gui-text="REGION" name="REGION">true</param>
|
||||||
|
<param type="bool" gui-text="SHAPE" name="SHAPE">true</param>
|
||||||
|
<param type="bool" gui-text="SURFACE" name="SURFACE">true</param>
|
||||||
|
<param type="bool" gui-text="TRACE" name="TRACE">true</param>
|
||||||
|
<param type="bool" gui-text="UNDERLAY" name="UNDERLAY">true</param>
|
||||||
|
<param type="bool" gui-text="XLINE" name="XLINE">true</param>
|
||||||
|
</vbox>
|
||||||
|
</hbox>
|
||||||
|
</hbox>
|
||||||
|
<spacer/>
|
||||||
|
<label appearance="header">sk1 UniConvertor 1.1.X</label>
|
||||||
|
<separator/>
|
||||||
|
<param name="sk1_uniconverter" type="path" gui-text="uniconvertor executable" gui-description="Full path to 'uniconvertor' executable" filetypes="cmd" mode="file">C:\Program Files (x86)\sK1 Project\UniConvertor-1.1.6\uniconvertor.cmd</param>
|
||||||
|
<label appearance="header">vpype-dxf</label>
|
||||||
|
<separator/>
|
||||||
|
<param name="vpype_quantization" type="float" min="0.001" max="99999.000" precision="3" gui-text="Quantization" gui-description="Maximum length of segments approximating curved elements (default 0.1mm)">0.100</param>
|
||||||
|
<param name="vpype_simplify" type="bool" gui-text="Simplify curved elements" gui-description="Apply simplification algorithm to curved elements">false</param>
|
||||||
|
<param name="vpype_parallel" type="bool" gui-text="Multiprocessing curve conversion" gui-description="Enable multiprocessing for curve conversion.">false</param>
|
||||||
|
</page>
|
||||||
|
<page name="tab_about" gui-text="About">
|
||||||
|
<label appearance="header">DXF/DWG Importer</label>
|
||||||
|
<label>A strange looking ODA File Converter/sk1 UniConverter/ezdxf tool chain. But it works! The most versatile tool to import much hated AutoCAD data for InkScape yet.</label>
|
||||||
|
<label>2020 - 2022 / written by Mario Voigt (Stadtfabrikanten e.V. / FabLab Chemnitz)</label>
|
||||||
|
<spacer/>
|
||||||
|
<label appearance="header">Online Documentation</label>
|
||||||
|
<label appearance="url">https://y.stadtfabrikanten.org/dxfdwgimporter</label>
|
||||||
|
<spacer/>
|
||||||
|
<label appearance="header">Contributing</label>
|
||||||
|
<label appearance="url">https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.X</label>
|
||||||
|
<label appearance="url">mailto:mario.voigt@stadtfabrikanten.org</label>
|
||||||
|
<spacer/>
|
||||||
|
<label appearance="header">Third Party Modules</label>
|
||||||
|
<label appearance="url">https://github.com/mozman/ezdxf</label>
|
||||||
|
<label appearance="url">http://kabeja.sourceforge.net</label>
|
||||||
|
<label appearance="url">https://github.com/bjnortier/dxf</label>
|
||||||
|
<label appearance="url">https://github.com/sk1project/uniconvertor</label>
|
||||||
|
<label appearance="url">https://github.com/abey79/vpype</label>
|
||||||
|
<label appearance="url">https://github.com/tatarize/vpype-dxf</label>
|
||||||
|
<spacer/>
|
||||||
|
<label appearance="header">MightyScape Extension Collection</label>
|
||||||
|
<label>This piece of software is part of the MightyScape for Inkscape Extension Collection and is licensed under GNU GPL v3</label>
|
||||||
|
<label appearance="url">https://y.stadtfabrikanten.org/mightyscape-overview</label>
|
||||||
|
</page>
|
||||||
|
<page name="tab_donate" gui-text="Donate">
|
||||||
|
<label appearance="header">Coffee + Pizza</label>
|
||||||
|
<label>We are the Stadtfabrikanten, running the FabLab Chemnitz since 2016. A FabLab is an open workshop that gives people access to machines and digital tools like 3D printers, laser cutters and CNC milling machines.</label>
|
||||||
|
<spacer/>
|
||||||
|
<label>You like our work and want to support us? You can donate to our non-profit organization by different ways:</label>
|
||||||
|
<label appearance="url">https://y.stadtfabrikanten.org/donate</label>
|
||||||
|
<spacer/>
|
||||||
|
<label>Thanks for using our extension and helping us!</label>
|
||||||
|
<image>../000_about_fablabchemnitz.svg</image>
|
||||||
|
</page>
|
||||||
|
</param>
|
||||||
|
<effect needs-live-preview="true">
|
||||||
|
<object-type>all</object-type>
|
||||||
|
<effects-menu>
|
||||||
|
<submenu name="FabLab Chemnitz">
|
||||||
|
<submenu name="Import/Export/Transfer"/>
|
||||||
|
</submenu>
|
||||||
|
</effects-menu>
|
||||||
|
</effect>
|
||||||
|
<script>
|
||||||
|
<command location="inx" interpreter="python">dxf_dwg_importer.py</command>
|
||||||
|
</script>
|
||||||
|
</inkscape-extension>
|
458
extensions/fablabchemnitz/dxf_dwg_importer/dxf_dwg_importer.py
Normal file
458
extensions/fablabchemnitz/dxf_dwg_importer/dxf_dwg_importer.py
Normal file
@ -0,0 +1,458 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
"""
|
||||||
|
Extension for InkScape 1.0
|
||||||
|
|
||||||
|
Import any DWG or DXF file using ODA File Converter, sk1 UniConvertor, ezdxf and more tools.
|
||||||
|
|
||||||
|
Author: Mario Voigt / FabLab Chemnitz
|
||||||
|
Mail: mario.voigt@stadtfabrikanten.org
|
||||||
|
Date: 23.08.2020
|
||||||
|
Last patch: 04.04.2021
|
||||||
|
License: GNU GPL v3
|
||||||
|
|
||||||
|
Module licenses
|
||||||
|
- ezdxf (https://github.com/mozman/ezdxf) - MIT License
|
||||||
|
- node.js (https://raw.githubusercontent.com/nodejs/node/master/LICENSE) - MIT License
|
||||||
|
- https://github.com/bjnortier/dxf - MIT License
|
||||||
|
- ODA File Converter - not bundled (due to restrictions by vendor)
|
||||||
|
- sk1 UniConvertor (https://github.com/sk1project/uniconvertor) - AGPL v3.0 - not bundled
|
||||||
|
- kabeja (http://kabeja.sourceforge.net/) - Apache v2
|
||||||
|
- vpype (https://github.com/abey79/vpype) - MIT License
|
||||||
|
- vpype-dxf (https://github.com/tatarize/vpype-dxf) - MIT License
|
||||||
|
|
||||||
|
ToDos:
|
||||||
|
- change copy commands to movefile commands (put into temp. sub directories where the input file is located). We need to copy files in this script because ODA File Converter will process whole dirs instead of single files only.DXF files can be really large, which slows the process)
|
||||||
|
- vpype will crash because inkscape(ObjectToPath) fails -> lines have missing style attribute?
|
||||||
|
"""
|
||||||
|
|
||||||
|
import inkex
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import subprocess
|
||||||
|
import tempfile
|
||||||
|
from lxml import etree
|
||||||
|
from subprocess import Popen, PIPE
|
||||||
|
import shutil
|
||||||
|
from shutil import which
|
||||||
|
from pathlib import Path
|
||||||
|
from mimetypes import MimeTypes
|
||||||
|
import urllib.request as urllib
|
||||||
|
|
||||||
|
#ezdxf related imports
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import ezdxf
|
||||||
|
from ezdxf.addons.drawing import RenderContext, Frontend
|
||||||
|
#from ezdxf.addons.drawing.matplotlib_backend import MatplotlibBackend for older ezdxf library 0.14.1
|
||||||
|
from ezdxf.addons.drawing.matplotlib import MatplotlibBackend #for recent ezdxf library 0.15.2
|
||||||
|
from ezdxf.addons import Importer
|
||||||
|
|
||||||
|
class DXFDWGImport(inkex.EffectExtension):
|
||||||
|
|
||||||
|
def add_arguments(self, pars):
|
||||||
|
#blank tabs
|
||||||
|
pars.add_argument("--tab")
|
||||||
|
|
||||||
|
#general
|
||||||
|
pars.add_argument("--inputfile")
|
||||||
|
pars.add_argument("--dxf_to_svg_parser", default="bjnortier", help="Choose a DXF to SVG parser")
|
||||||
|
pars.add_argument("--resizetoimport", type=inkex.Boolean, default=True, help="Resize the canvas to the imported drawing's bounding box")
|
||||||
|
pars.add_argument("--extraborder", type=float, default=0.0)
|
||||||
|
pars.add_argument("--extraborder_units")
|
||||||
|
|
||||||
|
#ODA File Converter
|
||||||
|
pars.add_argument("--oda_fileconverter", default=r"C:\Program Files\ODA\oda_fileconverter_title 21.6.0\oda_fileconverter.exe", help="Full path to 'oda_fileconverter.exe'")
|
||||||
|
pars.add_argument("--oda_hidewindow", type=inkex.Boolean, default=True, help="Hide ODA GUI window")
|
||||||
|
pars.add_argument("--oda_outputformat", default="ACAD2018_DXF", help="ODA AutoCAD Output version")
|
||||||
|
pars.add_argument("--oda_keepconverted_dxf", type=inkex.Boolean, default=True, help="Keep ODA converted DXF file")
|
||||||
|
pars.add_argument("--oda_skip_dxf_to_dxf", type=inkex.Boolean, default=False, help="Skip conversion from DXF to DXF")
|
||||||
|
pars.add_argument("--oda_audit_repair", type=inkex.Boolean, default=True, help="Perform audit / autorepair")
|
||||||
|
|
||||||
|
#sk1 UniConvertor
|
||||||
|
pars.add_argument("--sk1_uniconverter", default=r"C:\Program Files (x86)\sK1 Project\UniConvertor-1.1.6\uniconvertor.cmd", help="Full path to 'uniconvertor.cmd'")
|
||||||
|
pars.add_argument("--opendironerror", type=inkex.Boolean, default=True, help="Open containing output directory on conversion errors")
|
||||||
|
|
||||||
|
#ezdxf preprocessing
|
||||||
|
pars.add_argument("--ezdxf_preprocessing", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--ezdxf_output_version", default="SAME", help="ezdxf output version")
|
||||||
|
pars.add_argument("--ezdfx_keep_preprocessed", type=inkex.Boolean, default=True, help="Keep ezdxf preprocessed DXF file")
|
||||||
|
pars.add_argument("--allentities", type=inkex.Boolean, default=True)
|
||||||
|
|
||||||
|
#vpype-dxf (dread)
|
||||||
|
pars.add_argument("--vpype_quantization", type=float, default=0.1, help="Maximum length of segments approximating curved elements (default 0.1mm)")
|
||||||
|
pars.add_argument("--vpype_simplify", type=inkex.Boolean, default=False, help="Simplify curved elements")
|
||||||
|
pars.add_argument("--vpype_parallel", type=inkex.Boolean, default=False, help="Multiprocessing curve conversion")
|
||||||
|
|
||||||
|
#sk1 compatible entities
|
||||||
|
pars.add_argument("--THREE_DFACE", type=inkex.Boolean, default=True) #3DFACE
|
||||||
|
pars.add_argument("--ARC", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--BLOCK", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--CIRCLE", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--ELLIPSE", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--LINE", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--LWPOLYLINE", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--POINT", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--POLYLINE", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--POP_TRAFO", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--SEQEND", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--SOLID", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--SPLINE", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--TABLE", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--VERTEX", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--VIEWPORT", type=inkex.Boolean, default=True)
|
||||||
|
|
||||||
|
#other entities
|
||||||
|
pars.add_argument("--THREE_DSOLID", type=inkex.Boolean, default=True) #3DSOLID
|
||||||
|
pars.add_argument("--ATTRIB", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--BODY", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--ARC_DIMENSION", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--HATCH", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--IMAGE", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--INSERT", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--MESH", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--MTEXT", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--RAY", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--REGION", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--SHAPE", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--SURFACE", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--TRACE", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--UNDERLAY", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--XLINE", type=inkex.Boolean, default=True)
|
||||||
|
|
||||||
|
def openExplorer(self, temp_output_dir):
|
||||||
|
DETACHED_PROCESS = 0x00000008
|
||||||
|
if os.name == 'nt':
|
||||||
|
subprocess.Popen(["explorer", temp_output_dir], close_fds=True, creationflags=DETACHED_PROCESS).wait()
|
||||||
|
else:
|
||||||
|
subprocess.Popen(["xdg-open", temp_output_dir], close_fds=True, start_new_session=True).wait()
|
||||||
|
|
||||||
|
def effect(self):
|
||||||
|
#get input file and copy it to some new temporary directory
|
||||||
|
inputfile = self.options.inputfile
|
||||||
|
if not os.path.exists(inputfile):
|
||||||
|
self.msg("The input file does not exist. Please select a *.dxf or *.dwg file and try again.")
|
||||||
|
exit(1)
|
||||||
|
temp_input_dir = os.path.join(tempfile.gettempdir(),"dxfdwg_input")
|
||||||
|
shutil.rmtree(temp_input_dir, ignore_errors=True) #remove the input directory before doing new job
|
||||||
|
if not os.path.exists(temp_input_dir):
|
||||||
|
os.mkdir(temp_input_dir) #recreate blank dir
|
||||||
|
shutil.copy2(inputfile, os.path.join(temp_input_dir, Path(inputfile).name)) # complete target filename given
|
||||||
|
|
||||||
|
#Prepapre output conversion
|
||||||
|
outputfilebase = os.path.splitext(os.path.basename(inputfile))[0]
|
||||||
|
inputfile_ending = os.path.splitext(os.path.basename(inputfile))[1]
|
||||||
|
temp_output_dir = os.path.join(tempfile.gettempdir(),"dxfdwg_output")
|
||||||
|
shutil.rmtree(temp_output_dir, ignore_errors=True) #remove the output directory before doing new job
|
||||||
|
if not os.path.exists(temp_output_dir):
|
||||||
|
os.mkdir(temp_output_dir)
|
||||||
|
|
||||||
|
#Prepare some more options for proceeding
|
||||||
|
autocad_version = self.options.oda_outputformat.split("_")[0]
|
||||||
|
autocad_format = self.options.oda_outputformat.split("_")[1]
|
||||||
|
self.options.oda_audit_repair = "1" if self.options.oda_audit_repair else "0" #overwrite string bool with int value
|
||||||
|
entityspace = []
|
||||||
|
if self.options.allentities or self.options.THREE_DFACE: entityspace.append("3DFACE")
|
||||||
|
if self.options.allentities or self.options.ARC: entityspace.append("ARC")
|
||||||
|
if self.options.allentities or self.options.BLOCK: entityspace.append("BLOCK")
|
||||||
|
if self.options.allentities or self.options.CIRCLE: entityspace.append("CIRCLE")
|
||||||
|
if self.options.allentities or self.options.ELLIPSE: entityspace.append("ELLIPSE")
|
||||||
|
if self.options.allentities or self.options.LINE: entityspace.append("LINE")
|
||||||
|
if self.options.allentities or self.options.LWPOLYLINE: entityspace.append("LWPOLYLINE")
|
||||||
|
if self.options.allentities or self.options.POINT: entityspace.append("POINT")
|
||||||
|
if self.options.allentities or self.options.POLYLINE: entityspace.append("POLYLINE")
|
||||||
|
if self.options.allentities or self.options.POP_TRAFO: entityspace.append("POP_TRAFO")
|
||||||
|
if self.options.allentities or self.options.SEQEND: entityspace.append("SEQEND")
|
||||||
|
if self.options.allentities or self.options.SOLID: entityspace.append("SOLID")
|
||||||
|
if self.options.allentities or self.options.SPLINE: entityspace.append("SPLINE")
|
||||||
|
if self.options.allentities or self.options.TABLE: entityspace.append("TABLE")
|
||||||
|
if self.options.allentities or self.options.VERTEX: entityspace.append("VERTEX")
|
||||||
|
if self.options.allentities or self.options.VIEWPORT: entityspace.append("VIEWPORT")
|
||||||
|
|
||||||
|
if self.options.allentities or self.options.THREE_DSOLID: entityspace.append("3DSOLID")
|
||||||
|
if self.options.allentities or self.options.ATTRIB: entityspace.append("ATTRIB")
|
||||||
|
if self.options.allentities or self.options.BODY: entityspace.append("BODY")
|
||||||
|
if self.options.allentities or self.options.ARC_DIMENSION: entityspace.append("ARC_DIMENSION")
|
||||||
|
if self.options.allentities or self.options.HATCH: entityspace.append("HATCH")
|
||||||
|
if self.options.allentities or self.options.IMAGE: entityspace.append("IMAGE")
|
||||||
|
if self.options.allentities or self.options.INSERT: entityspace.append("INSERT")
|
||||||
|
if self.options.allentities or self.options.MESH: entityspace.append("MESH")
|
||||||
|
if self.options.allentities or self.options.MTEXT: entityspace.append("MTEXT")
|
||||||
|
if self.options.allentities or self.options.RAY: entityspace.append("RAY")
|
||||||
|
if self.options.allentities or self.options.REGION: entityspace.append("REGION")
|
||||||
|
if self.options.allentities or self.options.SHAPE: entityspace.append("SHAPE")
|
||||||
|
if self.options.allentities or self.options.SURFACE: entityspace.append("SURFACE")
|
||||||
|
if self.options.allentities or self.options.TRACE: entityspace.append("TRACE")
|
||||||
|
if self.options.allentities or self.options.UNDERLAY: entityspace.append("UNDERLAY")
|
||||||
|
if self.options.allentities or self.options.XLINE: entityspace.append("XLINE")
|
||||||
|
|
||||||
|
#ODA to ezdxf mapping
|
||||||
|
oda_ezdxf_mapping = []
|
||||||
|
oda_ezdxf_mapping.append(["ACAD9", "R12", "AC1004"]) #this mapping is not supported directly. so we use the lowest possible which is R12
|
||||||
|
oda_ezdxf_mapping.append(["ACAD10", "R12", "AC1006"]) #this mapping is not supported directly. so we use the lowest possible which is R12
|
||||||
|
oda_ezdxf_mapping.append(["ACAD12", "R12", "AC1009"])
|
||||||
|
oda_ezdxf_mapping.append(["ACAD13", "R2000","AC1012"]) #R13 was overwritten by R2000 which points to AC1015 instead of AC1014 (see documentation)
|
||||||
|
oda_ezdxf_mapping.append(["ACAD14", "R2000","AC1014"]) #R14 was overwritten by R2000 which points to AC1015 instead of AC1014 (see documentation)
|
||||||
|
oda_ezdxf_mapping.append(["ACAD2000","R2000","AC1015"])
|
||||||
|
oda_ezdxf_mapping.append(["ACAD2004","R2004","AC1018"])
|
||||||
|
oda_ezdxf_mapping.append(["ACAD2007","R2007","AC1021"])
|
||||||
|
oda_ezdxf_mapping.append(["ACAD2010","R2010","AC1024"])
|
||||||
|
oda_ezdxf_mapping.append(["ACAD2013","R2013","AC1027"])
|
||||||
|
oda_ezdxf_mapping.append(["ACAD2018","R2018","AC1032"])
|
||||||
|
|
||||||
|
ezdxf_autocad_format = None
|
||||||
|
for oe in oda_ezdxf_mapping:
|
||||||
|
if oe[0] == autocad_version:
|
||||||
|
ezdxf_autocad_format = oe[1]
|
||||||
|
break
|
||||||
|
if ezdxf_autocad_format is None:
|
||||||
|
self.msg("ezdxf conversion format version unknown")
|
||||||
|
|
||||||
|
#Prepare DXF and SVG paths
|
||||||
|
dxf_file = os.path.join(temp_output_dir, outputfilebase + ".dxf")
|
||||||
|
svg_file = os.path.join(temp_output_dir, outputfilebase + ".svg")
|
||||||
|
|
||||||
|
# Run ODA File Converter
|
||||||
|
if self.options.oda_skip_dxf_to_dxf == False or inputfile_ending == ".dwg":
|
||||||
|
# Executable test (check for proper configuration by checking mime type. Should return octet stream for a binary executable)
|
||||||
|
if os.name == "nt" and "application/octet-stream" not in str(MimeTypes().guess_type(urllib.pathname2url(self.options.oda_fileconverter))):
|
||||||
|
self.msg("You selected to use ODA File Converter but it is not configured properly. Check for installation and path location or select 'Skip conversion from DXF to DXF'. You can download ODA Converter from 'https://www.opendesign.com/guestfiles/oda_file_converter'. You need to install it in order to use it.")
|
||||||
|
exit(1)
|
||||||
|
elif os.path.isfile(self.options.oda_fileconverter) == False:
|
||||||
|
self.msg("You selected to use ODA File Converter but it is not configured properly. Check for installation and path location or select 'Skip conversion from DXF to DXF'. You can download ODA Converter from 'https://www.opendesign.com/guestfiles/oda_file_converter'. You need to install it in order to use it.")
|
||||||
|
exit(1)
|
||||||
|
else:
|
||||||
|
# Build and run ODA File Converter command
|
||||||
|
oda_cmd = [self.options.oda_fileconverter, temp_input_dir, temp_output_dir, autocad_version, autocad_format, "0", self.options.oda_audit_repair]
|
||||||
|
if os.name == 'nt' and self.options.oda_hidewindow:
|
||||||
|
info = subprocess.STARTUPINFO() #hide the ODA File Converter window because it is annoying (does not work for Linux :-()
|
||||||
|
info.dwFlags = 1
|
||||||
|
info.wShowWindow = 0
|
||||||
|
proc = subprocess.Popen(oda_cmd, startupinfo=info, shell=False, stdout=PIPE, stderr=PIPE)
|
||||||
|
else:
|
||||||
|
proc = subprocess.Popen(oda_cmd, shell=False, stdout=PIPE, stderr=PIPE)
|
||||||
|
stdout, stderr = proc.communicate()
|
||||||
|
if proc.returncode != 0: #in this case we exit
|
||||||
|
self.msg("ODAFileConverter failed: %d %s %s" % (proc.returncode, stdout, stderr))
|
||||||
|
if os.name != 'nt':
|
||||||
|
self.msg("If the error message above contains a warning about wrong/missing Qt version please install the required version. You can get the installer from 'https://download.qt.io/archive/qt/'. Sadly you will need to create a free account to install. After installation please configure the shell script '/usr/bin/ODAFileConverter' to add a preceding line with content similar to 'LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/Qt5.14.2/5.14.2/gcc_64/lib/'.")
|
||||||
|
exit(1)
|
||||||
|
if len(stderr) > 0 and stderr != b"Quit (core dumped)\n": #in this case we only warn about
|
||||||
|
self.msg("ODAFileConverter returned some error output (which might be ignored): %d %s %s" % (proc.returncode, stdout, stderr))
|
||||||
|
|
||||||
|
# check if ODA converted successfully. This is the case if no error file was created
|
||||||
|
oda_errorfile = os.path.join(temp_output_dir, Path(inputfile).name + ".err")
|
||||||
|
if os.path.exists(oda_errorfile):
|
||||||
|
self.msg("ODA File Converter failed to process the file. Cannot continue DXF/DWG import. The error message is:")
|
||||||
|
errormessage = open(oda_errorfile, 'r')
|
||||||
|
errorlines = errormessage.readlines()
|
||||||
|
for errorline in errorlines:
|
||||||
|
self.msg(errorline.strip())
|
||||||
|
errormessage.close()
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
# Do some movings/copies of skipped or processed DXF
|
||||||
|
if self.options.oda_skip_dxf_to_dxf: #if true we need to move the file to simulate "processed"
|
||||||
|
shutil.move(os.path.join(temp_input_dir, Path(inputfile).name), os.path.join(temp_output_dir, Path(inputfile).name))
|
||||||
|
|
||||||
|
if self.options.oda_keepconverted_dxf:
|
||||||
|
shutil.copy2(dxf_file, os.path.join(os.path.dirname(inputfile), outputfilebase + "_oda.dxf")) # complete target filename given
|
||||||
|
|
||||||
|
# Preprocessing DXF to DXF (entity filter) by using ezdxf the first time
|
||||||
|
if self.options.dxf_to_svg_parser == "vpype_dxf":
|
||||||
|
self.options.ezdxf_preprocessing = False #prevent to run infinitely without any error
|
||||||
|
if self.options.ezdxf_preprocessing:
|
||||||
|
# uniconverter does not handle all entities. we parse the file to exlude stuff which lets uniconverter fail
|
||||||
|
dxf = ezdxf.readfile(dxf_file)
|
||||||
|
modelspace = dxf.modelspace()
|
||||||
|
allowed_entities = []
|
||||||
|
# supported entities by UniConverter- impossible: MTEXT TEXT INSERT and a lot of others
|
||||||
|
query_string = str(entityspace)[1:-1].replace("'","").replace(",","")
|
||||||
|
if query_string != "":
|
||||||
|
for e in modelspace.query(query_string):
|
||||||
|
allowed_entities.append(e)
|
||||||
|
#self.msg(ezdxf_autocad_format)
|
||||||
|
#self.msg(self.options.ezdxf_output_version)
|
||||||
|
if self.options.ezdxf_output_version == "SAME":
|
||||||
|
doc = ezdxf.new(ezdxf_autocad_format)
|
||||||
|
else:
|
||||||
|
doc = ezdxf.new(self.options.ezdxf_output_version) #use the string values from inx file. Required to match the values from ezdxf library. See Python reference
|
||||||
|
msp = doc.modelspace()
|
||||||
|
for e in allowed_entities:
|
||||||
|
msp.add_foreign_entity(e)
|
||||||
|
doc.saveas(dxf_file)
|
||||||
|
if self.options.ezdfx_keep_preprocessed:
|
||||||
|
shutil.copy2(dxf_file, os.path.join(os.path.dirname(inputfile), outputfilebase + "_ezdxf.dxf")) # complete target filename given
|
||||||
|
|
||||||
|
# Make SVG from DXF
|
||||||
|
if self.options.dxf_to_svg_parser == "sk1":
|
||||||
|
if os.name != "nt":
|
||||||
|
self.msg("You selected sk1 UniConvertor but you are not running on a Windows platform. On Linux uniconverter 1.1.X can be installed using the now obsolete Python 2.7, but it will not run correctly because you finally will fail at installing liblcms1-dev library on newer systems. That leads to uncompilable sk1libs package. Unfortunately sk1 UniConvertor 2.X does not support dxf format. So please use another DXF to SVG converter.")
|
||||||
|
exit(1)
|
||||||
|
sk1_command_ending = os.path.splitext(os.path.splitext(os.path.basename(self.options.sk1_uniconverter))[1])[0]
|
||||||
|
if sk1_command_ending != ".cmd":
|
||||||
|
self.msg("You selected sk1 UniConverter but it was not configured properly. Check the path to the executable.")
|
||||||
|
exit(1)
|
||||||
|
uniconverter_cmd = [self.options.sk1_uniconverter, dxf_file, svg_file]
|
||||||
|
#self.msg(uniconverter_cmd)
|
||||||
|
proc = subprocess.Popen(uniconverter_cmd, shell=False, stdout=PIPE, stderr=PIPE)
|
||||||
|
stdout, stderr = proc.communicate()
|
||||||
|
if proc.returncode != 0:
|
||||||
|
self.msg("UniConverter failed: %d %s %s" % (proc.returncode, stdout, stderr))
|
||||||
|
if self.options.opendironerror:
|
||||||
|
self.openExplorer(temp_output_dir)
|
||||||
|
|
||||||
|
elif self.options.dxf_to_svg_parser == "bjnortier":
|
||||||
|
if which("node") is None:
|
||||||
|
self.msg("NodeJS executable not found on path. Please check your installation.")
|
||||||
|
exit(1)
|
||||||
|
else:
|
||||||
|
bjnortier_cmd = ["node", os.path.join("node_modules","dxf","lib","cli.js"), dxf_file, svg_file]
|
||||||
|
#self.msg(bjnortier_cmd)
|
||||||
|
proc = subprocess.Popen(bjnortier_cmd, shell=False, stdout=PIPE, stderr=PIPE)
|
||||||
|
stdout, stderr = proc.communicate()
|
||||||
|
if proc.returncode != 0:
|
||||||
|
self.msg("node.js DXF to SVG conversion failed: %d %s %s" % (proc.returncode, stdout, stderr))
|
||||||
|
if self.options.opendironerror:
|
||||||
|
self.openExplorer(temp_output_dir)
|
||||||
|
|
||||||
|
elif self.options.dxf_to_svg_parser == "kabeja":
|
||||||
|
wd = os.path.join(os.getcwd(), "kabeja")
|
||||||
|
#self.msg(wd)
|
||||||
|
proc = subprocess.Popen("java -jar launcher.jar -nogui -pipeline svg " + dxf_file + " " + svg_file, cwd=wd, shell=True, stdout=PIPE, stderr=PIPE)
|
||||||
|
stdout, stderr = proc.communicate()
|
||||||
|
if proc.returncode != 0:
|
||||||
|
self.msg("kabeja failed: %d %s %s" % (proc.returncode, stdout, stderr))
|
||||||
|
if self.options.opendironerror:
|
||||||
|
self.openExplorer(temp_output_dir)
|
||||||
|
|
||||||
|
elif self.options.dxf_to_svg_parser == "vpype_dxf":
|
||||||
|
try:
|
||||||
|
from inkex.command import inkscape
|
||||||
|
import vpype
|
||||||
|
from vpype_cli import execute
|
||||||
|
except Exception as e:
|
||||||
|
self.msg("Error importing vpype. Did you properly install the vpype and vpype-dxf python modules?")
|
||||||
|
exit(1)
|
||||||
|
doc = vpype.Document() #create new vpype document
|
||||||
|
command = "dread --quantization " + str(self.options.vpype_quantization) #dread = Extract geometries from a DXF file.
|
||||||
|
if self.options.vpype_simplify is True:
|
||||||
|
command += " --simplify"
|
||||||
|
if self.options.vpype_parallel is True:
|
||||||
|
command += " --parallel"
|
||||||
|
#command += " '" + inputfile + "'"
|
||||||
|
command += " '" + dxf_file + "'"
|
||||||
|
|
||||||
|
#self.msg(command)
|
||||||
|
doc = execute(command, doc)
|
||||||
|
if doc.length() == 0:
|
||||||
|
self.msg('No lines left after vpype conversion. Conversion result is empty. Cannot continue')
|
||||||
|
exit(1)
|
||||||
|
# save the vpype document to new svg file and close it afterwards
|
||||||
|
output_fileIO = open(svg_file, "w", encoding="utf-8")
|
||||||
|
vpype.write_svg(output_fileIO, doc, page_size=None, center=False, source_string='', layer_label_format='%d', show_pen_up=False, color_mode='layer', use_svg_metadata=False, set_date=False)
|
||||||
|
output_fileIO.close()
|
||||||
|
# convert vpype polylines/lines/polygons to regular paths again.
|
||||||
|
cli_output = inkscape(svg_file, "--export-overwrite", actions="select-all;clone-unlink-recursively;object-to-path")
|
||||||
|
if len(cli_output) > 0:
|
||||||
|
self.debug(_("Inkscape returned the following output when trying to run the vpype object to path back-conversion:"))
|
||||||
|
self.debug(cli_output)
|
||||||
|
|
||||||
|
elif self.options.dxf_to_svg_parser == "ezdxf":
|
||||||
|
try:
|
||||||
|
doc = ezdxf.readfile(dxf_file)
|
||||||
|
msp = doc.modelspace()
|
||||||
|
#for e in msp: #loop through entities
|
||||||
|
# self.msg(e)
|
||||||
|
#doc.header['$DIMSCALE'] = 0.2 does not apply to the plot :-(
|
||||||
|
#self.msg(doc.header['$DIMSCALE'])
|
||||||
|
#self.msg(doc.header['$MEASUREMENT'])
|
||||||
|
auditor = doc.audit() #audit & repair DXF document before rendering
|
||||||
|
# The auditor.errors attribute stores severe errors, which *may* raise exceptions when rendering.
|
||||||
|
if len(auditor.errors) == 0:
|
||||||
|
fig = plt.figure()
|
||||||
|
ax = plt.axes([0., 0., 1., 1.], xticks=[], yticks=[])
|
||||||
|
#ax = plt.axes([0., 0., 1., 1.], frameon=False, xticks=[], yticks=[])
|
||||||
|
#ax.patches = []
|
||||||
|
#plt.axis('off')
|
||||||
|
plt.margins(0, 0)
|
||||||
|
plt.gca().xaxis.set_major_locator(plt.NullLocator())
|
||||||
|
plt.gca().yaxis.set_major_locator(plt.NullLocator())
|
||||||
|
plt.subplots_adjust(top=1, bottom=0, right=1, left=0, hspace=0, wspace=0)
|
||||||
|
out = MatplotlibBackend(fig.add_axes(ax))
|
||||||
|
Frontend(RenderContext(doc), out).draw_layout(msp, finalize=True)
|
||||||
|
#plt.show()
|
||||||
|
#fig.savefig(os.path.join(temp_output_dir, outputfilebase + ".png"), dpi=300)
|
||||||
|
fig.savefig(svg_file) #see https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.savefig.html
|
||||||
|
except IOError:
|
||||||
|
self.msg("Not a DXF file or a generic I/O error.")
|
||||||
|
exit(1)
|
||||||
|
except ezdxf.DXFStructureError:
|
||||||
|
self.msg("Invalid or corrupted DXF file.")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
elif self.options.dxf_to_svg_parser == "legacy":
|
||||||
|
self.msg("The selected legacy DXF to SVG parser is not supported by this extension yet. Use File > Import > *.dxf. This calls the \"dxf_input.inx\" extension.")
|
||||||
|
exit(1)
|
||||||
|
else:
|
||||||
|
self.msg("undefined parser")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
# Write the generated SVG into InkScape's canvas
|
||||||
|
try:
|
||||||
|
stream = open(svg_file, 'r')
|
||||||
|
except FileNotFoundError as e:
|
||||||
|
self.msg("There was no SVG output generated. Cannot continue")
|
||||||
|
exit(1)
|
||||||
|
p = etree.XMLParser(huge_tree=True)
|
||||||
|
doc = etree.parse(stream, parser=etree.XMLParser(huge_tree=True)).getroot()
|
||||||
|
stream.close()
|
||||||
|
docGroup = self.document.getroot().add(inkex.Group(id=self.svg.get_unique_id("dxf_dwg_import-" + self.options.dxf_to_svg_parser + "-")))
|
||||||
|
|
||||||
|
if self.options.dxf_to_svg_parser == "ezdxf":
|
||||||
|
parent = doc.xpath("//svg:g[@id = 'axes_1']", namespaces=inkex.NSS)[0]
|
||||||
|
for element in parent:
|
||||||
|
docGroup.append(element)
|
||||||
|
elif self.options.dxf_to_svg_parser == "kabeja":
|
||||||
|
parent = doc.xpath("//svg:g[@id = 'draft']", namespaces=inkex.NSS)[0]
|
||||||
|
for element in parent:
|
||||||
|
docGroup.append(element)
|
||||||
|
else:
|
||||||
|
for element in doc.getchildren():
|
||||||
|
docGroup.append(element)
|
||||||
|
|
||||||
|
#get children of the doc and move them one group above - we don't do this for bjnortier tool because this has different structure which we don't want to disturb
|
||||||
|
if self.options.dxf_to_svg_parser == "sk1":
|
||||||
|
elements = []
|
||||||
|
emptyGroup = None
|
||||||
|
for firstGroup in doc.getchildren():
|
||||||
|
emptyGroup = firstGroup
|
||||||
|
for element in firstGroup.getchildren():
|
||||||
|
elements.append(element)
|
||||||
|
#break #only one cycle - could be bad idea or not
|
||||||
|
for element in elements:
|
||||||
|
doc.set('id', self.svg.get_unique_id('dxf_dwg_import'))
|
||||||
|
doc.insert(doc.index(firstGroup), element)
|
||||||
|
|
||||||
|
if emptyGroup is not None:
|
||||||
|
emptyGroup.getparent().remove(emptyGroup)
|
||||||
|
|
||||||
|
#adjust viewport and width/height to have the import at the center of the canvas
|
||||||
|
if self.options.resizetoimport:
|
||||||
|
for element in self.document.getroot().iter("*"):
|
||||||
|
try:
|
||||||
|
element.bounding_box()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
bbox = docGroup.bounding_box() #only works because we process bounding boxes previously. see top
|
||||||
|
if bbox is not None:
|
||||||
|
root = self.document.getroot();
|
||||||
|
offset = self.svg.unittouu(str(self.options.extraborder) + self.options.extraborder_units)
|
||||||
|
root.set('viewBox', '%f %f %f %f' % (bbox.left - offset, bbox.top - offset, bbox.width + 2 * offset, bbox.height + 2 * offset))
|
||||||
|
root.set('width', bbox.width + 2 * offset)
|
||||||
|
root.set('height', bbox.height + 2 * offset)
|
||||||
|
else:
|
||||||
|
self.msg("Error finding bounding box. Skipped that step ...")
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
DXFDWGImport().run()
|
26
extensions/fablabchemnitz/dxf_dwg_importer/kabeja/INSTALL
Normal file
26
extensions/fablabchemnitz/dxf_dwg_importer/kabeja/INSTALL
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
Binary-package:
|
||||||
|
---------------
|
||||||
|
|
||||||
|
Windows:
|
||||||
|
* double-click "kabeja.exe"
|
||||||
|
|
||||||
|
Linux/Unix:
|
||||||
|
* sh kabeja.sh
|
||||||
|
or:
|
||||||
|
* chmod a=rx kabeja.sh (only ones)
|
||||||
|
* ./kabeja.sh
|
||||||
|
|
||||||
|
Other:
|
||||||
|
* java -jar launcher.jar
|
||||||
|
|
||||||
|
Buidling:
|
||||||
|
---------
|
||||||
|
|
||||||
|
You need Ant for building (http://ant.apache.org).
|
||||||
|
|
||||||
|
If you want to build the Cocoon-block you have to copy blocks.propterties
|
||||||
|
to local.blocks.properties and edit this file (set the path to the Cocoon-libraries).
|
||||||
|
|
||||||
|
try:
|
||||||
|
|
||||||
|
ant
|
148
extensions/fablabchemnitz/dxf_dwg_importer/kabeja/README
Normal file
148
extensions/fablabchemnitz/dxf_dwg_importer/kabeja/README
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
Kabeja is a small library for parsing DXF-Files and converting
|
||||||
|
this to SVG. It is licensed under the Apache Software License 2.0.
|
||||||
|
|
||||||
|
|
||||||
|
Limitation:
|
||||||
|
-----------
|
||||||
|
There are not all Entities of DXF supported yet. Text-Entities generate problems too.
|
||||||
|
|
||||||
|
Supported:
|
||||||
|
|
||||||
|
|
||||||
|
*Arc
|
||||||
|
*Attrib
|
||||||
|
*Polyline
|
||||||
|
*Circle
|
||||||
|
*Line
|
||||||
|
*Blocks/Insert
|
||||||
|
*Text
|
||||||
|
*MText
|
||||||
|
*LWPolyline
|
||||||
|
*Solid
|
||||||
|
*Trace
|
||||||
|
*Ellipse
|
||||||
|
*Dimension
|
||||||
|
*Image
|
||||||
|
*Leader
|
||||||
|
*XLine
|
||||||
|
*Ray
|
||||||
|
*Hatch
|
||||||
|
*Spline
|
||||||
|
*MLine
|
||||||
|
|
||||||
|
Planned:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* Tolerance
|
||||||
|
|
||||||
|
|
||||||
|
You can use Kabeja from CLI (Command Line Interface) or embed in your application.
|
||||||
|
|
||||||
|
GUI:
|
||||||
|
----
|
||||||
|
Windows:
|
||||||
|
* double-click "kabeja.exe"
|
||||||
|
|
||||||
|
Linux:
|
||||||
|
* sh kabeja.sh
|
||||||
|
|
||||||
|
or:
|
||||||
|
|
||||||
|
* chmod a=rx kabeja.sh (only ones)
|
||||||
|
* ./kabeja.sh
|
||||||
|
|
||||||
|
Other:
|
||||||
|
* java -jar launcher.jar
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CLI:
|
||||||
|
----
|
||||||
|
in the Kabeja-folder try:
|
||||||
|
|
||||||
|
* Help and pipeline list
|
||||||
|
|
||||||
|
java -jar launcher.jar --help
|
||||||
|
|
||||||
|
* Convert to svg
|
||||||
|
|
||||||
|
java -jar launcher.jar -nogui -pipeline svg myfile.dxf result.svg
|
||||||
|
|
||||||
|
* Convert to pdf|jpeg|png|...
|
||||||
|
|
||||||
|
java -jar launcher.jar -nogui -pipeline <pdf|jpeg|png> myfile.dxf
|
||||||
|
|
||||||
|
|
||||||
|
Normally Java uses 64 MB of your memory, to setup more use the following commandline
|
||||||
|
switch:
|
||||||
|
|
||||||
|
java -Xmx256m -jar .....
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
GUI-Viewer:
|
||||||
|
-----------
|
||||||
|
in the 'lib'-folder try:
|
||||||
|
|
||||||
|
java -jar kabeja-svgview.jar
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Cocoon 2.1 (XML-Publishing-Framework http://cocoon.apache.org/2.1):
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copy the 'kabeja.jar' and 'kabeja-svg2dxf-cocoon.jar' to your WEB-INF/lib-folder
|
||||||
|
of your Cocoon-Webapplication. Then you can use Kabeja as Generator like:
|
||||||
|
|
||||||
|
|
||||||
|
in your sitemap/subsitemap:
|
||||||
|
|
||||||
|
snippet:
|
||||||
|
--------
|
||||||
|
|
||||||
|
<map:components>
|
||||||
|
.....
|
||||||
|
<map:generators default="file">
|
||||||
|
|
||||||
|
<map:generator name="dxf2svg" src="org.kabeja.cocoon.generation.DXF2SVGGenerator"/>
|
||||||
|
|
||||||
|
</map:generators>
|
||||||
|
|
||||||
|
|
||||||
|
....
|
||||||
|
<map:pipelines>
|
||||||
|
|
||||||
|
<map:pipeline>
|
||||||
|
|
||||||
|
<map:match pattern="dxf/*.svg">
|
||||||
|
<map:generate type="dxf2svg" src="dxf/{1}.dxf"/>
|
||||||
|
...
|
||||||
|
<!-- transform things you need -->
|
||||||
|
|
||||||
|
<map:serialize type="xml"/>
|
||||||
|
</map:match>
|
||||||
|
|
||||||
|
</map:pipeline>
|
||||||
|
|
||||||
|
....
|
||||||
|
|
||||||
|
|
||||||
|
</map:pipelines>
|
||||||
|
|
||||||
|
Note: DXF-drafts often real large drafts, so the SVGDocument will consume a lot of memory. The Generator is
|
||||||
|
Cacheable so the first run will take more time.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Feedback and Help
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
Any help and feedback are greatly appreciated.
|
||||||
|
|
||||||
|
Mail: simon.mieth@gmx.de
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,92 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<parser class="org.kabeja.parser.DXFParser" xmlns="http://kabeja.org/parser/1.0">
|
||||||
|
<handler class="org.kabeja.parser.DXFHeaderSectionHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.DXFTableSectionHandler">
|
||||||
|
<handlers>
|
||||||
|
<handler class="org.kabeja.parser.table.DXFLayerTableHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.table.DXFLineTypeTableHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.table.DXFViewTableHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.table.DXFViewportTableHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.table.DXFStyleTableHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.table.DXFDimensionStyleTableHandler"/>
|
||||||
|
</handlers>
|
||||||
|
</handler>
|
||||||
|
|
||||||
|
<!--+
|
||||||
|
| The block and the entities handler use the same sub handlers.
|
||||||
|
| If you have create a parser for an entity add the parser in
|
||||||
|
| both sections.
|
||||||
|
+-->
|
||||||
|
|
||||||
|
<handler class="org.kabeja.parser.DXFBlocksSectionHandler">
|
||||||
|
<handlers>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFArcHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFCircleHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFEllipseHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFInsertHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFLineHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFPolylineHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFLWPolylineHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFSolidHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFTextHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFAttribHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFMTextHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFTraceHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFDimensionHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFImageHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXF3DFaceHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFRayHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFXLineHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFRegionHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFBodyHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXF3DSolidHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFSplineHandler"/>
|
||||||
|
</handlers>
|
||||||
|
</handler>
|
||||||
|
|
||||||
|
<!--+
|
||||||
|
|The entity section parser part
|
||||||
|
|
|
||||||
|
+-->
|
||||||
|
|
||||||
|
|
||||||
|
<handler class="org.kabeja.parser.DXFEntitiesSectionHandler">
|
||||||
|
<handlers>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFArcHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFCircleHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFEllipseHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFInsertHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFLineHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFPolylineHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFLWPolylineHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFSolidHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFTextHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFAttribHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFMTextHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFTraceHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFDimensionHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFImageHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXF3DFaceHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFRayHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFXLineHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFRegionHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFBodyHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXF3DSolidHandler"/>
|
||||||
|
<handler class="org.kabeja.parser.entities.DXFSplineHandler"/>
|
||||||
|
</handlers>
|
||||||
|
</handler>
|
||||||
|
|
||||||
|
|
||||||
|
<!--+
|
||||||
|
|The objects section parser part
|
||||||
|
|
|
||||||
|
+-->
|
||||||
|
|
||||||
|
|
||||||
|
<handler class="org.kabeja.parser.DXFObjectsSectionHandler">
|
||||||
|
<handlers>
|
||||||
|
<handler class="org.kabeja.parser.objects.DXFImageDefHandler"/>
|
||||||
|
</handlers>
|
||||||
|
</handler>
|
||||||
|
|
||||||
|
</parser>
|
@ -0,0 +1,180 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<processing xmlns="http://kabeja.org/processing/1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||||
|
<!--+
|
||||||
|
| The processing configuration
|
||||||
|
+-->
|
||||||
|
<configuration>
|
||||||
|
<!--+
|
||||||
|
| If you want to configure the parser you can change the parser.xml and use it here or
|
||||||
|
| register your own parser for other input formats
|
||||||
|
| <parsers>
|
||||||
|
| <xi:include href="conf/parser.xml"/>
|
||||||
|
| </parsers>
|
||||||
|
+-->
|
||||||
|
<postprocessors>
|
||||||
|
<postprocessor class="org.kabeja.processing.BoundsDebugger" name="bounds.debugger"/>
|
||||||
|
<!-- removes all image entities if the images file does not exists -->
|
||||||
|
<postprocessor class="org.kabeja.processing.ImageFilter" name="image.filter"/>
|
||||||
|
<postprocessor class="org.kabeja.processing.BoundsFilter" name="bounds.filter"/>
|
||||||
|
<!-- allows you to remove layers from the draft and merge all layers to one -->
|
||||||
|
<postprocessor class="org.kabeja.processing.LayerFilter" name="layer.filter"/>
|
||||||
|
<!-- converts lines,arcs and polylines to a single polyline, if they have the same points -->
|
||||||
|
<postprocessor class="org.kabeja.processing.PolylineConverter" name="polyline.converter"/>
|
||||||
|
<!-- removes invisible entities -->
|
||||||
|
<postprocessor class="org.kabeja.processing.VisibilityFilter" name="visibility.filter"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<postprocessor class="org.kabeja.processing.ScriptablePostProcessor" name="js"/>
|
||||||
|
</postprocessors>
|
||||||
|
|
||||||
|
<filters>
|
||||||
|
|
||||||
|
<filter class="org.kabeja.batik.tools.ImageBase64Encoder" name="image"/>
|
||||||
|
<filter class="org.kabeja.svg.FixedStrokeWidthFilter" name="fixed-stroke-width"/>
|
||||||
|
<filter class="org.kabeja.svg.RootLayerFilter" name="rootlayer.filter"/>
|
||||||
|
<filter class="org.kabeja.svg.StyleAttributeFilter" name="styleattribute.filter"/>
|
||||||
|
<filter class="org.kabeja.xslt.SAXXSLTFilter" name="xslt">
|
||||||
|
<property name="http://xml.org/sax/features/is-standalone/" value="true"/>
|
||||||
|
</filter>
|
||||||
|
</filters>
|
||||||
|
|
||||||
|
<serializers>
|
||||||
|
<serializer class="org.kabeja.xml.SAXPrettyOutputter" name="svg"/>
|
||||||
|
<serializer class="org.kabeja.batik.tools.SAXJPEGSerializer" name="jpeg"/>
|
||||||
|
<serializer class="org.kabeja.batik.tools.SAXPNGSerializer" name="png"/>
|
||||||
|
<serializer class="org.kabeja.batik.tools.SAXTIFFSerializer" name="tiff"/>
|
||||||
|
<serializer class="org.kabeja.batik.tools.SAXPDFSerializer" name="pdf">
|
||||||
|
<!--+
|
||||||
|
| *example configuration works with jpeg/png/tiff also
|
||||||
|
|
|
||||||
|
| * setup a paper sizes A0-A6
|
||||||
|
| <property name="paper" value="A1"/>
|
||||||
|
|
|
||||||
|
| * setup own paper size by mm/in/px/cm
|
||||||
|
| <property name="width" value="100mm"/>
|
||||||
|
| <property name="height" value="50mm"/>
|
||||||
|
|
|
||||||
|
| * dpi setting
|
||||||
|
| <property name="dpi" value="300"/>
|
||||||
|
|
|
||||||
|
| * change the orientation
|
||||||
|
| <property name="orientation" value="landscape"/>
|
||||||
|
+-->
|
||||||
|
</serializer>
|
||||||
|
<serializer class="org.kabeja.xslt.SAXXMLSerializer" name="xml"/>
|
||||||
|
</serializers>
|
||||||
|
|
||||||
|
<generators>
|
||||||
|
|
||||||
|
<generator class="org.kabeja.svg.SVGGenerator" name="svg">
|
||||||
|
<!--+
|
||||||
|
| possible values are:
|
||||||
|
| *) modelspace
|
||||||
|
| *) paperspace
|
||||||
|
| *) kabeja -> the default
|
||||||
|
+-->
|
||||||
|
<property name="bounds-rule" value="kabeja"/>
|
||||||
|
|
||||||
|
<!--+
|
||||||
|
| * you can choose a layout
|
||||||
|
| by name:
|
||||||
|
| <property name="output-style-name" value="myLayout2"/>
|
||||||
|
| or the default "Model"-layout will be used
|
||||||
|
+-->
|
||||||
|
<property name="output-style" value="layout"/>
|
||||||
|
|
||||||
|
<!--+
|
||||||
|
| you can setup an own stroke width for the draft
|
||||||
|
| this will override the draft line weight
|
||||||
|
| <property name="stroke-width" value="0.02%"/>
|
||||||
|
+-->
|
||||||
|
</generator>
|
||||||
|
</generators>
|
||||||
|
|
||||||
|
</configuration>
|
||||||
|
|
||||||
|
<!--+
|
||||||
|
| The processing pipelines
|
||||||
|
+-->
|
||||||
|
|
||||||
|
<pipelines>
|
||||||
|
|
||||||
|
|
||||||
|
<pipeline name="Inkscape" description="Converts the draft to SVG using the inkscape import filter settings.">
|
||||||
|
<generate name="svg"/>
|
||||||
|
<filter name="rootlayer.filter"/>
|
||||||
|
<filter name="styleattribute.filter"/>
|
||||||
|
<serialize name="svg"/>
|
||||||
|
</pipeline>
|
||||||
|
<pipeline name="svg" description="Converts the draft to SVG">
|
||||||
|
<generate name="svg"/>
|
||||||
|
<serialize name="svg"/>
|
||||||
|
</pipeline>
|
||||||
|
<pipeline name="debug" description="Helps to debug false bounds">
|
||||||
|
<postprocess name="bounds.debugger"/>
|
||||||
|
<generate name="svg"/>
|
||||||
|
<filter name="image"/>
|
||||||
|
<serialize name="svg"/>
|
||||||
|
</pipeline>
|
||||||
|
<pipeline name="jpeg">
|
||||||
|
<generate name="svg"/>
|
||||||
|
<serialize name="jpeg">
|
||||||
|
<property name="width" value="1024"/>
|
||||||
|
<property name="height" value="768"/>
|
||||||
|
</serialize>
|
||||||
|
</pipeline>
|
||||||
|
<pipeline name="png">
|
||||||
|
<generate name="svg"/>
|
||||||
|
<serialize name="png">
|
||||||
|
<property name="width" value="1024"/>
|
||||||
|
<property name="height" value="768"/>
|
||||||
|
</serialize>
|
||||||
|
</pipeline>
|
||||||
|
<pipeline name="tiff">
|
||||||
|
<generate name="svg"/>
|
||||||
|
<serialize name="tiff">
|
||||||
|
<property name="width" value="1024"/>
|
||||||
|
<property name="height" value="768"/>
|
||||||
|
</serialize>
|
||||||
|
</pipeline>
|
||||||
|
<pipeline name="pdf">
|
||||||
|
<generate name="svg"/>
|
||||||
|
<serialize name="pdf"/>
|
||||||
|
</pipeline>
|
||||||
|
<pipeline name="font" description="Convert to SVG and tries to embed fonts">
|
||||||
|
<generate name="svg"/>
|
||||||
|
<filter name="xslt">
|
||||||
|
<property name="stylesheet" value="../tools/xsl/embedfont.xsl"/>
|
||||||
|
</filter>
|
||||||
|
<serialize name="svg"/>
|
||||||
|
</pipeline>
|
||||||
|
<pipeline name="embed" description="Convert to SVG and tries to embed fonts and images">
|
||||||
|
<generate name="svg"/>
|
||||||
|
<postprocess name="image.filter"/>
|
||||||
|
<generate name="svg"/>
|
||||||
|
<filter name="image"/>
|
||||||
|
<filter name="xslt">
|
||||||
|
<property name="stylesheet" value="../tools/xsl/embedfont.xsl"/>
|
||||||
|
<property name="http://xml.org/sax/features/is-standalone/" value="true"/>
|
||||||
|
<property name="http://xml.org/sax/features/external-general-entities" value="false"/>
|
||||||
|
</filter>
|
||||||
|
<serialize name="svg"/>
|
||||||
|
</pipeline>
|
||||||
|
<pipeline name="mozilla" description="Generate a Mozilla 1.5.X compatible SVG (change all to a fixed stoke-width)">
|
||||||
|
<generate name="svg"/>
|
||||||
|
<!-- Mozilla based browser only render svg with a
|
||||||
|
fixed stroke-width, a percent value will cause a
|
||||||
|
crashing Mozilla -->
|
||||||
|
<filter name="fixed-stroke-width"/>
|
||||||
|
<serialize name="svg"/>
|
||||||
|
</pipeline>
|
||||||
|
<pipeline name="scripting" desription="Invokes the javascipt postprocessor before converting to SVG">
|
||||||
|
<generate name="svg"/>
|
||||||
|
<postprocess name="js">
|
||||||
|
<property name="src" value="scripts/layoutDebug.js"/>
|
||||||
|
</postprocess>
|
||||||
|
<serialize name="pdf"/>
|
||||||
|
</pipeline>
|
||||||
|
</pipelines>
|
||||||
|
</processing>
|
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<uiconfiguration xmlns="http://kabeja.org/processing/ui/1.0">
|
||||||
|
<components>
|
||||||
|
<component class="org.kabeja.ui.impl.ProcessingUI"/>
|
||||||
|
<component class="org.kabeja.ui.impl.ProcessingRunViewComponent"/>
|
||||||
|
<!-- <component class="org.kabeja.ui.impl.ProcessingEditorViewComponent"/> -->
|
||||||
|
<component class="org.kabeja.svg.ui.SVGViewUIComponent"/>
|
||||||
|
<component class="org.kabeja.processing.scripting.impl.JavaScriptShell"/>
|
||||||
|
<component class="org.kabeja.svg.ui.OutputSettingsUI"/>
|
||||||
|
<component class="dk.abj.svg.action.ZoomSelectionActionInterceptor"/>
|
||||||
|
<component class="dk.abj.svg.action.ZoomImageActionInteractor"/>
|
||||||
|
<component class="dk.abj.svg.action.PanActionInterceptor"/>
|
||||||
|
<component class="dk.abj.svg.action.CenterAction"/>
|
||||||
|
<component class="dk.abj.svg.action.RotateActionInteractor"/>
|
||||||
|
<component class="org.kabeja.svg.action.LayoutSwitchAction"/>
|
||||||
|
<component class="org.kabeja.svg.action.PrintAction"/>
|
||||||
|
</components>
|
||||||
|
</uiconfiguration>
|
1000
extensions/fablabchemnitz/dxf_dwg_importer/kabeja/doc/userguide.pdf
Normal file
1000
extensions/fablabchemnitz/dxf_dwg_importer/kabeja/doc/userguide.pdf
Normal file
File diff suppressed because one or more lines are too long
27
extensions/fablabchemnitz/dxf_dwg_importer/kabeja/font.xml
Normal file
27
extensions/fablabchemnitz/dxf_dwg_importer/kabeja/font.xml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<project name="font-import" default="import" basedir=".">
|
||||||
|
<property name="main.class" value="org.kabeja.batik.tools.FontImport"/>
|
||||||
|
<property name="font.dir" value="fonts"/>
|
||||||
|
<property name="font.properties" value="conf/font.properties"/>
|
||||||
|
<property name="font.source" value=""/>
|
||||||
|
|
||||||
|
|
||||||
|
<target name="import">
|
||||||
|
<mkdir dir="${font.dir}"/>
|
||||||
|
|
||||||
|
<java classname="${main.class}">
|
||||||
|
<classpath>
|
||||||
|
<fileset dir="lib">
|
||||||
|
<include name="**/*.jar" />
|
||||||
|
</fileset>
|
||||||
|
</classpath>
|
||||||
|
<arg line="${font.source} ${font.dir} ${font.properties}"/>
|
||||||
|
</java>
|
||||||
|
|
||||||
|
|
||||||
|
</target>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
BIN
extensions/fablabchemnitz/dxf_dwg_importer/kabeja/kabeja.exe
Normal file
BIN
extensions/fablabchemnitz/dxf_dwg_importer/kabeja/kabeja.exe
Normal file
Binary file not shown.
7
extensions/fablabchemnitz/dxf_dwg_importer/kabeja/kabeja.sh
Executable file
7
extensions/fablabchemnitz/dxf_dwg_importer/kabeja/kabeja.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
JAVA_MEM=256m
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
java -Xmx$JAVA_MEM -jar launcher.jar $@
|
BIN
extensions/fablabchemnitz/dxf_dwg_importer/kabeja/launcher.jar
Normal file
BIN
extensions/fablabchemnitz/dxf_dwg_importer/kabeja/launcher.jar
Normal file
Binary file not shown.
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* The Apache Software License, Version 1.1
|
||||||
|
*
|
||||||
|
* Copyright (c) 2001-2003 Ant-Contrib project. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* 3. The end-user documentation included with the redistribution, if
|
||||||
|
* any, must include the following acknowlegement:
|
||||||
|
* "This product includes software developed by the
|
||||||
|
* Ant-Contrib project (http://sourceforge.net/projects/ant-contrib)."
|
||||||
|
* Alternately, this acknowlegement may appear in the software itself,
|
||||||
|
* if and wherever such third-party acknowlegements normally appear.
|
||||||
|
*
|
||||||
|
* 4. The name Ant-Contrib must not be used to endorse or promote products
|
||||||
|
* derived from this software without prior written permission. For
|
||||||
|
* written permission, please contact
|
||||||
|
* ant-contrib-developers@lists.sourceforge.net.
|
||||||
|
*
|
||||||
|
* 5. Products derived from this software may not be called "Ant-Contrib"
|
||||||
|
* nor may "Ant-Contrib" appear in their names without prior written
|
||||||
|
* permission of the Ant-Contrib project.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE ANT-CONTRIB PROJECT OR ITS
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||||
|
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
@ -0,0 +1,201 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
@ -0,0 +1,584 @@
|
|||||||
|
|
||||||
|
This distribution includes the Mozilla Rhino 1.5 release 4.1 binary
|
||||||
|
distribution without code modifications.
|
||||||
|
You can also get that distribution from the following URL:
|
||||||
|
ftp://ftp.mozilla.org/pub/js/
|
||||||
|
Source code for Rhino is available on Mozilla web site:
|
||||||
|
http://www.mozilla.org/rhino
|
||||||
|
Rhino is licensed under the NPL (Netscape Public License) which
|
||||||
|
is duplicated below.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
AMENDMENTS
|
||||||
|
|
||||||
|
The Netscape Public License Version 1.1 ("NPL") consists of the
|
||||||
|
Mozilla Public License Version 1.1 with the following Amendments,
|
||||||
|
including Exhibit A-Netscape Public License. Files identified with
|
||||||
|
"Exhibit A-Netscape Public License" are governed by the Netscape
|
||||||
|
Public License Version 1.1.
|
||||||
|
|
||||||
|
Additional Terms applicable to the Netscape Public License.
|
||||||
|
I. Effect.
|
||||||
|
These additional terms described in this Netscape Public
|
||||||
|
License -- Amendments shall apply to the Mozilla Communicator
|
||||||
|
client code and to all Covered Code under this License.
|
||||||
|
|
||||||
|
II. "Netscape's Branded Code" means Covered Code that Netscape
|
||||||
|
distributes and/or permits others to distribute under one or more
|
||||||
|
trademark(s) which are controlled by Netscape but which are not
|
||||||
|
licensed for use under this License.
|
||||||
|
|
||||||
|
III. Netscape and logo.
|
||||||
|
This License does not grant any rights to use the trademarks
|
||||||
|
"Netscape", the "Netscape N and horizon" logo or the "Netscape
|
||||||
|
lighthouse" logo, "Netcenter", "Gecko", "Java" or "JavaScript",
|
||||||
|
"Smart Browsing" even if such marks are included in the Original
|
||||||
|
Code or Modifications.
|
||||||
|
|
||||||
|
IV. Inability to Comply Due to Contractual Obligation.
|
||||||
|
Prior to licensing the Original Code under this License, Netscape
|
||||||
|
has licensed third party code for use in Netscape's Branded Code.
|
||||||
|
To the extent that Netscape is limited contractually from making
|
||||||
|
such third party code available under this License, Netscape may
|
||||||
|
choose to reintegrate such code into Covered Code without being
|
||||||
|
required to distribute such code in Source Code form, even if
|
||||||
|
such code would otherwise be considered "Modifications" under
|
||||||
|
this License.
|
||||||
|
|
||||||
|
V. Use of Modifications and Covered Code by Initial Developer.
|
||||||
|
V.1. In General.
|
||||||
|
The obligations of Section 3 apply to Netscape, except to
|
||||||
|
the extent specified in this Amendment, Section V.2 and V.3.
|
||||||
|
|
||||||
|
V.2. Other Products.
|
||||||
|
Netscape may include Covered Code in products other than the
|
||||||
|
Netscape's Branded Code which are released by Netscape
|
||||||
|
during the two (2) years following the release date of the
|
||||||
|
Original Code, without such additional products becoming
|
||||||
|
subject to the terms of this License, and may license such
|
||||||
|
additional products on different terms from those contained
|
||||||
|
in this License.
|
||||||
|
|
||||||
|
V.3. Alternative Licensing.
|
||||||
|
Netscape may license the Source Code of Netscape's Branded
|
||||||
|
Code, including Modifications incorporated therein, without
|
||||||
|
such Netscape Branded Code becoming subject to the terms of
|
||||||
|
this License, and may license such Netscape Branded Code on
|
||||||
|
different terms from those contained in this License.
|
||||||
|
|
||||||
|
VI. Litigation.
|
||||||
|
Notwithstanding the limitations of Section 11 above, the
|
||||||
|
provisions regarding litigation in Section 11(a), (b) and (c) of
|
||||||
|
the License shall apply to all disputes relating to this License.
|
||||||
|
|
||||||
|
EXHIBIT A-Netscape Public License.
|
||||||
|
|
||||||
|
"The contents of this file are subject to the Netscape Public
|
||||||
|
License Version 1.1 (the "License"); you may not use this file
|
||||||
|
except in compliance with the License. You may obtain a copy of
|
||||||
|
the License at http://www.mozilla.org/NPL/
|
||||||
|
|
||||||
|
Software distributed under the License is distributed on an "AS
|
||||||
|
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||||
|
implied. See the License for the specific language governing
|
||||||
|
rights and limitations under the License.
|
||||||
|
|
||||||
|
The Original Code is Mozilla Communicator client code, released
|
||||||
|
March 31, 1998.
|
||||||
|
|
||||||
|
The Initial Developer of the Original Code is Netscape
|
||||||
|
Communications Corporation. Portions created by Netscape are
|
||||||
|
Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||||
|
Rights Reserved.
|
||||||
|
|
||||||
|
Contributor(s): ______________________________________.
|
||||||
|
|
||||||
|
Alternatively, the contents of this file may be used under the
|
||||||
|
terms of the _____ license (the "[___] License"), in which case
|
||||||
|
the provisions of [______] License are applicable instead of
|
||||||
|
those above. If you wish to allow use of your version of this
|
||||||
|
file only under the terms of the [____] License and not to allow
|
||||||
|
others to use your version of this file under the NPL, indicate
|
||||||
|
your decision by deleting the provisions above and replace them
|
||||||
|
with the notice and other provisions required by the [___]
|
||||||
|
License. If you do not delete the provisions above, a recipient
|
||||||
|
may use your version of this file under either the NPL or the
|
||||||
|
[___] License."
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
MOZILLA PUBLIC LICENSE
|
||||||
|
Version 1.1
|
||||||
|
|
||||||
|
---------------
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
1.0.1. "Commercial Use" means distribution or otherwise making the
|
||||||
|
Covered Code available to a third party.
|
||||||
|
|
||||||
|
1.1. "Contributor" means each entity that creates or contributes to
|
||||||
|
the creation of Modifications.
|
||||||
|
|
||||||
|
1.2. "Contributor Version" means the combination of the Original
|
||||||
|
Code, prior Modifications used by a Contributor, and the Modifications
|
||||||
|
made by that particular Contributor.
|
||||||
|
|
||||||
|
1.3. "Covered Code" means the Original Code or Modifications or the
|
||||||
|
combination of the Original Code and Modifications, in each case
|
||||||
|
including portions thereof.
|
||||||
|
|
||||||
|
1.4. "Electronic Distribution Mechanism" means a mechanism generally
|
||||||
|
accepted in the software development community for the electronic
|
||||||
|
transfer of data.
|
||||||
|
|
||||||
|
1.5. "Executable" means Covered Code in any form other than Source
|
||||||
|
Code.
|
||||||
|
|
||||||
|
1.6. "Initial Developer" means the individual or entity identified
|
||||||
|
as the Initial Developer in the Source Code notice required by Exhibit
|
||||||
|
A.
|
||||||
|
|
||||||
|
1.7. "Larger Work" means a work which combines Covered Code or
|
||||||
|
portions thereof with code not governed by the terms of this License.
|
||||||
|
|
||||||
|
1.8. "License" means this document.
|
||||||
|
|
||||||
|
1.8.1. "Licensable" means having the right to grant, to the maximum
|
||||||
|
extent possible, whether at the time of the initial grant or
|
||||||
|
subsequently acquired, any and all of the rights conveyed herein.
|
||||||
|
|
||||||
|
1.9. "Modifications" means any addition to or deletion from the
|
||||||
|
substance or structure of either the Original Code or any previous
|
||||||
|
Modifications. When Covered Code is released as a series of files, a
|
||||||
|
Modification is:
|
||||||
|
A. Any addition to or deletion from the contents of a file
|
||||||
|
containing Original Code or previous Modifications.
|
||||||
|
|
||||||
|
B. Any new file that contains any part of the Original Code or
|
||||||
|
previous Modifications.
|
||||||
|
|
||||||
|
1.10. "Original Code" means Source Code of computer software code
|
||||||
|
which is described in the Source Code notice required by Exhibit A as
|
||||||
|
Original Code, and which, at the time of its release under this
|
||||||
|
License is not already Covered Code governed by this License.
|
||||||
|
|
||||||
|
1.10.1. "Patent Claims" means any patent claim(s), now owned or
|
||||||
|
hereafter acquired, including without limitation, method, process,
|
||||||
|
and apparatus claims, in any patent Licensable by grantor.
|
||||||
|
|
||||||
|
1.11. "Source Code" means the preferred form of the Covered Code for
|
||||||
|
making modifications to it, including all modules it contains, plus
|
||||||
|
any associated interface definition files, scripts used to control
|
||||||
|
compilation and installation of an Executable, or source code
|
||||||
|
differential comparisons against either the Original Code or another
|
||||||
|
well known, available Covered Code of the Contributor's choice. The
|
||||||
|
Source Code can be in a compressed or archival form, provided the
|
||||||
|
appropriate decompression or de-archiving software is widely available
|
||||||
|
for no charge.
|
||||||
|
|
||||||
|
1.12. "You" (or "Your") means an individual or a legal entity
|
||||||
|
exercising rights under, and complying with all of the terms of, this
|
||||||
|
License or a future version of this License issued under Section 6.1.
|
||||||
|
For legal entities, "You" includes any entity which controls, is
|
||||||
|
controlled by, or is under common control with You. For purposes of
|
||||||
|
this definition, "control" means (a) the power, direct or indirect,
|
||||||
|
to cause the direction or management of such entity, whether by
|
||||||
|
contract or otherwise, or (b) ownership of more than fifty percent
|
||||||
|
(50%) of the outstanding shares or beneficial ownership of such
|
||||||
|
entity.
|
||||||
|
|
||||||
|
2. Source Code License.
|
||||||
|
|
||||||
|
2.1. The Initial Developer Grant.
|
||||||
|
The Initial Developer hereby grants You a world-wide, royalty-free,
|
||||||
|
non-exclusive license, subject to third party intellectual property
|
||||||
|
claims:
|
||||||
|
(a) under intellectual property rights (other than patent or
|
||||||
|
trademark) Licensable by Initial Developer to use, reproduce,
|
||||||
|
modify, display, perform, sublicense and distribute the Original
|
||||||
|
Code (or portions thereof) with or without Modifications, and/or
|
||||||
|
as part of a Larger Work; and
|
||||||
|
|
||||||
|
(b) under Patents Claims infringed by the making, using or
|
||||||
|
selling of Original Code, to make, have made, use, practice,
|
||||||
|
sell, and offer for sale, and/or otherwise dispose of the
|
||||||
|
Original Code (or portions thereof).
|
||||||
|
|
||||||
|
(c) the licenses granted in this Section 2.1(a) and (b) are
|
||||||
|
effective on the date Initial Developer first distributes
|
||||||
|
Original Code under the terms of this License.
|
||||||
|
|
||||||
|
(d) Notwithstanding Section 2.1(b) above, no patent license is
|
||||||
|
granted: 1) for code that You delete from the Original Code; 2)
|
||||||
|
separate from the Original Code; or 3) for infringements caused
|
||||||
|
by: i) the modification of the Original Code or ii) the
|
||||||
|
combination of the Original Code with other software or devices.
|
||||||
|
|
||||||
|
2.2. Contributor Grant.
|
||||||
|
Subject to third party intellectual property claims, each Contributor
|
||||||
|
hereby grants You a world-wide, royalty-free, non-exclusive license
|
||||||
|
|
||||||
|
(a) under intellectual property rights (other than patent or
|
||||||
|
trademark) Licensable by Contributor, to use, reproduce, modify,
|
||||||
|
display, perform, sublicense and distribute the Modifications
|
||||||
|
created by such Contributor (or portions thereof) either on an
|
||||||
|
unmodified basis, with other Modifications, as Covered Code
|
||||||
|
and/or as part of a Larger Work; and
|
||||||
|
|
||||||
|
(b) under Patent Claims infringed by the making, using, or
|
||||||
|
selling of Modifications made by that Contributor either alone
|
||||||
|
and/or in combination with its Contributor Version (or portions
|
||||||
|
of such combination), to make, use, sell, offer for sale, have
|
||||||
|
made, and/or otherwise dispose of: 1) Modifications made by that
|
||||||
|
Contributor (or portions thereof); and 2) the combination of
|
||||||
|
Modifications made by that Contributor with its Contributor
|
||||||
|
Version (or portions of such combination).
|
||||||
|
|
||||||
|
(c) the licenses granted in Sections 2.2(a) and 2.2(b) are
|
||||||
|
effective on the date Contributor first makes Commercial Use of
|
||||||
|
the Covered Code.
|
||||||
|
|
||||||
|
(d) Notwithstanding Section 2.2(b) above, no patent license is
|
||||||
|
granted: 1) for any code that Contributor has deleted from the
|
||||||
|
Contributor Version; 2) separate from the Contributor Version;
|
||||||
|
3) for infringements caused by: i) third party modifications of
|
||||||
|
Contributor Version or ii) the combination of Modifications made
|
||||||
|
by that Contributor with other software (except as part of the
|
||||||
|
Contributor Version) or other devices; or 4) under Patent Claims
|
||||||
|
infringed by Covered Code in the absence of Modifications made by
|
||||||
|
that Contributor.
|
||||||
|
|
||||||
|
3. Distribution Obligations.
|
||||||
|
|
||||||
|
3.1. Application of License.
|
||||||
|
The Modifications which You create or to which You contribute are
|
||||||
|
governed by the terms of this License, including without limitation
|
||||||
|
Section 2.2. The Source Code version of Covered Code may be
|
||||||
|
distributed only under the terms of this License or a future version
|
||||||
|
of this License released under Section 6.1, and You must include a
|
||||||
|
copy of this License with every copy of the Source Code You
|
||||||
|
distribute. You may not offer or impose any terms on any Source Code
|
||||||
|
version that alters or restricts the applicable version of this
|
||||||
|
License or the recipients' rights hereunder. However, You may include
|
||||||
|
an additional document offering the additional rights described in
|
||||||
|
Section 3.5.
|
||||||
|
|
||||||
|
3.2. Availability of Source Code.
|
||||||
|
Any Modification which You create or to which You contribute must be
|
||||||
|
made available in Source Code form under the terms of this License
|
||||||
|
either on the same media as an Executable version or via an accepted
|
||||||
|
Electronic Distribution Mechanism to anyone to whom you made an
|
||||||
|
Executable version available; and if made available via Electronic
|
||||||
|
Distribution Mechanism, must remain available for at least twelve (12)
|
||||||
|
months after the date it initially became available, or at least six
|
||||||
|
(6) months after a subsequent version of that particular Modification
|
||||||
|
has been made available to such recipients. You are responsible for
|
||||||
|
ensuring that the Source Code version remains available even if the
|
||||||
|
Electronic Distribution Mechanism is maintained by a third party.
|
||||||
|
|
||||||
|
3.3. Description of Modifications.
|
||||||
|
You must cause all Covered Code to which You contribute to contain a
|
||||||
|
file documenting the changes You made to create that Covered Code and
|
||||||
|
the date of any change. You must include a prominent statement that
|
||||||
|
the Modification is derived, directly or indirectly, from Original
|
||||||
|
Code provided by the Initial Developer and including the name of the
|
||||||
|
Initial Developer in (a) the Source Code, and (b) in any notice in an
|
||||||
|
Executable version or related documentation in which You describe the
|
||||||
|
origin or ownership of the Covered Code.
|
||||||
|
|
||||||
|
3.4. Intellectual Property Matters
|
||||||
|
(a) Third Party Claims.
|
||||||
|
If Contributor has knowledge that a license under a third party's
|
||||||
|
intellectual property rights is required to exercise the rights
|
||||||
|
granted by such Contributor under Sections 2.1 or 2.2,
|
||||||
|
Contributor must include a text file with the Source Code
|
||||||
|
distribution titled "LEGAL" which describes the claim and the
|
||||||
|
party making the claim in sufficient detail that a recipient will
|
||||||
|
know whom to contact. If Contributor obtains such knowledge after
|
||||||
|
the Modification is made available as described in Section 3.2,
|
||||||
|
Contributor shall promptly modify the LEGAL file in all copies
|
||||||
|
Contributor makes available thereafter and shall take other steps
|
||||||
|
(such as notifying appropriate mailing lists or newsgroups)
|
||||||
|
reasonably calculated to inform those who received the Covered
|
||||||
|
Code that new knowledge has been obtained.
|
||||||
|
|
||||||
|
(b) Contributor APIs.
|
||||||
|
If Contributor's Modifications include an application programming
|
||||||
|
interface and Contributor has knowledge of patent licenses which
|
||||||
|
are reasonably necessary to implement that API, Contributor must
|
||||||
|
also include this information in the LEGAL file.
|
||||||
|
|
||||||
|
(c) Representations.
|
||||||
|
Contributor represents that, except as disclosed pursuant to
|
||||||
|
Section 3.4(a) above, Contributor believes that Contributor's
|
||||||
|
Modifications are Contributor's original creation(s) and/or
|
||||||
|
Contributor has sufficient rights to grant the rights conveyed by
|
||||||
|
this License.
|
||||||
|
|
||||||
|
3.5. Required Notices.
|
||||||
|
You must duplicate the notice in Exhibit A in each file of the Source
|
||||||
|
Code. If it is not possible to put such notice in a particular Source
|
||||||
|
Code file due to its structure, then You must include such notice in a
|
||||||
|
location (such as a relevant directory) where a user would be likely
|
||||||
|
to look for such a notice. If You created one or more Modification(s)
|
||||||
|
You may add your name as a Contributor to the notice described in
|
||||||
|
Exhibit A. You must also duplicate this License in any documentation
|
||||||
|
for the Source Code where You describe recipients' rights or ownership
|
||||||
|
rights relating to Covered Code. You may choose to offer, and to
|
||||||
|
charge a fee for, warranty, support, indemnity or liability
|
||||||
|
obligations to one or more recipients of Covered Code. However, You
|
||||||
|
may do so only on Your own behalf, and not on behalf of the Initial
|
||||||
|
Developer or any Contributor. You must make it absolutely clear than
|
||||||
|
any such warranty, support, indemnity or liability obligation is
|
||||||
|
offered by You alone, and You hereby agree to indemnify the Initial
|
||||||
|
Developer and every Contributor for any liability incurred by the
|
||||||
|
Initial Developer or such Contributor as a result of warranty,
|
||||||
|
support, indemnity or liability terms You offer.
|
||||||
|
|
||||||
|
3.6. Distribution of Executable Versions.
|
||||||
|
You may distribute Covered Code in Executable form only if the
|
||||||
|
requirements of Section 3.1-3.5 have been met for that Covered Code,
|
||||||
|
and if You include a notice stating that the Source Code version of
|
||||||
|
the Covered Code is available under the terms of this License,
|
||||||
|
including a description of how and where You have fulfilled the
|
||||||
|
obligations of Section 3.2. The notice must be conspicuously included
|
||||||
|
in any notice in an Executable version, related documentation or
|
||||||
|
collateral in which You describe recipients' rights relating to the
|
||||||
|
Covered Code. You may distribute the Executable version of Covered
|
||||||
|
Code or ownership rights under a license of Your choice, which may
|
||||||
|
contain terms different from this License, provided that You are in
|
||||||
|
compliance with the terms of this License and that the license for the
|
||||||
|
Executable version does not attempt to limit or alter the recipient's
|
||||||
|
rights in the Source Code version from the rights set forth in this
|
||||||
|
License. If You distribute the Executable version under a different
|
||||||
|
license You must make it absolutely clear that any terms which differ
|
||||||
|
from this License are offered by You alone, not by the Initial
|
||||||
|
Developer or any Contributor. You hereby agree to indemnify the
|
||||||
|
Initial Developer and every Contributor for any liability incurred by
|
||||||
|
the Initial Developer or such Contributor as a result of any such
|
||||||
|
terms You offer.
|
||||||
|
|
||||||
|
3.7. Larger Works.
|
||||||
|
You may create a Larger Work by combining Covered Code with other code
|
||||||
|
not governed by the terms of this License and distribute the Larger
|
||||||
|
Work as a single product. In such a case, You must make sure the
|
||||||
|
requirements of this License are fulfilled for the Covered Code.
|
||||||
|
|
||||||
|
4. Inability to Comply Due to Statute or Regulation.
|
||||||
|
|
||||||
|
If it is impossible for You to comply with any of the terms of this
|
||||||
|
License with respect to some or all of the Covered Code due to
|
||||||
|
statute, judicial order, or regulation then You must: (a) comply with
|
||||||
|
the terms of this License to the maximum extent possible; and (b)
|
||||||
|
describe the limitations and the code they affect. Such description
|
||||||
|
must be included in the LEGAL file described in Section 3.4 and must
|
||||||
|
be included with all distributions of the Source Code. Except to the
|
||||||
|
extent prohibited by statute or regulation, such description must be
|
||||||
|
sufficiently detailed for a recipient of ordinary skill to be able to
|
||||||
|
understand it.
|
||||||
|
|
||||||
|
5. Application of this License.
|
||||||
|
|
||||||
|
This License applies to code to which the Initial Developer has
|
||||||
|
attached the notice in Exhibit A and to related Covered Code.
|
||||||
|
|
||||||
|
6. Versions of the License.
|
||||||
|
|
||||||
|
6.1. New Versions.
|
||||||
|
Netscape Communications Corporation ("Netscape") may publish revised
|
||||||
|
and/or new versions of the License from time to time. Each version
|
||||||
|
will be given a distinguishing version number.
|
||||||
|
|
||||||
|
6.2. Effect of New Versions.
|
||||||
|
Once Covered Code has been published under a particular version of the
|
||||||
|
License, You may always continue to use it under the terms of that
|
||||||
|
version. You may also choose to use such Covered Code under the terms
|
||||||
|
of any subsequent version of the License published by Netscape. No one
|
||||||
|
other than Netscape has the right to modify the terms applicable to
|
||||||
|
Covered Code created under this License.
|
||||||
|
|
||||||
|
6.3. Derivative Works.
|
||||||
|
If You create or use a modified version of this License (which you may
|
||||||
|
only do in order to apply it to code which is not already Covered Code
|
||||||
|
governed by this License), You must (a) rename Your license so that
|
||||||
|
the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
|
||||||
|
"MPL", "NPL" or any confusingly similar phrase do not appear in your
|
||||||
|
license (except to note that your license differs from this License)
|
||||||
|
and (b) otherwise make it clear that Your version of the license
|
||||||
|
contains terms which differ from the Mozilla Public License and
|
||||||
|
Netscape Public License. (Filling in the name of the Initial
|
||||||
|
Developer, Original Code or Contributor in the notice described in
|
||||||
|
Exhibit A shall not of themselves be deemed to be modifications of
|
||||||
|
this License.)
|
||||||
|
|
||||||
|
7. DISCLAIMER OF WARRANTY.
|
||||||
|
|
||||||
|
COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||||
|
WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
|
||||||
|
DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
|
||||||
|
THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
|
||||||
|
IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
|
||||||
|
YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
|
||||||
|
COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
|
||||||
|
OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
|
||||||
|
ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
|
||||||
|
|
||||||
|
8. TERMINATION.
|
||||||
|
|
||||||
|
8.1. This License and the rights granted hereunder will terminate
|
||||||
|
automatically if You fail to comply with terms herein and fail to cure
|
||||||
|
such breach within 30 days of becoming aware of the breach. All
|
||||||
|
sublicenses to the Covered Code which are properly granted shall
|
||||||
|
survive any termination of this License. Provisions which, by their
|
||||||
|
nature, must remain in effect beyond the termination of this License
|
||||||
|
shall survive.
|
||||||
|
|
||||||
|
8.2. If You initiate litigation by asserting a patent infringement
|
||||||
|
claim (excluding declatory judgment actions) against Initial Developer
|
||||||
|
or a Contributor (the Initial Developer or Contributor against whom
|
||||||
|
You file such action is referred to as "Participant") alleging that:
|
||||||
|
|
||||||
|
(a) such Participant's Contributor Version directly or indirectly
|
||||||
|
infringes any patent, then any and all rights granted by such
|
||||||
|
Participant to You under Sections 2.1 and/or 2.2 of this License
|
||||||
|
shall, upon 60 days notice from Participant terminate prospectively,
|
||||||
|
unless if within 60 days after receipt of notice You either: (i)
|
||||||
|
agree in writing to pay Participant a mutually agreeable reasonable
|
||||||
|
royalty for Your past and future use of Modifications made by such
|
||||||
|
Participant, or (ii) withdraw Your litigation claim with respect to
|
||||||
|
the Contributor Version against such Participant. If within 60 days
|
||||||
|
of notice, a reasonable royalty and payment arrangement are not
|
||||||
|
mutually agreed upon in writing by the parties or the litigation claim
|
||||||
|
is not withdrawn, the rights granted by Participant to You under
|
||||||
|
Sections 2.1 and/or 2.2 automatically terminate at the expiration of
|
||||||
|
the 60 day notice period specified above.
|
||||||
|
|
||||||
|
(b) any software, hardware, or device, other than such Participant's
|
||||||
|
Contributor Version, directly or indirectly infringes any patent, then
|
||||||
|
any rights granted to You by such Participant under Sections 2.1(b)
|
||||||
|
and 2.2(b) are revoked effective as of the date You first made, used,
|
||||||
|
sold, distributed, or had made, Modifications made by that
|
||||||
|
Participant.
|
||||||
|
|
||||||
|
8.3. If You assert a patent infringement claim against Participant
|
||||||
|
alleging that such Participant's Contributor Version directly or
|
||||||
|
indirectly infringes any patent where such claim is resolved (such as
|
||||||
|
by license or settlement) prior to the initiation of patent
|
||||||
|
infringement litigation, then the reasonable value of the licenses
|
||||||
|
granted by such Participant under Sections 2.1 or 2.2 shall be taken
|
||||||
|
into account in determining the amount or value of any payment or
|
||||||
|
license.
|
||||||
|
|
||||||
|
8.4. In the event of termination under Sections 8.1 or 8.2 above,
|
||||||
|
all end user license agreements (excluding distributors and resellers)
|
||||||
|
which have been validly granted by You or any distributor hereunder
|
||||||
|
prior to termination shall survive termination.
|
||||||
|
|
||||||
|
9. LIMITATION OF LIABILITY.
|
||||||
|
|
||||||
|
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
|
||||||
|
(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
|
||||||
|
DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
|
||||||
|
OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
|
||||||
|
ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
|
||||||
|
CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
|
||||||
|
WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
|
||||||
|
COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
|
||||||
|
INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
|
||||||
|
LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
|
||||||
|
RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
|
||||||
|
PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
|
||||||
|
EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
|
||||||
|
THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
|
||||||
|
|
||||||
|
10. U.S. GOVERNMENT END USERS.
|
||||||
|
|
||||||
|
The Covered Code is a "commercial item," as that term is defined in
|
||||||
|
48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
|
||||||
|
software" and "commercial computer software documentation," as such
|
||||||
|
terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
|
||||||
|
C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
|
||||||
|
all U.S. Government End Users acquire Covered Code with only those
|
||||||
|
rights set forth herein.
|
||||||
|
|
||||||
|
11. MISCELLANEOUS.
|
||||||
|
|
||||||
|
This License represents the complete agreement concerning subject
|
||||||
|
matter hereof. If any provision of this License is held to be
|
||||||
|
unenforceable, such provision shall be reformed only to the extent
|
||||||
|
necessary to make it enforceable. This License shall be governed by
|
||||||
|
California law provisions (except to the extent applicable law, if
|
||||||
|
any, provides otherwise), excluding its conflict-of-law provisions.
|
||||||
|
With respect to disputes in which at least one party is a citizen of,
|
||||||
|
or an entity chartered or registered to do business in the United
|
||||||
|
States of America, any litigation relating to this License shall be
|
||||||
|
subject to the jurisdiction of the Federal Courts of the Northern
|
||||||
|
District of California, with venue lying in Santa Clara County,
|
||||||
|
California, with the losing party responsible for costs, including
|
||||||
|
without limitation, court costs and reasonable attorneys' fees and
|
||||||
|
expenses. The application of the United Nations Convention on
|
||||||
|
Contracts for the International Sale of Goods is expressly excluded.
|
||||||
|
Any law or regulation which provides that the language of a contract
|
||||||
|
shall be construed against the drafter shall not apply to this
|
||||||
|
License.
|
||||||
|
|
||||||
|
12. RESPONSIBILITY FOR CLAIMS.
|
||||||
|
|
||||||
|
As between Initial Developer and the Contributors, each party is
|
||||||
|
responsible for claims and damages arising, directly or indirectly,
|
||||||
|
out of its utilization of rights under this License and You agree to
|
||||||
|
work with Initial Developer and Contributors to distribute such
|
||||||
|
responsibility on an equitable basis. Nothing herein is intended or
|
||||||
|
shall be deemed to constitute any admission of liability.
|
||||||
|
|
||||||
|
13. MULTIPLE-LICENSED CODE.
|
||||||
|
|
||||||
|
Initial Developer may designate portions of the Covered Code as
|
||||||
|
"Multiple-Licensed". "Multiple-Licensed" means that the Initial
|
||||||
|
Developer permits you to utilize portions of the Covered Code under
|
||||||
|
Your choice of the NPL or the alternative licenses, if any, specified
|
||||||
|
by the Initial Developer in the file described in Exhibit A.
|
||||||
|
|
||||||
|
EXHIBIT A -Mozilla Public License.
|
||||||
|
|
||||||
|
``The contents of this file are subject to the Mozilla Public License
|
||||||
|
Version 1.1 (the "License"); you may not use this file except in
|
||||||
|
compliance with the License. You may obtain a copy of the License at
|
||||||
|
http://www.mozilla.org/MPL/
|
||||||
|
|
||||||
|
Software distributed under the License is distributed on an "AS IS"
|
||||||
|
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||||
|
License for the specific language governing rights and limitations
|
||||||
|
under the License.
|
||||||
|
|
||||||
|
The Original Code is ______________________________________.
|
||||||
|
|
||||||
|
The Initial Developer of the Original Code is ________________________.
|
||||||
|
Portions created by ______________________ are Copyright (C) ______
|
||||||
|
_______________________. All Rights Reserved.
|
||||||
|
|
||||||
|
Contributor(s): ______________________________________.
|
||||||
|
|
||||||
|
Alternatively, the contents of this file may be used under the terms
|
||||||
|
of the _____ license (the "[___] License"), in which case the
|
||||||
|
provisions of [______] License are applicable instead of those
|
||||||
|
above. If you wish to allow use of your version of this file only
|
||||||
|
under the terms of the [____] License and not to allow others to use
|
||||||
|
your version of this file under the MPL, indicate your decision by
|
||||||
|
deleting the provisions above and replace them with the notice and
|
||||||
|
other provisions required by the [___] License. If you do not delete
|
||||||
|
the provisions above, a recipient may use your version of this file
|
||||||
|
under either the MPL or the [___] License."
|
||||||
|
|
||||||
|
[NOTE: The text of this Exhibit A may differ slightly from the text of
|
||||||
|
the notices in the Source Code files of the Original Code. You should
|
||||||
|
use the text of this Exhibit A rather than the text found in the
|
||||||
|
Original Code Source Code for Your Modifications.]
|
||||||
|
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
|
@ -0,0 +1,202 @@
|
|||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
@ -0,0 +1,201 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
@ -0,0 +1,202 @@
|
|||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
Binary file not shown.
BIN
extensions/fablabchemnitz/dxf_dwg_importer/kabeja/lib/js.jar
Normal file
BIN
extensions/fablabchemnitz/dxf_dwg_importer/kabeja/lib/js.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
255532
extensions/fablabchemnitz/dxf_dwg_importer/kabeja/samples/dxf/draft1.dxf
Normal file
255532
extensions/fablabchemnitz/dxf_dwg_importer/kabeja/samples/dxf/draft1.dxf
Normal file
File diff suppressed because it is too large
Load Diff
118370
extensions/fablabchemnitz/dxf_dwg_importer/kabeja/samples/dxf/draft2.dxf
Normal file
118370
extensions/fablabchemnitz/dxf_dwg_importer/kabeja/samples/dxf/draft2.dxf
Normal file
File diff suppressed because it is too large
Load Diff
137444
extensions/fablabchemnitz/dxf_dwg_importer/kabeja/samples/dxf/draft3.dxf
Normal file
137444
extensions/fablabchemnitz/dxf_dwg_importer/kabeja/samples/dxf/draft3.dxf
Normal file
File diff suppressed because it is too large
Load Diff
77318
extensions/fablabchemnitz/dxf_dwg_importer/kabeja/samples/dxf/draft4.dxf
Normal file
77318
extensions/fablabchemnitz/dxf_dwg_importer/kabeja/samples/dxf/draft4.dxf
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
20
extensions/fablabchemnitz/dxf_dwg_importer/meta.json
Normal file
20
extensions/fablabchemnitz/dxf_dwg_importer/meta.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "DXF/DWG Importer",
|
||||||
|
"id": "fablabchemnitz.de.dxf_dwg_importer",
|
||||||
|
"path": "dxf_dwg_importer",
|
||||||
|
"dependent_extensions": null,
|
||||||
|
"original_name": "DXF/DWG Importer",
|
||||||
|
"original_id": "fablabchemnitz.de.dxf_dwg_importer",
|
||||||
|
"license": "GNU GPL v3",
|
||||||
|
"license_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.X/src/branch/master/LICENSE",
|
||||||
|
"comment": "Written by Mario Voigt",
|
||||||
|
"source_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.X/src/branch/master/extensions/fablabchemnitz/dxf_dwg_importer",
|
||||||
|
"fork_url": null,
|
||||||
|
"documentation_url": "https://stadtfabrikanten.org/pages/viewpage.action?pageId=78807535",
|
||||||
|
"inkscape_gallery_url": "https://inkscape.org/~MarioVoigt/%E2%98%85dxfdwg-importer",
|
||||||
|
"main_authors": [
|
||||||
|
"github.com/vmario89"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
BIN
extensions/fablabchemnitz/dxf_dwg_importer/node.exe
Normal file
BIN
extensions/fablabchemnitz/dxf_dwg_importer/node.exe
Normal file
Binary file not shown.
39
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/.eslintrc.json
generated
vendored
Normal file
39
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/.eslintrc.json
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"es6": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"extends": [
|
||||||
|
"plugin:react/recommended", "standard", "standard-react"
|
||||||
|
],
|
||||||
|
"globals": {
|
||||||
|
"Atomics": "readonly",
|
||||||
|
"SharedArrayBuffer": "readonly",
|
||||||
|
"describe": "readonly",
|
||||||
|
"it": "readonly",
|
||||||
|
"before": "readonly",
|
||||||
|
"after": "readonly",
|
||||||
|
"beforeEach": "readonly",
|
||||||
|
"afterEach": "readonly"
|
||||||
|
},
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaFeatures": {
|
||||||
|
"jsx": true
|
||||||
|
},
|
||||||
|
"ecmaVersion": 2018,
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"plugins": [
|
||||||
|
"react", "babel"
|
||||||
|
],
|
||||||
|
"parser": "babel-eslint",
|
||||||
|
"rules": {
|
||||||
|
"jest/valid-describe": 0
|
||||||
|
},
|
||||||
|
"settings": {
|
||||||
|
"react": {
|
||||||
|
"version": "detect"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
6
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/.travis.yml
generated
vendored
Normal file
6
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
language: node_js
|
||||||
|
node_js:
|
||||||
|
- "8"
|
||||||
|
- "10"
|
||||||
|
install: npm install
|
||||||
|
sudo: false
|
21
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/LICENSE
generated
vendored
Normal file
21
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2014-2018 Ben Nortier
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
126
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/README.md
generated
vendored
Normal file
126
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/README.md
generated
vendored
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
[![Build Status](https://travis-ci.org/bjnortier/dxf.svg?branch=master)](https://travis-ci.org/bjnortier/dxf)
|
||||||
|
|
||||||
|
# dxf
|
||||||
|
|
||||||
|
DXF parser for node/browser.
|
||||||
|
|
||||||
|
Uses several ES6 features in the source code (import, classes, let, const, arrows) but is packaged using babel so you can use it legacy JS environments.
|
||||||
|
|
||||||
|
Version 2.0 is a complete rewrite from the first attempt to write it in a SAX style, which wasn't really appropriate for a document with nested references (e.g inserts referencing blocks, nested inserts).
|
||||||
|
|
||||||
|
Version 3.0 converted the codebase to use [standard JS](https://standardjs.com), ES6 imports, stopped using Gulp, and updated & removed some dependencies.
|
||||||
|
|
||||||
|
Version 4.x is in progress and the aim is to use native SVG elements where possible, e.g. `<circle />`, `<ellipse />` etc. 4.0 introduces the `<circle />` element.
|
||||||
|
|
||||||
|
At this point in time, the important geometric entities are supported, but notably:
|
||||||
|
|
||||||
|
* MTEXT
|
||||||
|
* DIMENSION
|
||||||
|
* STYLE
|
||||||
|
* HATCH
|
||||||
|
|
||||||
|
and some others are **parsed**, but are **not supported for SVG rendering** (see section below on SVG rendering)
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
|
||||||
|
There is an ES5 and ES6 example in the ```examples/``` directory that show how to use the library. There are exposed functions for advanced users, but for the majority of users you can use the `Helper` object to get the data you're interested in (or convert to SVG):
|
||||||
|
|
||||||
|
```
|
||||||
|
const helper = new Helper(<DXF String>)
|
||||||
|
|
||||||
|
// The 1-to-1 object representation of the DXF
|
||||||
|
console.log('parsed:', helper.parsed)
|
||||||
|
|
||||||
|
// Denormalised blocks inserted with transforms applied
|
||||||
|
console.log('denormalised:', helper.denormalised)
|
||||||
|
|
||||||
|
// Create an SVG
|
||||||
|
console.log('svg:', helper.toSVG())
|
||||||
|
|
||||||
|
// Create polylines (e.g. to render in WebGL)
|
||||||
|
console.log('polylines:', helper.toPolylines())
|
||||||
|
```
|
||||||
|
|
||||||
|
## Running the Examples
|
||||||
|
|
||||||
|
Node ES5. Will write an SVG to `examples/example.es5.svg`:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ node examples/example.es5.js
|
||||||
|
```
|
||||||
|
|
||||||
|
Node ES6. Will write an SVG to `examples/example.es6.svg`:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npx babel-node examples/example.es6.js
|
||||||
|
```
|
||||||
|
|
||||||
|
Browser. Compile to a browser bundle and open the example webpage:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm run compile
|
||||||
|
$ open examples/dxf.html
|
||||||
|
```
|
||||||
|
|
||||||
|
## SVG
|
||||||
|
|
||||||
|
Geometric elements are supported, but dimensions, text, hatches and styles (except for line colors) are ***not***.
|
||||||
|
|
||||||
|
Native SVG elements are used as far as possible for curved entities (`<circle />`, `<ellipse/>` etc.), ***except for the SPLINE entity***, which is interpolated.
|
||||||
|
|
||||||
|
Here's an example you will find in the functional test output:
|
||||||
|
|
||||||
|
![svg example image](https://cloud.githubusercontent.com/assets/57994/17583566/e00f5d78-5fb1-11e6-9030-55686f980e6f.png)
|
||||||
|
|
||||||
|
## Interpolation
|
||||||
|
|
||||||
|
The library supports outputting DXFs as interpolated polylines for custom rendering (e.g. WebGL) or other applications, by using:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
> helper.toPolylines()
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Command line
|
||||||
|
|
||||||
|
There is a command-line utility (courtesy of [@Joge97](https://github.com/Joge97)) for converting DXF files to SVG:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm i -g dxf
|
||||||
|
$ dxf-to-svg
|
||||||
|
|
||||||
|
Usage: dxf-to-svg [options] <dxfFile> [svgFile]
|
||||||
|
|
||||||
|
Converts a dxf file to a svg file.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
|
||||||
|
-V, --version output the version number
|
||||||
|
-v --verbose Verbose output
|
||||||
|
-h, --help output usage information
|
||||||
|
```
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
|
||||||
|
Running
|
||||||
|
|
||||||
|
```$ npm test```
|
||||||
|
|
||||||
|
will execute the unit tests.
|
||||||
|
|
||||||
|
```$ npm run test:functional``` will run the functional tests in a browser. Please open `toSVG.html` when the file listing loads in the browser (or open `http://localhost:8030/toSVG.html#/`).
|
||||||
|
|
||||||
|
### Contributors
|
||||||
|
|
||||||
|
- Liam Mitchell https://github.com/LiamKarlMitchell
|
||||||
|
- Artur Zochniak https://github.com/arjamizo
|
||||||
|
- Andy Werner https://github.com/Gallore
|
||||||
|
- Ivan Baktsheev https://github.com/apla
|
||||||
|
- Jeff Chen https://github.com/jeffontheground
|
||||||
|
- Markko Paas https://github.com/markkopaas
|
||||||
|
- Kim Lokøy https://github.com/klokoy
|
||||||
|
- Erik Söhnel https://github.com/hoeck
|
||||||
|
- Teja https://github.com/hungerpirat
|
||||||
|
- Jakob Pallhuber https://github.com/Joge97
|
||||||
|
- Eric Mansfield https://github.com/ericman314
|
41
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/RELEASE.md
generated
vendored
Normal file
41
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/RELEASE.md
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
4.3.0
|
||||||
|
- #51 Fix bug when transforming empty bounding box
|
||||||
|
|
||||||
|
4.2.4
|
||||||
|
- #50 Fix knot piecewise beziers
|
||||||
|
|
||||||
|
4.2.3
|
||||||
|
- More accurate bounding boxes for arcs and ellipses (#48)
|
||||||
|
|
||||||
|
4.2.2
|
||||||
|
- Bump eslint-utils from 1.3.1 to 1.4.2
|
||||||
|
- Add HATCH to unsupported SVG entities in README
|
||||||
|
|
||||||
|
4.2.1
|
||||||
|
- Use main lodash package due to security issue(s)
|
||||||
|
|
||||||
|
4.2.0
|
||||||
|
- README updates
|
||||||
|
|
||||||
|
4.1.1
|
||||||
|
- #issue42 support entities that have extrusionZ === -1 defined on the entity itself (as opposed to the transform).
|
||||||
|
|
||||||
|
4.1.0
|
||||||
|
- CIRCLE DXF entities now produce native <circle /> SVG elements.
|
||||||
|
- ELLIPSE DXF entities now produce native <path d="A..."/> or <ellipse /> SVG elements.
|
||||||
|
- ARC DXF entities now produce native <path d="A..."/> or <ellipse /> SVG elements.
|
||||||
|
|
||||||
|
4.0.1
|
||||||
|
- Browser example uses Helper
|
||||||
|
|
||||||
|
4.0.0
|
||||||
|
- Use ES6 string interpolation in SVG generation.
|
||||||
|
- Use native SVG <circle /> elements for CIRCLE entities.
|
||||||
|
- Use SVG <g/> elements with a transform attribute for native and interpolated entities.
|
||||||
|
- Add a Helper object to simplify the workflow.
|
||||||
|
- The SVG output uses a root transform to flip the Y coordinates.
|
||||||
|
|
||||||
|
3.6.0
|
||||||
|
- NPM audit fixes.
|
||||||
|
- Remove support for Node v6 in Travis.
|
||||||
|
- Node engine is now >= 8.9.0.
|
21602
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/dist/dxf.js
generated
vendored
Normal file
21602
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/dist/dxf.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
36
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/examples/dxf.html
generated
vendored
Normal file
36
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/examples/dxf.html
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang='en'>
|
||||||
|
<head>
|
||||||
|
<meta charset='UTF-8'>
|
||||||
|
<title>DXF Browser Example</title>
|
||||||
|
<script src='https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.2/require.min.js'></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<input type='file' id='file'/>
|
||||||
|
<div>Number of entities:<span id='numberOfEntities'>-</span></div>
|
||||||
|
<div id="svg"></div>
|
||||||
|
<script>
|
||||||
|
var numberOfEntities = document.getElementById('numberOfEntities')
|
||||||
|
var svgContainer = document.getElementById('svg')
|
||||||
|
var fileInput = document.getElementById('file')
|
||||||
|
window.requirejs(['../dist/dxf'], function(dxf) {
|
||||||
|
dxf.config.verbose = true
|
||||||
|
fileInput.addEventListener('change', function(event) {
|
||||||
|
var file = event.target.files[0]
|
||||||
|
var reader = new FileReader()
|
||||||
|
numberOfEntities.innerHTML = 'reading...'
|
||||||
|
reader.onload = function(e) {
|
||||||
|
if (e.target.readyState === 2) {
|
||||||
|
var dxfContents = e.target.result
|
||||||
|
var helper = new dxf.Helper(dxfContents)
|
||||||
|
numberOfEntities.innerHTML = helper.denormalised.length
|
||||||
|
const svg = helper.toSVG()
|
||||||
|
svgContainer.innerHTML = svg
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reader.readAsBinaryString(file)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
29
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/examples/example.es5.js
generated
vendored
Normal file
29
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/examples/example.es5.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
const fs = require('fs')
|
||||||
|
const join = require('path').join
|
||||||
|
|
||||||
|
const Helper = require('..').Helper
|
||||||
|
|
||||||
|
const helper = new Helper(fs.readFileSync(
|
||||||
|
'./test/resources/Ceco.NET-Architecture-Tm-53.dxf', 'utf-8'))
|
||||||
|
|
||||||
|
// The parsed entities
|
||||||
|
const { blocks, entities } = helper.parsed
|
||||||
|
console.log(`parsed: ${blocks.length} blocks, ${entities.length} entities.\n`)
|
||||||
|
|
||||||
|
// Denormalised blocks inserted with transforms applied
|
||||||
|
console.log(`denormalised: ${helper.denormalised.length} entities.\n`)
|
||||||
|
|
||||||
|
// Group entities by layer. Returns an object with layer names as
|
||||||
|
// keys to arrays of entities.
|
||||||
|
const groups = helper.groups
|
||||||
|
console.log('grouped entities')
|
||||||
|
console.log('----------------')
|
||||||
|
Object.keys(groups).forEach(layer => {
|
||||||
|
console.log(`${layer}: ${groups[layer].length}`)
|
||||||
|
})
|
||||||
|
console.log('\n')
|
||||||
|
|
||||||
|
// Write the SVG
|
||||||
|
const svg = helper.toSVG()
|
||||||
|
fs.writeFileSync(join(__dirname, '/example.es5.svg'), svg, 'utf-8')
|
||||||
|
console.log('SVG written')
|
29
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/examples/example.es6.js
generated
vendored
Normal file
29
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/examples/example.es6.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import fs from 'fs'
|
||||||
|
import { join } from 'path'
|
||||||
|
|
||||||
|
import { Helper } from '../src'
|
||||||
|
|
||||||
|
const helper = new Helper(fs.readFileSync(
|
||||||
|
'./test/resources/Ceco.NET-Architecture-Tm-53.dxf', 'utf-8'))
|
||||||
|
|
||||||
|
// The parsed entities
|
||||||
|
const { blocks, entities } = helper.parsed
|
||||||
|
console.log(`parsed: ${blocks.length} blocks, ${entities.length} entities.\n`)
|
||||||
|
|
||||||
|
// Denormalised blocks inserted with transforms applied
|
||||||
|
console.log(`denormalised: ${helper.denormalised.length} entities.\n`)
|
||||||
|
|
||||||
|
// Group entities by layer. Returns an object with layer names as
|
||||||
|
// keys to arrays of entities.
|
||||||
|
const groups = helper.groups
|
||||||
|
console.log('grouped entities')
|
||||||
|
console.log('----------------')
|
||||||
|
Object.keys(groups).forEach(layer => {
|
||||||
|
console.log(`${layer}: ${groups[layer].length}`)
|
||||||
|
})
|
||||||
|
console.log('\n')
|
||||||
|
|
||||||
|
// Write the SVG
|
||||||
|
const svg = helper.toSVG()
|
||||||
|
fs.writeFileSync(join(__dirname, '/example.es6.svg'), svg, 'utf-8')
|
||||||
|
console.log('SVG written')
|
106
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/Helper.js
generated
vendored
Normal file
106
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/Helper.js
generated
vendored
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = void 0;
|
||||||
|
|
||||||
|
var _logger = _interopRequireDefault(require("./util/logger"));
|
||||||
|
|
||||||
|
var _parseString = _interopRequireDefault(require("./parseString"));
|
||||||
|
|
||||||
|
var _denormalise2 = _interopRequireDefault(require("./denormalise"));
|
||||||
|
|
||||||
|
var _toSVG2 = _interopRequireDefault(require("./toSVG"));
|
||||||
|
|
||||||
|
var _toPolylines2 = _interopRequireDefault(require("./toPolylines"));
|
||||||
|
|
||||||
|
var _groupEntitiesByLayer = _interopRequireDefault(require("./groupEntitiesByLayer"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||||
|
|
||||||
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||||
|
|
||||||
|
var Helper = /*#__PURE__*/function () {
|
||||||
|
function Helper(contents) {
|
||||||
|
_classCallCheck(this, Helper);
|
||||||
|
|
||||||
|
if (!(typeof contents === 'string')) {
|
||||||
|
throw Error('Helper constructor expects a DXF string');
|
||||||
|
}
|
||||||
|
|
||||||
|
this._contents = contents;
|
||||||
|
this._parsed = null;
|
||||||
|
this._denormalised = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
_createClass(Helper, [{
|
||||||
|
key: "parse",
|
||||||
|
value: function parse() {
|
||||||
|
this._parsed = (0, _parseString["default"])(this._contents);
|
||||||
|
|
||||||
|
_logger["default"].info('parsed:', this.parsed);
|
||||||
|
|
||||||
|
return this._parsed;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "denormalise",
|
||||||
|
value: function denormalise() {
|
||||||
|
this._denormalised = (0, _denormalise2["default"])(this.parsed);
|
||||||
|
|
||||||
|
_logger["default"].info('denormalised:', this._denormalised);
|
||||||
|
|
||||||
|
return this._denormalised;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "group",
|
||||||
|
value: function group() {
|
||||||
|
this._groups = (0, _groupEntitiesByLayer["default"])(this.denormalised);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "toSVG",
|
||||||
|
value: function toSVG() {
|
||||||
|
return (0, _toSVG2["default"])(this.parsed);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "toPolylines",
|
||||||
|
value: function toPolylines() {
|
||||||
|
return (0, _toPolylines2["default"])(this.parsed);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "parsed",
|
||||||
|
get: function get() {
|
||||||
|
if (this._parsed === null) {
|
||||||
|
this.parse();
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._parsed;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "denormalised",
|
||||||
|
get: function get() {
|
||||||
|
if (!this._denormalised) {
|
||||||
|
this.denormalise();
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._denormalised;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "groups",
|
||||||
|
get: function get() {
|
||||||
|
if (!this._groups) {
|
||||||
|
this.group();
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._groups;
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
|
return Helper;
|
||||||
|
}();
|
||||||
|
|
||||||
|
exports["default"] = Helper;
|
54
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/applyTransforms.js
generated
vendored
Normal file
54
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/applyTransforms.js
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = void 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply the transforms to the polyline.
|
||||||
|
*
|
||||||
|
* @param polyline the polyline
|
||||||
|
* @param transform the transforms array
|
||||||
|
* @returns the transformed polyline
|
||||||
|
*/
|
||||||
|
var _default = function _default(polyline, transforms) {
|
||||||
|
transforms.forEach(function (transform) {
|
||||||
|
polyline = polyline.map(function (p) {
|
||||||
|
// Use a copy to avoid side effects
|
||||||
|
var p2 = [p[0], p[1]];
|
||||||
|
|
||||||
|
if (transform.scaleX) {
|
||||||
|
p2[0] = p2[0] * transform.scaleX;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (transform.scaleY) {
|
||||||
|
p2[1] = p2[1] * transform.scaleY;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (transform.rotation) {
|
||||||
|
var angle = transform.rotation / 180 * Math.PI;
|
||||||
|
p2 = [p2[0] * Math.cos(angle) - p2[1] * Math.sin(angle), p2[1] * Math.cos(angle) + p2[0] * Math.sin(angle)];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (transform.x) {
|
||||||
|
p2[0] = p2[0] + transform.x;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (transform.y) {
|
||||||
|
p2[1] = p2[1] + transform.y;
|
||||||
|
} // Observed once in a sample DXF - some cad applications
|
||||||
|
// use negative extruxion Z for flipping
|
||||||
|
|
||||||
|
|
||||||
|
if (transform.extrusionZ === -1) {
|
||||||
|
p2[0] = -p2[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return p2;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return polyline;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports["default"] = _default;
|
28
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/cli.js
generated
vendored
Normal file
28
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/cli.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var _commander = _interopRequireDefault(require("commander"));
|
||||||
|
|
||||||
|
var _fs = _interopRequireDefault(require("fs"));
|
||||||
|
|
||||||
|
var _ = require("./");
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
|
_commander["default"].version(require('../package.json').version).description('Converts a dxf file to a svg file.').arguments('<dxfFile> [svgFile]').option('-v --verbose', 'Verbose output').action(function (dxfFile, svgFile, options) {
|
||||||
|
var parsed = (0, _.parseString)(_fs["default"].readFileSync(dxfFile, 'utf-8'));
|
||||||
|
|
||||||
|
if (options.verbose) {
|
||||||
|
var groups = (0, _.groupEntitiesByLayer)((0, _.denormalise)(parsed));
|
||||||
|
console.log('[layer : number of entities]');
|
||||||
|
Object.keys(groups).forEach(function (layer) {
|
||||||
|
console.log("".concat(layer, " : ").concat(groups[layer].length));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_fs["default"].writeFileSync(svgFile || "".concat(dxfFile.split('.').slice(0, -1).join('.'), ".svg"), (0, _.toSVG)(parsed), 'utf-8');
|
||||||
|
}).parse(process.argv);
|
||||||
|
|
||||||
|
if (!process.argv.slice(2).length) {
|
||||||
|
_commander["default"].help();
|
||||||
|
}
|
10
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/config.js
generated
vendored
Normal file
10
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/config.js
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = void 0;
|
||||||
|
var _default = {
|
||||||
|
verbose: false
|
||||||
|
};
|
||||||
|
exports["default"] = _default;
|
14
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/constants.js
generated
vendored
Normal file
14
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/constants.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.ZERO_TRANSFORM = void 0;
|
||||||
|
var ZERO_TRANSFORM = {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
xScale: 1,
|
||||||
|
yScale: 1,
|
||||||
|
rotation: 0
|
||||||
|
};
|
||||||
|
exports.ZERO_TRANSFORM = ZERO_TRANSFORM;
|
160
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/denormalise.js
generated
vendored
Normal file
160
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/denormalise.js
generated
vendored
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = void 0;
|
||||||
|
|
||||||
|
var _lodash = require("lodash");
|
||||||
|
|
||||||
|
var _logger = _interopRequireDefault(require("./util/logger"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||||
|
|
||||||
|
var _default = function _default(parseResult) {
|
||||||
|
var blocksByName = parseResult.blocks.reduce(function (acc, b) {
|
||||||
|
acc[b.name] = b;
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
var gatherEntities = function gatherEntities(entities, transforms) {
|
||||||
|
var current = [];
|
||||||
|
entities.forEach(function (e) {
|
||||||
|
if (e.type === 'INSERT') {
|
||||||
|
var _ret = function () {
|
||||||
|
var _insert$rowCount, _insert$columnCount, _insert$rowSpacing, _insert$columnSpacing, _insert$rotation;
|
||||||
|
|
||||||
|
var insert = e;
|
||||||
|
var block = blocksByName[insert.block];
|
||||||
|
|
||||||
|
if (!block) {
|
||||||
|
_logger["default"].error('no block found for insert. block:', insert.block);
|
||||||
|
|
||||||
|
return {
|
||||||
|
v: void 0
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var rowCount = (_insert$rowCount = insert.rowCount) !== null && _insert$rowCount !== void 0 ? _insert$rowCount : 1;
|
||||||
|
var columnCount = (_insert$columnCount = insert.columnCount) !== null && _insert$columnCount !== void 0 ? _insert$columnCount : 1;
|
||||||
|
var rowSpacing = (_insert$rowSpacing = insert.rowSpacing) !== null && _insert$rowSpacing !== void 0 ? _insert$rowSpacing : 0;
|
||||||
|
var columnSpacing = (_insert$columnSpacing = insert.columnSpacing) !== null && _insert$columnSpacing !== void 0 ? _insert$columnSpacing : 0;
|
||||||
|
var rotation = (_insert$rotation = insert.rotation) !== null && _insert$rotation !== void 0 ? _insert$rotation : 0; // It appears that the rectangular array is affected by rotation, but NOT by scale.
|
||||||
|
|
||||||
|
var rowVec, colVec;
|
||||||
|
|
||||||
|
if (rowCount > 1 || columnCount > 1) {
|
||||||
|
var cos = Math.cos(rotation * Math.PI / 180);
|
||||||
|
var sin = Math.sin(rotation * Math.PI / 180);
|
||||||
|
rowVec = {
|
||||||
|
x: -sin * rowSpacing,
|
||||||
|
y: cos * rowSpacing
|
||||||
|
};
|
||||||
|
colVec = {
|
||||||
|
x: cos * columnSpacing,
|
||||||
|
y: sin * columnSpacing
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
rowVec = {
|
||||||
|
x: 0,
|
||||||
|
y: 0
|
||||||
|
};
|
||||||
|
colVec = {
|
||||||
|
x: 0,
|
||||||
|
y: 0
|
||||||
|
};
|
||||||
|
} // For rectangular arrays, add the block entities for each location in the array
|
||||||
|
|
||||||
|
|
||||||
|
for (var r = 0; r < rowCount; r++) {
|
||||||
|
for (var c = 0; c < columnCount; c++) {
|
||||||
|
// Adjust insert transform by row and column for rectangular arrays
|
||||||
|
var t = {
|
||||||
|
x: insert.x + rowVec.x * r + colVec.x * c,
|
||||||
|
y: insert.y + rowVec.y * r + colVec.y * c,
|
||||||
|
scaleX: insert.scaleX,
|
||||||
|
scaleY: insert.scaleY,
|
||||||
|
scaleZ: insert.scaleZ,
|
||||||
|
extrusionX: insert.extrusionX,
|
||||||
|
extrusionY: insert.extrusionY,
|
||||||
|
extrusionZ: insert.extrusionZ,
|
||||||
|
rotation: insert.rotation
|
||||||
|
}; // Add the insert transform and recursively add entities
|
||||||
|
|
||||||
|
var transforms2 = transforms.slice(0);
|
||||||
|
transforms2.push(t); // Use the insert layer
|
||||||
|
|
||||||
|
var blockEntities = block.entities.map(function (be) {
|
||||||
|
var be2 = (0, _lodash.cloneDeep)(be);
|
||||||
|
be2.layer = insert.layer; // https://github.com/bjnortier/dxf/issues/52
|
||||||
|
// See Issue 52. If we don't modify the
|
||||||
|
// entity coordinates here it creates an issue with the
|
||||||
|
// transformation matrices (which are only applied AFTER
|
||||||
|
// block insertion modifications has been applied).
|
||||||
|
|
||||||
|
switch (be2.type) {
|
||||||
|
case 'LINE':
|
||||||
|
{
|
||||||
|
be2.start.x -= block.x;
|
||||||
|
be2.start.y -= block.y;
|
||||||
|
be2.end.x -= block.x;
|
||||||
|
be2.end.y -= block.y;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'LWPOLYLINE':
|
||||||
|
case 'POLYLINE':
|
||||||
|
{
|
||||||
|
be2.vertices.forEach(function (v) {
|
||||||
|
v.x -= block.x;
|
||||||
|
v.y -= block.y;
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'CIRCLE':
|
||||||
|
case 'ELLIPSE':
|
||||||
|
case 'ARC':
|
||||||
|
{
|
||||||
|
be2.x -= block.x;
|
||||||
|
be2.y -= block.y;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'SPLINE':
|
||||||
|
{
|
||||||
|
be2.controlPoints.forEach(function (cp) {
|
||||||
|
cp.x -= block.x;
|
||||||
|
cp.y -= block.y;
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return be2;
|
||||||
|
});
|
||||||
|
current = current.concat(gatherEntities(blockEntities, transforms2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
|
if (_typeof(_ret) === "object") return _ret.v;
|
||||||
|
} else {
|
||||||
|
// Top-level entity. Clone and add the transforms
|
||||||
|
// The transforms are reversed so they occur in
|
||||||
|
// order of application - i.e. the transform of the
|
||||||
|
// top-level insert is applied last
|
||||||
|
var e2 = (0, _lodash.cloneDeep)(e);
|
||||||
|
e2.transforms = transforms.slice().reverse();
|
||||||
|
current.push(e2);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return current;
|
||||||
|
};
|
||||||
|
|
||||||
|
return gatherEntities(parseResult.entities, []);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports["default"] = _default;
|
205
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/entityToPolyline.js
generated
vendored
Normal file
205
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/entityToPolyline.js
generated
vendored
Normal file
@ -0,0 +1,205 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = exports.interpolateBSpline = void 0;
|
||||||
|
|
||||||
|
var _bSpline = _interopRequireDefault(require("./util/bSpline"));
|
||||||
|
|
||||||
|
var _logger = _interopRequireDefault(require("./util/logger"));
|
||||||
|
|
||||||
|
var _createArcForLWPolyline = _interopRequireDefault(require("./util/createArcForLWPolyline"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotate a set of points.
|
||||||
|
*
|
||||||
|
* @param points the points
|
||||||
|
* @param angle the rotation angle
|
||||||
|
*/
|
||||||
|
var rotate = function rotate(points, angle) {
|
||||||
|
return points.map(function (p) {
|
||||||
|
return [p[0] * Math.cos(angle) - p[1] * Math.sin(angle), p[1] * Math.cos(angle) + p[0] * Math.sin(angle)];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Interpolate an ellipse
|
||||||
|
* @param cx center X
|
||||||
|
* @param cy center Y
|
||||||
|
* @param rx radius X
|
||||||
|
* @param ry radius Y
|
||||||
|
* @param start start angle in radians
|
||||||
|
* @param start end angle in radians
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
var interpolateEllipse = function interpolateEllipse(cx, cy, rx, ry, start, end, rotationAngle) {
|
||||||
|
if (end < start) {
|
||||||
|
end += Math.PI * 2;
|
||||||
|
} // ----- Relative points -----
|
||||||
|
// Start point
|
||||||
|
|
||||||
|
|
||||||
|
var points = [];
|
||||||
|
var dTheta = Math.PI * 2 / 72;
|
||||||
|
var EPS = 1e-6;
|
||||||
|
|
||||||
|
for (var theta = start; theta < end - EPS; theta += dTheta) {
|
||||||
|
points.push([Math.cos(theta) * rx, Math.sin(theta) * ry]);
|
||||||
|
}
|
||||||
|
|
||||||
|
points.push([Math.cos(end) * rx, Math.sin(end) * ry]); // ----- Rotate -----
|
||||||
|
|
||||||
|
if (rotationAngle) {
|
||||||
|
points = rotate(points, rotationAngle);
|
||||||
|
} // ----- Offset center -----
|
||||||
|
|
||||||
|
|
||||||
|
points = points.map(function (p) {
|
||||||
|
return [cx + p[0], cy + p[1]];
|
||||||
|
});
|
||||||
|
return points;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Interpolate a b-spline. The algorithm examins the knot vector
|
||||||
|
* to create segments for interpolation. The parameterisation value
|
||||||
|
* is re-normalised back to [0,1] as that is what the lib expects (
|
||||||
|
* and t i de-normalised in the b-spline library)
|
||||||
|
*
|
||||||
|
* @param controlPoints the control points
|
||||||
|
* @param degree the b-spline degree
|
||||||
|
* @param knots the knot vector
|
||||||
|
* @returns the polyline
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
var interpolateBSpline = function interpolateBSpline(controlPoints, degree, knots, interpolationsPerSplineSegment) {
|
||||||
|
var polyline = [];
|
||||||
|
var controlPointsForLib = controlPoints.map(function (p) {
|
||||||
|
return [p.x, p.y];
|
||||||
|
});
|
||||||
|
var segmentTs = [knots[degree]];
|
||||||
|
var domain = [knots[degree], knots[knots.length - 1 - degree]];
|
||||||
|
|
||||||
|
for (var k = degree + 1; k < knots.length - degree; ++k) {
|
||||||
|
if (segmentTs[segmentTs.length - 1] !== knots[k]) {
|
||||||
|
segmentTs.push(knots[k]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interpolationsPerSplineSegment = interpolationsPerSplineSegment || 25;
|
||||||
|
|
||||||
|
for (var i = 1; i < segmentTs.length; ++i) {
|
||||||
|
var uMin = segmentTs[i - 1];
|
||||||
|
var uMax = segmentTs[i];
|
||||||
|
|
||||||
|
for (var _k = 0; _k <= interpolationsPerSplineSegment; ++_k) {
|
||||||
|
var u = _k / interpolationsPerSplineSegment * (uMax - uMin) + uMin; // Clamp t to 0, 1 to handle numerical precision issues
|
||||||
|
|
||||||
|
var t = (u - domain[0]) / (domain[1] - domain[0]);
|
||||||
|
t = Math.max(t, 0);
|
||||||
|
t = Math.min(t, 1);
|
||||||
|
var p = (0, _bSpline["default"])(t, degree, controlPointsForLib, knots);
|
||||||
|
polyline.push(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return polyline;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Convert a parsed DXF entity to a polyline. These can be used to render the
|
||||||
|
* the DXF in SVG, Canvas, WebGL etc., without depending on native support
|
||||||
|
* of primitive objects (ellispe, spline etc.)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
exports.interpolateBSpline = interpolateBSpline;
|
||||||
|
|
||||||
|
var _default = function _default(entity, options) {
|
||||||
|
options = options || {};
|
||||||
|
var polyline;
|
||||||
|
|
||||||
|
if (entity.type === 'LINE') {
|
||||||
|
polyline = [[entity.start.x, entity.start.y], [entity.end.x, entity.end.y]];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entity.type === 'LWPOLYLINE' || entity.type === 'POLYLINE') {
|
||||||
|
polyline = [];
|
||||||
|
|
||||||
|
if (entity.polygonMesh || entity.polyfaceMesh) {// Do not attempt to render meshes
|
||||||
|
} else if (entity.vertices.length) {
|
||||||
|
if (entity.closed) {
|
||||||
|
entity.vertices = entity.vertices.concat(entity.vertices[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0, il = entity.vertices.length; i < il - 1; ++i) {
|
||||||
|
var from = [entity.vertices[i].x, entity.vertices[i].y];
|
||||||
|
var to = [entity.vertices[i + 1].x, entity.vertices[i + 1].y];
|
||||||
|
polyline.push(from);
|
||||||
|
|
||||||
|
if (entity.vertices[i].bulge) {
|
||||||
|
polyline = polyline.concat((0, _createArcForLWPolyline["default"])(from, to, entity.vertices[i].bulge));
|
||||||
|
} // The last iteration of the for loop
|
||||||
|
|
||||||
|
|
||||||
|
if (i === il - 2) {
|
||||||
|
polyline.push(to);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_logger["default"].warn('Polyline entity with no vertices');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entity.type === 'CIRCLE') {
|
||||||
|
polyline = interpolateEllipse(entity.x, entity.y, entity.r, entity.r, 0, Math.PI * 2);
|
||||||
|
|
||||||
|
if (entity.extrusionZ === -1) {
|
||||||
|
polyline = polyline.map(function (p) {
|
||||||
|
return [-p[0], p[1]];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entity.type === 'ELLIPSE') {
|
||||||
|
var rx = Math.sqrt(entity.majorX * entity.majorX + entity.majorY * entity.majorY);
|
||||||
|
var ry = entity.axisRatio * rx;
|
||||||
|
var majorAxisRotation = -Math.atan2(-entity.majorY, entity.majorX);
|
||||||
|
polyline = interpolateEllipse(entity.x, entity.y, rx, ry, entity.startAngle, entity.endAngle, majorAxisRotation);
|
||||||
|
|
||||||
|
if (entity.extrusionZ === -1) {
|
||||||
|
polyline = polyline.map(function (p) {
|
||||||
|
return [-p[0], p[1]];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entity.type === 'ARC') {
|
||||||
|
// Why on earth DXF has degree start & end angles for arc,
|
||||||
|
// and radian start & end angles for ellipses is a mystery
|
||||||
|
polyline = interpolateEllipse(entity.x, entity.y, entity.r, entity.r, entity.startAngle, entity.endAngle, undefined, false); // I kid you not, ARCs and ELLIPSEs handle this differently,
|
||||||
|
// as evidenced by how AutoCAD actually renders these entities
|
||||||
|
|
||||||
|
if (entity.extrusionZ === -1) {
|
||||||
|
polyline = polyline.map(function (p) {
|
||||||
|
return [-p[0], p[1]];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entity.type === 'SPLINE') {
|
||||||
|
polyline = interpolateBSpline(entity.controlPoints, entity.degree, entity.knots, options.interpolationsPerSplineSegment);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!polyline) {
|
||||||
|
_logger["default"].warn('unsupported entity for converting to polyline:', entity.type);
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return polyline;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports["default"] = _default;
|
35
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/getRGBForEntity.js
generated
vendored
Normal file
35
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/getRGBForEntity.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = void 0;
|
||||||
|
|
||||||
|
var _colors = _interopRequireDefault(require("./util/colors"));
|
||||||
|
|
||||||
|
var _logger = _interopRequireDefault(require("./util/logger"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
|
var _default = function _default(layers, entity) {
|
||||||
|
var layerTable = layers[entity.layer];
|
||||||
|
|
||||||
|
if (layerTable) {
|
||||||
|
var colorNumber = 'colorNumber' in entity ? entity.colorNumber : layerTable.colorNumber;
|
||||||
|
var rgb = _colors["default"][colorNumber];
|
||||||
|
|
||||||
|
if (rgb) {
|
||||||
|
return rgb;
|
||||||
|
} else {
|
||||||
|
_logger["default"].warn('Color index', colorNumber, 'invalid, defaulting to black');
|
||||||
|
|
||||||
|
return [0, 0, 0];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_logger["default"].warn('no layer table for layer:' + entity.layer);
|
||||||
|
|
||||||
|
return [0, 0, 0];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports["default"] = _default;
|
21
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/groupEntitiesByLayer.js
generated
vendored
Normal file
21
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/groupEntitiesByLayer.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = void 0;
|
||||||
|
|
||||||
|
var _default = function _default(entities) {
|
||||||
|
return entities.reduce(function (acc, entity) {
|
||||||
|
var layer = entity.layer;
|
||||||
|
|
||||||
|
if (!acc[layer]) {
|
||||||
|
acc[layer] = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
acc[layer].push(entity);
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports["default"] = _default;
|
70
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/blocks.js
generated
vendored
Normal file
70
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/blocks.js
generated
vendored
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = void 0;
|
||||||
|
|
||||||
|
var _entities = _interopRequireDefault(require("./entities"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
|
var _default = function _default(tuples) {
|
||||||
|
var state;
|
||||||
|
var blocks = [];
|
||||||
|
var block;
|
||||||
|
var entitiesTuples = [];
|
||||||
|
tuples.forEach(function (tuple) {
|
||||||
|
var type = tuple[0];
|
||||||
|
var value = tuple[1];
|
||||||
|
|
||||||
|
if (value === 'BLOCK') {
|
||||||
|
state = 'block';
|
||||||
|
block = {};
|
||||||
|
entitiesTuples = [];
|
||||||
|
blocks.push(block);
|
||||||
|
} else if (value === 'ENDBLK') {
|
||||||
|
if (state === 'entities') {
|
||||||
|
block.entities = (0, _entities["default"])(entitiesTuples);
|
||||||
|
} else {
|
||||||
|
block.entities = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
entitiesTuples = undefined;
|
||||||
|
state = undefined;
|
||||||
|
} else if (state === 'block' && type !== 0) {
|
||||||
|
switch (type) {
|
||||||
|
case 1:
|
||||||
|
block.xref = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
block.name = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 10:
|
||||||
|
block.x = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 20:
|
||||||
|
block.y = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 30:
|
||||||
|
block.z = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (state === 'block' && type === 0) {
|
||||||
|
state = 'entities';
|
||||||
|
entitiesTuples.push(tuple);
|
||||||
|
} else if (state === 'entities') {
|
||||||
|
entitiesTuples.push(tuple);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return blocks;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports["default"] = _default;
|
91
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entities.js
generated
vendored
Normal file
91
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entities.js
generated
vendored
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = void 0;
|
||||||
|
|
||||||
|
var _logger = _interopRequireDefault(require("../util/logger"));
|
||||||
|
|
||||||
|
var _point = _interopRequireDefault(require("./entity/point"));
|
||||||
|
|
||||||
|
var _line = _interopRequireDefault(require("./entity/line"));
|
||||||
|
|
||||||
|
var _lwpolyline = _interopRequireDefault(require("./entity/lwpolyline"));
|
||||||
|
|
||||||
|
var _polyline = _interopRequireDefault(require("./entity/polyline"));
|
||||||
|
|
||||||
|
var _vertex = _interopRequireDefault(require("./entity/vertex"));
|
||||||
|
|
||||||
|
var _circle = _interopRequireDefault(require("./entity/circle"));
|
||||||
|
|
||||||
|
var _arc = _interopRequireDefault(require("./entity/arc"));
|
||||||
|
|
||||||
|
var _ellipse = _interopRequireDefault(require("./entity/ellipse"));
|
||||||
|
|
||||||
|
var _spline = _interopRequireDefault(require("./entity/spline"));
|
||||||
|
|
||||||
|
var _solid = _interopRequireDefault(require("./entity/solid"));
|
||||||
|
|
||||||
|
var _mtext = _interopRequireDefault(require("./entity/mtext"));
|
||||||
|
|
||||||
|
var _insert = _interopRequireDefault(require("./entity/insert"));
|
||||||
|
|
||||||
|
var _threeDFace = _interopRequireDefault(require("./entity/threeDFace"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
|
var handlers = [_point["default"], _line["default"], _lwpolyline["default"], _polyline["default"], _vertex["default"], _circle["default"], _arc["default"], _ellipse["default"], _spline["default"], _solid["default"], _mtext["default"], _insert["default"], _threeDFace["default"]].reduce(function (acc, mod) {
|
||||||
|
acc[mod.TYPE] = mod;
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
var _default = function _default(tuples) {
|
||||||
|
var entities = [];
|
||||||
|
var entityGroups = [];
|
||||||
|
var currentEntityTuples; // First group them together for easy processing
|
||||||
|
|
||||||
|
tuples.forEach(function (tuple) {
|
||||||
|
var type = tuple[0];
|
||||||
|
|
||||||
|
if (type === 0) {
|
||||||
|
currentEntityTuples = [];
|
||||||
|
entityGroups.push(currentEntityTuples);
|
||||||
|
}
|
||||||
|
|
||||||
|
currentEntityTuples.push(tuple);
|
||||||
|
});
|
||||||
|
var currentPolyline;
|
||||||
|
entityGroups.forEach(function (tuples) {
|
||||||
|
var entityType = tuples[0][1];
|
||||||
|
var contentTuples = tuples.slice(1);
|
||||||
|
|
||||||
|
if (handlers[entityType] !== undefined) {
|
||||||
|
var e = handlers[entityType].process(contentTuples); // "POLYLINE" cannot be parsed in isolation, it is followed by
|
||||||
|
// N "VERTEX" entities and ended with a "SEQEND" entity.
|
||||||
|
// Essentially we convert POLYLINE to LWPOLYLINE - the extra
|
||||||
|
// vertex flags are not supported
|
||||||
|
|
||||||
|
if (entityType === 'POLYLINE') {
|
||||||
|
currentPolyline = e;
|
||||||
|
entities.push(e);
|
||||||
|
} else if (entityType === 'VERTEX') {
|
||||||
|
if (currentPolyline) {
|
||||||
|
currentPolyline.vertices.push(e);
|
||||||
|
} else {
|
||||||
|
_logger["default"].error('ignoring invalid VERTEX entity');
|
||||||
|
}
|
||||||
|
} else if (entityType === 'SEQEND') {
|
||||||
|
currentPolyline = undefined;
|
||||||
|
} else {
|
||||||
|
// All other entities
|
||||||
|
entities.push(e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_logger["default"].warn('unsupported type in ENTITIES section:', entityType);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return entities;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports["default"] = _default;
|
67
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/arc.js
generated
vendored
Normal file
67
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/arc.js
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = exports.process = exports.TYPE = void 0;
|
||||||
|
|
||||||
|
var _common = _interopRequireDefault(require("./common"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
|
var TYPE = 'ARC';
|
||||||
|
exports.TYPE = TYPE;
|
||||||
|
|
||||||
|
var process = function process(tuples) {
|
||||||
|
return tuples.reduce(function (entity, tuple) {
|
||||||
|
var type = tuple[0];
|
||||||
|
var value = tuple[1];
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case 10:
|
||||||
|
entity.x = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 20:
|
||||||
|
entity.y = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 30:
|
||||||
|
entity.z = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 39:
|
||||||
|
entity.thickness = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 40:
|
||||||
|
entity.r = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 50:
|
||||||
|
// *Someone* decided that ELLIPSE angles are in radians but
|
||||||
|
// ARC angles are in degrees
|
||||||
|
entity.startAngle = value / 180 * Math.PI;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 51:
|
||||||
|
entity.endAngle = value / 180 * Math.PI;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Object.assign(entity, (0, _common["default"])(type, value));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return entity;
|
||||||
|
}, {
|
||||||
|
type: TYPE
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.process = process;
|
||||||
|
var _default = {
|
||||||
|
TYPE: TYPE,
|
||||||
|
process: process
|
||||||
|
};
|
||||||
|
exports["default"] = _default;
|
53
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/circle.js
generated
vendored
Normal file
53
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/circle.js
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = exports.process = exports.TYPE = void 0;
|
||||||
|
|
||||||
|
var _common = _interopRequireDefault(require("./common"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
|
var TYPE = 'CIRCLE';
|
||||||
|
exports.TYPE = TYPE;
|
||||||
|
|
||||||
|
var process = function process(tuples) {
|
||||||
|
return tuples.reduce(function (entity, tuple) {
|
||||||
|
var type = tuple[0];
|
||||||
|
var value = tuple[1];
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case 10:
|
||||||
|
entity.x = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 20:
|
||||||
|
entity.y = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 30:
|
||||||
|
entity.z = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 40:
|
||||||
|
entity.r = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Object.assign(entity, (0, _common["default"])(type, value));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return entity;
|
||||||
|
}, {
|
||||||
|
type: TYPE
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.process = process;
|
||||||
|
var _default = {
|
||||||
|
TYPE: TYPE,
|
||||||
|
process: process
|
||||||
|
};
|
||||||
|
exports["default"] = _default;
|
64
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/common.js
generated
vendored
Normal file
64
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/common.js
generated
vendored
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = void 0;
|
||||||
|
|
||||||
|
var _default = function _default(type, value) {
|
||||||
|
switch (type) {
|
||||||
|
case 6:
|
||||||
|
// Linetype name (present if not BYLAYER).
|
||||||
|
// The special name BYBLOCK indicates a
|
||||||
|
// floating linetype. (optional)
|
||||||
|
return {
|
||||||
|
lineTypeName: value
|
||||||
|
};
|
||||||
|
|
||||||
|
case 8:
|
||||||
|
return {
|
||||||
|
layer: value
|
||||||
|
};
|
||||||
|
|
||||||
|
case 48:
|
||||||
|
// Linetype scale (optional)
|
||||||
|
return {
|
||||||
|
lineTypeScale: value
|
||||||
|
};
|
||||||
|
|
||||||
|
case 60:
|
||||||
|
// Object visibility (optional): 0 = visible, 1 = invisible.
|
||||||
|
return {
|
||||||
|
visible: value === 0
|
||||||
|
};
|
||||||
|
|
||||||
|
case 62:
|
||||||
|
// Color number (present if not BYLAYER).
|
||||||
|
// Zero indicates the BYBLOCK (floating) color.
|
||||||
|
// 256 indicates BYLAYER.
|
||||||
|
// A negative value indicates that the layer is turned off. (optional)
|
||||||
|
return {
|
||||||
|
colorNumber: value
|
||||||
|
};
|
||||||
|
|
||||||
|
case 210:
|
||||||
|
return {
|
||||||
|
extrusionX: value
|
||||||
|
};
|
||||||
|
|
||||||
|
case 220:
|
||||||
|
return {
|
||||||
|
extrusionY: value
|
||||||
|
};
|
||||||
|
|
||||||
|
case 230:
|
||||||
|
return {
|
||||||
|
extrusionZ: value
|
||||||
|
};
|
||||||
|
|
||||||
|
default:
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports["default"] = _default;
|
73
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/ellipse.js
generated
vendored
Normal file
73
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/ellipse.js
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = exports.process = exports.TYPE = void 0;
|
||||||
|
|
||||||
|
var _common = _interopRequireDefault(require("./common"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
|
var TYPE = 'ELLIPSE';
|
||||||
|
exports.TYPE = TYPE;
|
||||||
|
|
||||||
|
var process = function process(tuples) {
|
||||||
|
return tuples.reduce(function (entity, tuple) {
|
||||||
|
var type = tuple[0];
|
||||||
|
var value = tuple[1];
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case 10:
|
||||||
|
entity.x = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 11:
|
||||||
|
entity.majorX = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 20:
|
||||||
|
entity.y = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 21:
|
||||||
|
entity.majorY = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 30:
|
||||||
|
entity.z = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 31:
|
||||||
|
entity.majorZ = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 40:
|
||||||
|
entity.axisRatio = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 41:
|
||||||
|
entity.startAngle = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 42:
|
||||||
|
entity.endAngle = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Object.assign(entity, (0, _common["default"])(type, value));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return entity;
|
||||||
|
}, {
|
||||||
|
type: TYPE
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.process = process;
|
||||||
|
var _default = {
|
||||||
|
TYPE: TYPE,
|
||||||
|
process: process
|
||||||
|
};
|
||||||
|
exports["default"] = _default;
|
97
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/insert.js
generated
vendored
Normal file
97
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/insert.js
generated
vendored
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = exports.process = exports.TYPE = void 0;
|
||||||
|
|
||||||
|
var _common = _interopRequireDefault(require("./common"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
|
var TYPE = 'INSERT';
|
||||||
|
exports.TYPE = TYPE;
|
||||||
|
|
||||||
|
var process = function process(tuples) {
|
||||||
|
return tuples.reduce(function (entity, tuple) {
|
||||||
|
var type = tuple[0];
|
||||||
|
var value = tuple[1];
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case 2:
|
||||||
|
entity.block = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 10:
|
||||||
|
entity.x = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 20:
|
||||||
|
entity.y = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 30:
|
||||||
|
entity.z = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 41:
|
||||||
|
entity.scaleX = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 42:
|
||||||
|
entity.scaleY = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 43:
|
||||||
|
entity.scaleZ = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 44:
|
||||||
|
entity.columnSpacing = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 45:
|
||||||
|
entity.rowSpacing = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 50:
|
||||||
|
entity.rotation = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 70:
|
||||||
|
entity.columnCount = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 71:
|
||||||
|
entity.rowCount = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 210:
|
||||||
|
entity.extrusionX = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 220:
|
||||||
|
entity.extrusionY = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 230:
|
||||||
|
entity.extrusionZ = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Object.assign(entity, (0, _common["default"])(type, value));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return entity;
|
||||||
|
}, {
|
||||||
|
type: TYPE
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.process = process;
|
||||||
|
var _default = {
|
||||||
|
TYPE: TYPE,
|
||||||
|
process: process
|
||||||
|
};
|
||||||
|
exports["default"] = _default;
|
67
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/line.js
generated
vendored
Normal file
67
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/line.js
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = exports.process = exports.TYPE = void 0;
|
||||||
|
|
||||||
|
var _common = _interopRequireDefault(require("./common"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
|
var TYPE = 'LINE';
|
||||||
|
exports.TYPE = TYPE;
|
||||||
|
|
||||||
|
var process = function process(tuples) {
|
||||||
|
return tuples.reduce(function (entity, tuple) {
|
||||||
|
var type = tuple[0];
|
||||||
|
var value = tuple[1];
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case 10:
|
||||||
|
entity.start.x = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 20:
|
||||||
|
entity.start.y = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 30:
|
||||||
|
entity.start.z = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 39:
|
||||||
|
entity.thickness = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 11:
|
||||||
|
entity.end.x = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 21:
|
||||||
|
entity.end.y = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 31:
|
||||||
|
entity.end.z = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Object.assign(entity, (0, _common["default"])(type, value));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return entity;
|
||||||
|
}, {
|
||||||
|
type: TYPE,
|
||||||
|
start: {},
|
||||||
|
end: {}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.process = process;
|
||||||
|
var _default = {
|
||||||
|
TYPE: TYPE,
|
||||||
|
process: process
|
||||||
|
};
|
||||||
|
exports["default"] = _default;
|
64
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/lwpolyline.js
generated
vendored
Normal file
64
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/lwpolyline.js
generated
vendored
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = exports.process = exports.TYPE = void 0;
|
||||||
|
|
||||||
|
var _common = _interopRequireDefault(require("./common"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
|
var TYPE = 'LWPOLYLINE';
|
||||||
|
exports.TYPE = TYPE;
|
||||||
|
|
||||||
|
var process = function process(tuples) {
|
||||||
|
var vertex;
|
||||||
|
return tuples.reduce(function (entity, tuple) {
|
||||||
|
var type = tuple[0];
|
||||||
|
var value = tuple[1];
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case 70:
|
||||||
|
entity.closed = (value & 1) === 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 10:
|
||||||
|
vertex = {
|
||||||
|
x: value,
|
||||||
|
y: 0
|
||||||
|
};
|
||||||
|
entity.vertices.push(vertex);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 20:
|
||||||
|
vertex.y = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 39:
|
||||||
|
entity.thickness = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 42:
|
||||||
|
// Bulge (multiple entries; one entry for each vertex) (optional; default = 0).
|
||||||
|
vertex.bulge = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Object.assign(entity, (0, _common["default"])(type, value));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return entity;
|
||||||
|
}, {
|
||||||
|
type: TYPE,
|
||||||
|
vertices: []
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.process = process;
|
||||||
|
var _default = {
|
||||||
|
TYPE: TYPE,
|
||||||
|
process: process
|
||||||
|
};
|
||||||
|
exports["default"] = _default;
|
92
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/mtext.js
generated
vendored
Normal file
92
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/mtext.js
generated
vendored
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = exports.process = exports.TYPE = void 0;
|
||||||
|
|
||||||
|
var _common = _interopRequireDefault(require("./common"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
|
var TYPE = 'MTEXT';
|
||||||
|
exports.TYPE = TYPE;
|
||||||
|
var simpleCodes = {
|
||||||
|
10: 'x',
|
||||||
|
20: 'y',
|
||||||
|
30: 'z',
|
||||||
|
40: 'nominalTextHeight',
|
||||||
|
41: 'refRectangleWidth',
|
||||||
|
71: 'attachmentPoint',
|
||||||
|
72: 'drawingDirection',
|
||||||
|
7: 'styleName',
|
||||||
|
11: 'xAxisX',
|
||||||
|
21: 'xAxisY',
|
||||||
|
31: 'xAxisZ',
|
||||||
|
42: 'horizontalWidth',
|
||||||
|
43: 'verticalHeight',
|
||||||
|
73: 'lineSpacingStyle',
|
||||||
|
44: 'lineSpacingFactor',
|
||||||
|
90: 'backgroundFill',
|
||||||
|
420: 'bgColorRGB0',
|
||||||
|
421: 'bgColorRGB1',
|
||||||
|
422: 'bgColorRGB2',
|
||||||
|
423: 'bgColorRGB3',
|
||||||
|
424: 'bgColorRGB4',
|
||||||
|
425: 'bgColorRGB5',
|
||||||
|
426: 'bgColorRGB6',
|
||||||
|
427: 'bgColorRGB7',
|
||||||
|
428: 'bgColorRGB8',
|
||||||
|
429: 'bgColorRGB9',
|
||||||
|
430: 'bgColorName0',
|
||||||
|
431: 'bgColorName1',
|
||||||
|
432: 'bgColorName2',
|
||||||
|
433: 'bgColorName3',
|
||||||
|
434: 'bgColorName4',
|
||||||
|
435: 'bgColorName5',
|
||||||
|
436: 'bgColorName6',
|
||||||
|
437: 'bgColorName7',
|
||||||
|
438: 'bgColorName8',
|
||||||
|
439: 'bgColorName9',
|
||||||
|
45: 'fillBoxStyle',
|
||||||
|
63: 'bgFillColor',
|
||||||
|
441: 'bgFillTransparency',
|
||||||
|
75: 'columnType',
|
||||||
|
76: 'columnCount',
|
||||||
|
78: 'columnFlowReversed',
|
||||||
|
79: 'columnAutoheight',
|
||||||
|
48: 'columnWidth',
|
||||||
|
49: 'columnGutter',
|
||||||
|
50: 'columnHeights'
|
||||||
|
};
|
||||||
|
|
||||||
|
var process = function process(tuples) {
|
||||||
|
return tuples.reduce(function (entity, tuple) {
|
||||||
|
var type = tuple[0];
|
||||||
|
var value = tuple[1];
|
||||||
|
|
||||||
|
if (simpleCodes[type] !== undefined) {
|
||||||
|
entity[simpleCodes[type]] = value;
|
||||||
|
} else if (type === 1 || type === 3) {
|
||||||
|
entity.string += value;
|
||||||
|
} else if (type === 50) {
|
||||||
|
// Rotation angle in radians
|
||||||
|
entity.xAxisX = Math.cos(value);
|
||||||
|
entity.xAxisY = Math.sin(value);
|
||||||
|
} else {
|
||||||
|
Object.assign(entity, (0, _common["default"])(type, value));
|
||||||
|
}
|
||||||
|
|
||||||
|
return entity;
|
||||||
|
}, {
|
||||||
|
type: TYPE,
|
||||||
|
string: ''
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.process = process;
|
||||||
|
var _default = {
|
||||||
|
TYPE: TYPE,
|
||||||
|
process: process
|
||||||
|
};
|
||||||
|
exports["default"] = _default;
|
53
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/point.js
generated
vendored
Normal file
53
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/point.js
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = exports.process = exports.TYPE = void 0;
|
||||||
|
|
||||||
|
var _common = _interopRequireDefault(require("./common"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
|
var TYPE = 'POINT';
|
||||||
|
exports.TYPE = TYPE;
|
||||||
|
|
||||||
|
var process = function process(tuples) {
|
||||||
|
return tuples.reduce(function (entity, tuple) {
|
||||||
|
var type = tuple[0];
|
||||||
|
var value = tuple[1];
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case 10:
|
||||||
|
entity.x = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 20:
|
||||||
|
entity.y = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 30:
|
||||||
|
entity.z = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 39:
|
||||||
|
entity.thickness = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Object.assign(entity, (0, _common["default"])(type, value));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return entity;
|
||||||
|
}, {
|
||||||
|
type: TYPE
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.process = process;
|
||||||
|
var _default = {
|
||||||
|
TYPE: TYPE,
|
||||||
|
process: process
|
||||||
|
};
|
||||||
|
exports["default"] = _default;
|
48
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/polyline.js
generated
vendored
Normal file
48
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/polyline.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = exports.process = exports.TYPE = void 0;
|
||||||
|
|
||||||
|
var _common = _interopRequireDefault(require("./common"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
|
var TYPE = 'POLYLINE';
|
||||||
|
exports.TYPE = TYPE;
|
||||||
|
|
||||||
|
var process = function process(tuples) {
|
||||||
|
return tuples.reduce(function (entity, tuple) {
|
||||||
|
var type = tuple[0];
|
||||||
|
var value = tuple[1];
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case 70:
|
||||||
|
entity.closed = (value & 1) === 1;
|
||||||
|
entity.polygonMesh = (value & 16) === 16;
|
||||||
|
entity.polyfaceMesh = (value & 64) === 64;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 39:
|
||||||
|
entity.thickness = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Object.assign(entity, (0, _common["default"])(type, value));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return entity;
|
||||||
|
}, {
|
||||||
|
type: TYPE,
|
||||||
|
vertices: []
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.process = process;
|
||||||
|
var _default = {
|
||||||
|
TYPE: TYPE,
|
||||||
|
process: process
|
||||||
|
};
|
||||||
|
exports["default"] = _default;
|
90
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/solid.js
generated
vendored
Normal file
90
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/solid.js
generated
vendored
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = exports.process = exports.TYPE = void 0;
|
||||||
|
|
||||||
|
var _common = _interopRequireDefault(require("./common"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
|
var TYPE = 'SOLID';
|
||||||
|
exports.TYPE = TYPE;
|
||||||
|
|
||||||
|
var process = function process(tuples) {
|
||||||
|
return tuples.reduce(function (entity, tuple) {
|
||||||
|
var type = tuple[0];
|
||||||
|
var value = tuple[1];
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case 10:
|
||||||
|
entity.corners[0].x = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 20:
|
||||||
|
entity.corners[0].y = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 30:
|
||||||
|
entity.corners[0].z = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 11:
|
||||||
|
entity.corners[1].x = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 21:
|
||||||
|
entity.corners[1].y = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 31:
|
||||||
|
entity.corners[1].z = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 12:
|
||||||
|
entity.corners[2].x = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 22:
|
||||||
|
entity.corners[2].y = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 32:
|
||||||
|
entity.corners[2].z = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 13:
|
||||||
|
entity.corners[3].x = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 23:
|
||||||
|
entity.corners[3].y = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 33:
|
||||||
|
entity.corners[3].z = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 39:
|
||||||
|
entity.thickness = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Object.assign(entity, (0, _common["default"])(type, value));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return entity;
|
||||||
|
}, {
|
||||||
|
type: TYPE,
|
||||||
|
corners: [{}, {}, {}, {}]
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.process = process;
|
||||||
|
var _default = {
|
||||||
|
TYPE: TYPE,
|
||||||
|
process: process
|
||||||
|
};
|
||||||
|
exports["default"] = _default;
|
99
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/spline.js
generated
vendored
Normal file
99
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/spline.js
generated
vendored
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = exports.process = exports.TYPE = void 0;
|
||||||
|
|
||||||
|
var _common = _interopRequireDefault(require("./common"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
|
var TYPE = 'SPLINE';
|
||||||
|
exports.TYPE = TYPE;
|
||||||
|
|
||||||
|
var process = function process(tuples) {
|
||||||
|
var controlPoint;
|
||||||
|
return tuples.reduce(function (entity, tuple) {
|
||||||
|
var type = tuple[0];
|
||||||
|
var value = tuple[1];
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case 10:
|
||||||
|
controlPoint = {
|
||||||
|
x: value,
|
||||||
|
y: 0
|
||||||
|
};
|
||||||
|
entity.controlPoints.push(controlPoint);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 20:
|
||||||
|
controlPoint.y = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 30:
|
||||||
|
controlPoint.z = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 40:
|
||||||
|
entity.knots.push(value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 42:
|
||||||
|
entity.knotTolerance = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 43:
|
||||||
|
entity.controlPointTolerance = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 44:
|
||||||
|
entity.fitTolerance = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 70:
|
||||||
|
// Spline flag (bit coded):
|
||||||
|
// 1 = Closed spline
|
||||||
|
// 2 = Periodic spline
|
||||||
|
// 4 = Rational spline
|
||||||
|
// 8 = Planar
|
||||||
|
// 16 = Linear (planar bit is also set)
|
||||||
|
entity.flag = value;
|
||||||
|
entity.closed = (value & 1) === 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 71:
|
||||||
|
entity.degree = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 72:
|
||||||
|
entity.numberOfKnots = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 73:
|
||||||
|
entity.numberOfControlPoints = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 74:
|
||||||
|
entity.numberOfFitPoints = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Object.assign(entity, (0, _common["default"])(type, value));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return entity;
|
||||||
|
}, {
|
||||||
|
type: TYPE,
|
||||||
|
controlPoints: [],
|
||||||
|
knots: []
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.process = process;
|
||||||
|
var _default = {
|
||||||
|
TYPE: TYPE,
|
||||||
|
process: process
|
||||||
|
};
|
||||||
|
exports["default"] = _default;
|
86
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/threeDFace.js
generated
vendored
Normal file
86
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/threeDFace.js
generated
vendored
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = exports.process = exports.TYPE = void 0;
|
||||||
|
|
||||||
|
var _common = _interopRequireDefault(require("./common"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
|
var TYPE = '3DFACE';
|
||||||
|
exports.TYPE = TYPE;
|
||||||
|
|
||||||
|
var process = function process(tuples) {
|
||||||
|
return tuples.reduce(function (entity, tuple) {
|
||||||
|
var type = tuple[0];
|
||||||
|
var value = tuple[1];
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case 10:
|
||||||
|
entity.vertices[0].x = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 20:
|
||||||
|
entity.vertices[0].y = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 30:
|
||||||
|
entity.vertices[0].z = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 11:
|
||||||
|
entity.vertices[1].x = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 21:
|
||||||
|
entity.vertices[1].y = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 31:
|
||||||
|
entity.vertices[1].z = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 12:
|
||||||
|
entity.vertices[2].x = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 22:
|
||||||
|
entity.vertices[2].y = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 32:
|
||||||
|
entity.vertices[2].z = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 13:
|
||||||
|
entity.vertices[3].x = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 23:
|
||||||
|
entity.vertices[3].y = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 33:
|
||||||
|
entity.vertices[3].z = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Object.assign(entity, (0, _common["default"])(type, value));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return entity;
|
||||||
|
}, {
|
||||||
|
type: TYPE,
|
||||||
|
vertices: [{}, {}, {}, {}]
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.process = process;
|
||||||
|
var _default = {
|
||||||
|
TYPE: TYPE,
|
||||||
|
process: process
|
||||||
|
};
|
||||||
|
exports["default"] = _default;
|
45
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/vertex.js
generated
vendored
Normal file
45
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/entity/vertex.js
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = exports.process = exports.TYPE = void 0;
|
||||||
|
var TYPE = 'VERTEX';
|
||||||
|
exports.TYPE = TYPE;
|
||||||
|
|
||||||
|
var process = function process(tuples) {
|
||||||
|
return tuples.reduce(function (entity, tuple) {
|
||||||
|
var type = tuple[0];
|
||||||
|
var value = tuple[1];
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case 10:
|
||||||
|
entity.x = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 20:
|
||||||
|
entity.y = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 30:
|
||||||
|
entity.z = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 42:
|
||||||
|
entity.bulge = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return entity;
|
||||||
|
}, {});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.process = process;
|
||||||
|
var _default = {
|
||||||
|
TYPE: TYPE,
|
||||||
|
process: process
|
||||||
|
};
|
||||||
|
exports["default"] = _default;
|
82
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/header.js
generated
vendored
Normal file
82
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/header.js
generated
vendored
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = void 0;
|
||||||
|
|
||||||
|
var _default = function _default(tuples) {
|
||||||
|
var state;
|
||||||
|
var header = {};
|
||||||
|
tuples.forEach(function (tuple) {
|
||||||
|
var type = tuple[0];
|
||||||
|
var value = tuple[1];
|
||||||
|
|
||||||
|
switch (value) {
|
||||||
|
case '$MEASUREMENT':
|
||||||
|
{
|
||||||
|
state = 'measurement';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case '$INSUNITS':
|
||||||
|
{
|
||||||
|
state = 'insUnits';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case '$EXTMIN':
|
||||||
|
header.extMin = {};
|
||||||
|
state = 'extMin';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '$EXTMAX':
|
||||||
|
header.extMax = {};
|
||||||
|
state = 'extMax';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
switch (state) {
|
||||||
|
case 'extMin':
|
||||||
|
case 'extMax':
|
||||||
|
{
|
||||||
|
switch (type) {
|
||||||
|
case 10:
|
||||||
|
header[state].x = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 20:
|
||||||
|
header[state].y = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 30:
|
||||||
|
header[state].z = value;
|
||||||
|
state = undefined;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'measurement':
|
||||||
|
case 'insUnits':
|
||||||
|
{
|
||||||
|
switch (type) {
|
||||||
|
case 70:
|
||||||
|
{
|
||||||
|
header[state] = value;
|
||||||
|
state = undefined;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return header;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports["default"] = _default;
|
162
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/tables.js
generated
vendored
Normal file
162
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/handlers/tables.js
generated
vendored
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = void 0;
|
||||||
|
|
||||||
|
var _logger = _interopRequireDefault(require("../util/logger"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
|
var layerHandler = function layerHandler(tuples) {
|
||||||
|
return tuples.reduce(function (layer, tuple) {
|
||||||
|
var type = tuple[0];
|
||||||
|
var value = tuple[1]; // https://www.autodesk.com/techpubs/autocad/acad2000/dxf/layer_dxf_04.htm
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case 2:
|
||||||
|
layer.name = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 6:
|
||||||
|
layer.lineTypeName = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 62:
|
||||||
|
layer.colorNumber = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 70:
|
||||||
|
layer.flags = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 290:
|
||||||
|
layer.plot = parseInt(value) !== 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 370:
|
||||||
|
layer.lineWeightEnum = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
|
||||||
|
return layer;
|
||||||
|
}, {
|
||||||
|
type: 'LAYER'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var styleHandler = function styleHandler(tuples) {
|
||||||
|
return tuples.reduce(function (style, tuple) {
|
||||||
|
var type = tuple[0];
|
||||||
|
var value = tuple[1];
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case 2:
|
||||||
|
style.name = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 6:
|
||||||
|
style.lineTypeName = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 40:
|
||||||
|
style.fixedTextHeight = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 41:
|
||||||
|
style.widthFactor = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 50:
|
||||||
|
style.obliqueAngle = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 71:
|
||||||
|
style.flags = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 42:
|
||||||
|
style.lastHeightUsed = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
style.primaryFontFileName = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
style.bigFontFileName = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
|
||||||
|
return style;
|
||||||
|
}, {
|
||||||
|
type: 'STYLE'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var tableHandler = function tableHandler(tuples, tableType, handler) {
|
||||||
|
var tableRowsTuples = [];
|
||||||
|
var tableRowTuples;
|
||||||
|
tuples.forEach(function (tuple) {
|
||||||
|
var type = tuple[0];
|
||||||
|
var value = tuple[1];
|
||||||
|
|
||||||
|
if ((type === 0 || type === 2) && value === tableType) {
|
||||||
|
tableRowTuples = [];
|
||||||
|
tableRowsTuples.push(tableRowTuples);
|
||||||
|
} else {
|
||||||
|
tableRowTuples.push(tuple);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return tableRowsTuples.reduce(function (acc, rowTuples) {
|
||||||
|
var tableRow = handler(rowTuples);
|
||||||
|
|
||||||
|
if (tableRow.name) {
|
||||||
|
acc[tableRow.name] = tableRow;
|
||||||
|
} else {
|
||||||
|
_logger["default"].warn('table row without name:', tableRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
};
|
||||||
|
|
||||||
|
var _default = function _default(tuples) {
|
||||||
|
var tableGroups = [];
|
||||||
|
var tableTuples;
|
||||||
|
tuples.forEach(function (tuple) {
|
||||||
|
// const type = tuple[0];
|
||||||
|
var value = tuple[1];
|
||||||
|
|
||||||
|
if (value === 'TABLE') {
|
||||||
|
tableTuples = [];
|
||||||
|
tableGroups.push(tableTuples);
|
||||||
|
} else if (value === 'ENDTAB') {
|
||||||
|
tableGroups.push(tableTuples);
|
||||||
|
} else {
|
||||||
|
tableTuples.push(tuple);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var stylesTuples = [];
|
||||||
|
var layersTuples = [];
|
||||||
|
tableGroups.forEach(function (group) {
|
||||||
|
if (group[0][1] === 'STYLE') {
|
||||||
|
stylesTuples = group;
|
||||||
|
} else if (group[0][1] === 'LTYPE') {
|
||||||
|
_logger["default"].warn('LTYPE in tables not supported');
|
||||||
|
} else if (group[0][1] === 'LAYER') {
|
||||||
|
layersTuples = group;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
layers: tableHandler(layersTuples, 'LAYER', layerHandler),
|
||||||
|
styles: tableHandler(stylesTuples, 'STYLE', styleHandler)
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
exports["default"] = _default;
|
71
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/index.js
generated
vendored
Normal file
71
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "config", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function get() {
|
||||||
|
return _config["default"];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "parseString", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function get() {
|
||||||
|
return _parseString["default"];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "denormalise", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function get() {
|
||||||
|
return _denormalise["default"];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "groupEntitiesByLayer", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function get() {
|
||||||
|
return _groupEntitiesByLayer["default"];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "toPolylines", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function get() {
|
||||||
|
return _toPolylines["default"];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "toSVG", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function get() {
|
||||||
|
return _toSVG["default"];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "colors", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function get() {
|
||||||
|
return _colors["default"];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "Helper", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function get() {
|
||||||
|
return _Helper["default"];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var _config = _interopRequireDefault(require("./config"));
|
||||||
|
|
||||||
|
var _parseString = _interopRequireDefault(require("./parseString"));
|
||||||
|
|
||||||
|
var _denormalise = _interopRequireDefault(require("./denormalise"));
|
||||||
|
|
||||||
|
var _groupEntitiesByLayer = _interopRequireDefault(require("./groupEntitiesByLayer"));
|
||||||
|
|
||||||
|
var _toPolylines = _interopRequireDefault(require("./toPolylines"));
|
||||||
|
|
||||||
|
var _toSVG = _interopRequireDefault(require("./toSVG"));
|
||||||
|
|
||||||
|
var _colors = _interopRequireDefault(require("./util/colors"));
|
||||||
|
|
||||||
|
var _Helper = _interopRequireDefault(require("./Helper"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
133
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/parseString.js
generated
vendored
Normal file
133
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/parseString.js
generated
vendored
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = void 0;
|
||||||
|
|
||||||
|
var _header = _interopRequireDefault(require("./handlers/header"));
|
||||||
|
|
||||||
|
var _tables = _interopRequireDefault(require("./handlers/tables"));
|
||||||
|
|
||||||
|
var _blocks = _interopRequireDefault(require("./handlers/blocks"));
|
||||||
|
|
||||||
|
var _entities = _interopRequireDefault(require("./handlers/entities"));
|
||||||
|
|
||||||
|
var _logger = _interopRequireDefault(require("./util/logger"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
||||||
|
|
||||||
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||||
|
|
||||||
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||||
|
|
||||||
|
// Parse the value into the native representation
|
||||||
|
var parseValue = function parseValue(type, value) {
|
||||||
|
if (type >= 10 && type < 60) {
|
||||||
|
return parseFloat(value, 10);
|
||||||
|
} else if (type >= 210 && type < 240) {
|
||||||
|
return parseFloat(value, 10);
|
||||||
|
} else if (type >= 60 && type < 100) {
|
||||||
|
return parseInt(value, 10);
|
||||||
|
} else {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}; // Content lines are alternate lines of type and value
|
||||||
|
|
||||||
|
|
||||||
|
var convertToTypesAndValues = function convertToTypesAndValues(contentLines) {
|
||||||
|
var state = 'type';
|
||||||
|
var type;
|
||||||
|
var typesAndValues = [];
|
||||||
|
|
||||||
|
var _iterator = _createForOfIteratorHelper(contentLines),
|
||||||
|
_step;
|
||||||
|
|
||||||
|
try {
|
||||||
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
||||||
|
var line = _step.value;
|
||||||
|
|
||||||
|
if (state === 'type') {
|
||||||
|
type = parseInt(line, 10);
|
||||||
|
state = 'value';
|
||||||
|
} else {
|
||||||
|
typesAndValues.push([type, parseValue(type, line)]);
|
||||||
|
state = 'type';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
_iterator.e(err);
|
||||||
|
} finally {
|
||||||
|
_iterator.f();
|
||||||
|
}
|
||||||
|
|
||||||
|
return typesAndValues;
|
||||||
|
};
|
||||||
|
|
||||||
|
var separateSections = function separateSections(tuples) {
|
||||||
|
var sectionTuples;
|
||||||
|
return tuples.reduce(function (sections, tuple) {
|
||||||
|
if (tuple[0] === 0 && tuple[1] === 'SECTION') {
|
||||||
|
sectionTuples = [];
|
||||||
|
} else if (tuple[0] === 0 && tuple[1] === 'ENDSEC') {
|
||||||
|
sections.push(sectionTuples);
|
||||||
|
sectionTuples = undefined;
|
||||||
|
} else if (sectionTuples !== undefined) {
|
||||||
|
sectionTuples.push(tuple);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sections;
|
||||||
|
}, []);
|
||||||
|
}; // Each section start with the type tuple, then proceeds
|
||||||
|
// with the contents of the section
|
||||||
|
|
||||||
|
|
||||||
|
var reduceSection = function reduceSection(acc, section) {
|
||||||
|
var sectionType = section[0][1];
|
||||||
|
var contentTuples = section.slice(1);
|
||||||
|
|
||||||
|
switch (sectionType) {
|
||||||
|
case 'HEADER':
|
||||||
|
acc.header = (0, _header["default"])(contentTuples);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'TABLES':
|
||||||
|
acc.tables = (0, _tables["default"])(contentTuples);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'BLOCKS':
|
||||||
|
acc.blocks = (0, _blocks["default"])(contentTuples);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'ENTITIES':
|
||||||
|
acc.entities = (0, _entities["default"])(contentTuples);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
_logger["default"].warn("Unsupported section: ".concat(sectionType));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
};
|
||||||
|
|
||||||
|
var _default = function _default(string) {
|
||||||
|
var lines = string.split(/\r\n|\r|\n/g);
|
||||||
|
var tuples = convertToTypesAndValues(lines);
|
||||||
|
var sections = separateSections(tuples);
|
||||||
|
var result = sections.reduce(reduceSection, {
|
||||||
|
// Start with empty defaults in the event of empty sections
|
||||||
|
header: {},
|
||||||
|
blocks: [],
|
||||||
|
entities: [],
|
||||||
|
tables: {
|
||||||
|
layers: {},
|
||||||
|
styles: {}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports["default"] = _default;
|
63
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/toPolylines.js
generated
vendored
Normal file
63
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/toPolylines.js
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = void 0;
|
||||||
|
|
||||||
|
var _vecks = require("vecks");
|
||||||
|
|
||||||
|
var _colors = _interopRequireDefault(require("./util/colors"));
|
||||||
|
|
||||||
|
var _denormalise = _interopRequireDefault(require("./denormalise"));
|
||||||
|
|
||||||
|
var _entityToPolyline = _interopRequireDefault(require("./entityToPolyline"));
|
||||||
|
|
||||||
|
var _applyTransforms = _interopRequireDefault(require("./applyTransforms"));
|
||||||
|
|
||||||
|
var _logger = _interopRequireDefault(require("./util/logger"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
|
var _default = function _default(parsed) {
|
||||||
|
var entities = (0, _denormalise["default"])(parsed);
|
||||||
|
var polylines = entities.map(function (entity) {
|
||||||
|
var layerTable = parsed.tables.layers[entity.layer];
|
||||||
|
var rgb;
|
||||||
|
|
||||||
|
if (layerTable) {
|
||||||
|
var colorNumber = 'colorNumber' in entity ? entity.colorNumber : layerTable.colorNumber;
|
||||||
|
rgb = _colors["default"][colorNumber];
|
||||||
|
|
||||||
|
if (rgb === undefined) {
|
||||||
|
_logger["default"].warn('Color index', colorNumber, 'invalid, defaulting to black');
|
||||||
|
|
||||||
|
rgb = [0, 0, 0];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_logger["default"].warn('no layer table for layer:' + entity.layer);
|
||||||
|
|
||||||
|
rgb = [0, 0, 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
rgb: rgb,
|
||||||
|
vertices: (0, _applyTransforms["default"])((0, _entityToPolyline["default"])(entity), entity.transforms)
|
||||||
|
};
|
||||||
|
});
|
||||||
|
var bbox = new _vecks.Box2();
|
||||||
|
polylines.forEach(function (polyline) {
|
||||||
|
polyline.vertices.forEach(function (vertex) {
|
||||||
|
bbox.expandByPoint({
|
||||||
|
x: vertex[0],
|
||||||
|
y: vertex[1]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
bbox: bbox,
|
||||||
|
polylines: polylines
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
exports["default"] = _default;
|
401
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/toSVG.js
generated
vendored
Normal file
401
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/toSVG.js
generated
vendored
Normal file
@ -0,0 +1,401 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = exports.piecewiseToPaths = void 0;
|
||||||
|
|
||||||
|
var _prettyData = require("pretty-data");
|
||||||
|
|
||||||
|
var _vecks = require("vecks");
|
||||||
|
|
||||||
|
var _entityToPolyline = _interopRequireDefault(require("./entityToPolyline"));
|
||||||
|
|
||||||
|
var _denormalise = _interopRequireDefault(require("./denormalise"));
|
||||||
|
|
||||||
|
var _getRGBForEntity = _interopRequireDefault(require("./getRGBForEntity"));
|
||||||
|
|
||||||
|
var _logger = _interopRequireDefault(require("./util/logger"));
|
||||||
|
|
||||||
|
var _rotate = _interopRequireDefault(require("./util/rotate"));
|
||||||
|
|
||||||
|
var _rgbToColorAttribute = _interopRequireDefault(require("./util/rgbToColorAttribute"));
|
||||||
|
|
||||||
|
var _toPiecewiseBezier = _interopRequireWildcard(require("./util/toPiecewiseBezier"));
|
||||||
|
|
||||||
|
var _transformBoundingBoxAndElement = _interopRequireDefault(require("./util/transformBoundingBoxAndElement"));
|
||||||
|
|
||||||
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||||
|
|
||||||
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||||
|
|
||||||
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||||
|
|
||||||
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||||
|
|
||||||
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||||
|
|
||||||
|
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||||
|
|
||||||
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||||
|
|
||||||
|
var addFlipXIfApplicable = function addFlipXIfApplicable(entity, _ref) {
|
||||||
|
var bbox = _ref.bbox,
|
||||||
|
element = _ref.element;
|
||||||
|
|
||||||
|
if (entity.extrusionZ === -1) {
|
||||||
|
return {
|
||||||
|
bbox: new _vecks.Box2().expandByPoint({
|
||||||
|
x: -bbox.min.x,
|
||||||
|
y: bbox.min.y
|
||||||
|
}).expandByPoint({
|
||||||
|
x: -bbox.max.x,
|
||||||
|
y: bbox.max.y
|
||||||
|
}),
|
||||||
|
element: "<g transform=\"matrix(-1 0 0 1 0 0)\">\n ".concat(element, "\n </g>")
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
bbox: bbox,
|
||||||
|
element: element
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Create a <path /> element. Interpolates curved entities.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
var polyline = function polyline(entity) {
|
||||||
|
var vertices = (0, _entityToPolyline["default"])(entity);
|
||||||
|
var bbox = vertices.reduce(function (acc, _ref2) {
|
||||||
|
var _ref3 = _slicedToArray(_ref2, 2),
|
||||||
|
x = _ref3[0],
|
||||||
|
y = _ref3[1];
|
||||||
|
|
||||||
|
return acc.expandByPoint({
|
||||||
|
x: x,
|
||||||
|
y: y
|
||||||
|
});
|
||||||
|
}, new _vecks.Box2());
|
||||||
|
var d = vertices.reduce(function (acc, point, i) {
|
||||||
|
acc += i === 0 ? 'M' : 'L';
|
||||||
|
acc += point[0] + ',' + point[1];
|
||||||
|
return acc;
|
||||||
|
}, ''); // Empirically it appears that flipping horzontally does not apply to polyline
|
||||||
|
|
||||||
|
return (0, _transformBoundingBoxAndElement["default"])(bbox, "<path d=\"".concat(d, "\" />"), entity.transforms);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Create a <circle /> element for the CIRCLE entity.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
var circle = function circle(entity) {
|
||||||
|
var bbox0 = new _vecks.Box2().expandByPoint({
|
||||||
|
x: entity.x + entity.r,
|
||||||
|
y: entity.y + entity.r
|
||||||
|
}).expandByPoint({
|
||||||
|
x: entity.x - entity.r,
|
||||||
|
y: entity.y - entity.r
|
||||||
|
});
|
||||||
|
var element0 = "<circle cx=\"".concat(entity.x, "\" cy=\"").concat(entity.y, "\" r=\"").concat(entity.r, "\" />");
|
||||||
|
|
||||||
|
var _addFlipXIfApplicable = addFlipXIfApplicable(entity, {
|
||||||
|
bbox: bbox0,
|
||||||
|
element: element0
|
||||||
|
}),
|
||||||
|
bbox = _addFlipXIfApplicable.bbox,
|
||||||
|
element = _addFlipXIfApplicable.element;
|
||||||
|
|
||||||
|
return (0, _transformBoundingBoxAndElement["default"])(bbox, element, entity.transforms);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Create a a <path d="A..." /> or <ellipse /> element for the ARC or ELLIPSE
|
||||||
|
* DXF entity (<ellipse /> if start and end point are the same).
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
var ellipseOrArc = function ellipseOrArc(cx, cy, majorX, majorY, axisRatio, startAngle, endAngle, flipX) {
|
||||||
|
var rx = Math.sqrt(majorX * majorX + majorY * majorY);
|
||||||
|
var ry = axisRatio * rx;
|
||||||
|
var rotationAngle = -Math.atan2(-majorY, majorX);
|
||||||
|
var bbox = bboxEllipseOrArc(cx, cy, majorX, majorY, axisRatio, startAngle, endAngle, flipX);
|
||||||
|
|
||||||
|
if (Math.abs(startAngle - endAngle) < 1e-9 || Math.abs(startAngle - endAngle + Math.PI * 2) < 1e-9) {
|
||||||
|
// Use a native <ellipse> when start and end angles are the same, and
|
||||||
|
// arc paths with same start and end points don't render (at least on Safari)
|
||||||
|
var element = "<g transform=\"rotate(".concat(rotationAngle / Math.PI * 180, " ").concat(cx, ", ").concat(cy, ")\">\n <ellipse cx=\"").concat(cx, "\" cy=\"").concat(cy, "\" rx=\"").concat(rx, "\" ry=\"").concat(ry, "\" />\n </g>");
|
||||||
|
return {
|
||||||
|
bbox: bbox,
|
||||||
|
element: element
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
var startOffset = (0, _rotate["default"])({
|
||||||
|
x: Math.cos(startAngle) * rx,
|
||||||
|
y: Math.sin(startAngle) * ry
|
||||||
|
}, rotationAngle);
|
||||||
|
var startPoint = {
|
||||||
|
x: cx + startOffset.x,
|
||||||
|
y: cy + startOffset.y
|
||||||
|
};
|
||||||
|
var endOffset = (0, _rotate["default"])({
|
||||||
|
x: Math.cos(endAngle) * rx,
|
||||||
|
y: Math.sin(endAngle) * ry
|
||||||
|
}, rotationAngle);
|
||||||
|
var endPoint = {
|
||||||
|
x: cx + endOffset.x,
|
||||||
|
y: cy + endOffset.y
|
||||||
|
};
|
||||||
|
var adjustedEndAngle = endAngle < startAngle ? endAngle + Math.PI * 2 : endAngle;
|
||||||
|
var largeArcFlag = adjustedEndAngle - startAngle < Math.PI ? 0 : 1;
|
||||||
|
var d = "M ".concat(startPoint.x, " ").concat(startPoint.y, " A ").concat(rx, " ").concat(ry, " ").concat(rotationAngle / Math.PI * 180, " ").concat(largeArcFlag, " 1 ").concat(endPoint.x, " ").concat(endPoint.y);
|
||||||
|
|
||||||
|
var _element = "<path d=\"".concat(d, "\" />");
|
||||||
|
|
||||||
|
return {
|
||||||
|
bbox: bbox,
|
||||||
|
element: _element
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Compute the bounding box of an elliptical arc, given the DXF entity parameters
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
var bboxEllipseOrArc = function bboxEllipseOrArc(cx, cy, majorX, majorY, axisRatio, startAngle, endAngle, flipX) {
|
||||||
|
// The bounding box will be defined by the starting point of the ellipse, and ending point,
|
||||||
|
// and any extrema on the ellipse that are between startAngle and endAngle.
|
||||||
|
// The extrema are found by setting either the x or y component of the ellipse's
|
||||||
|
// tangent vector to zero and solving for the angle.
|
||||||
|
// Ensure start and end angles are > 0 and well-ordered
|
||||||
|
while (startAngle < 0) {
|
||||||
|
startAngle += Math.PI * 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (endAngle <= startAngle) {
|
||||||
|
endAngle += Math.PI * 2;
|
||||||
|
} // When rotated, the extrema of the ellipse will be found at these angles
|
||||||
|
|
||||||
|
|
||||||
|
var angles = [];
|
||||||
|
|
||||||
|
if (Math.abs(majorX) < 1e-12 || Math.abs(majorY) < 1e-12) {
|
||||||
|
// Special case for majorX or majorY = 0
|
||||||
|
for (var i = 0; i < 4; i++) {
|
||||||
|
angles.push(i / 2 * Math.PI);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// reference https://github.com/bjnortier/dxf/issues/47#issuecomment-545915042
|
||||||
|
angles[0] = Math.atan(-majorY * axisRatio / majorX) - Math.PI; // Ensure angles < 0
|
||||||
|
|
||||||
|
angles[1] = Math.atan(majorX * axisRatio / majorY) - Math.PI;
|
||||||
|
angles[2] = angles[0] - Math.PI;
|
||||||
|
angles[3] = angles[1] - Math.PI;
|
||||||
|
} // Remove angles not falling between start and end
|
||||||
|
|
||||||
|
|
||||||
|
for (var _i2 = 4; _i2 >= 0; _i2--) {
|
||||||
|
while (angles[_i2] < startAngle) {
|
||||||
|
angles[_i2] += Math.PI * 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (angles[_i2] > endAngle) {
|
||||||
|
angles.splice(_i2, 1);
|
||||||
|
}
|
||||||
|
} // Also to consider are the starting and ending points:
|
||||||
|
|
||||||
|
|
||||||
|
angles.push(startAngle);
|
||||||
|
angles.push(endAngle); // Compute points lying on the unit circle at these angles
|
||||||
|
|
||||||
|
var pts = angles.map(function (a) {
|
||||||
|
return {
|
||||||
|
x: Math.cos(a),
|
||||||
|
y: Math.sin(a)
|
||||||
|
};
|
||||||
|
}); // Transformation matrix, formed by the major and minor axes
|
||||||
|
|
||||||
|
var M = [[majorX, -majorY * axisRatio], [majorY, majorX * axisRatio]]; // Rotate, scale, and translate points
|
||||||
|
|
||||||
|
var rotatedPts = pts.map(function (p) {
|
||||||
|
return {
|
||||||
|
x: p.x * M[0][0] + p.y * M[0][1] + cx,
|
||||||
|
y: p.x * M[1][0] + p.y * M[1][1] + cy
|
||||||
|
};
|
||||||
|
}); // Compute extents of bounding box
|
||||||
|
|
||||||
|
var bbox = rotatedPts.reduce(function (acc, p) {
|
||||||
|
acc.expandByPoint(p);
|
||||||
|
return acc;
|
||||||
|
}, new _vecks.Box2());
|
||||||
|
return bbox;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* An ELLIPSE is defined by the major axis, convert to X and Y radius with
|
||||||
|
* a rotation angle
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
var ellipse = function ellipse(entity) {
|
||||||
|
var _ellipseOrArc = ellipseOrArc(entity.x, entity.y, entity.majorX, entity.majorY, entity.axisRatio, entity.startAngle, entity.endAngle),
|
||||||
|
bbox0 = _ellipseOrArc.bbox,
|
||||||
|
element0 = _ellipseOrArc.element;
|
||||||
|
|
||||||
|
var _addFlipXIfApplicable2 = addFlipXIfApplicable(entity, {
|
||||||
|
bbox: bbox0,
|
||||||
|
element: element0
|
||||||
|
}),
|
||||||
|
bbox = _addFlipXIfApplicable2.bbox,
|
||||||
|
element = _addFlipXIfApplicable2.element;
|
||||||
|
|
||||||
|
return (0, _transformBoundingBoxAndElement["default"])(bbox, element, entity.transforms);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* An ARC is an ellipse with equal radii
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
var arc = function arc(entity) {
|
||||||
|
var _ellipseOrArc2 = ellipseOrArc(entity.x, entity.y, entity.r, 0, 1, entity.startAngle, entity.endAngle, entity.extrusionZ === -1),
|
||||||
|
bbox0 = _ellipseOrArc2.bbox,
|
||||||
|
element0 = _ellipseOrArc2.element;
|
||||||
|
|
||||||
|
var _addFlipXIfApplicable3 = addFlipXIfApplicable(entity, {
|
||||||
|
bbox: bbox0,
|
||||||
|
element: element0
|
||||||
|
}),
|
||||||
|
bbox = _addFlipXIfApplicable3.bbox,
|
||||||
|
element = _addFlipXIfApplicable3.element;
|
||||||
|
|
||||||
|
return (0, _transformBoundingBoxAndElement["default"])(bbox, element, entity.transforms);
|
||||||
|
};
|
||||||
|
|
||||||
|
var piecewiseToPaths = function piecewiseToPaths(k, knots, controlPoints) {
|
||||||
|
var paths = [];
|
||||||
|
var controlPointIndex = 0;
|
||||||
|
var knotIndex = k;
|
||||||
|
|
||||||
|
while (knotIndex < knots.length - k + 1) {
|
||||||
|
var m = (0, _toPiecewiseBezier.multiplicity)(knots, knotIndex);
|
||||||
|
var cp = controlPoints.slice(controlPointIndex, controlPointIndex + k);
|
||||||
|
|
||||||
|
if (k === 4) {
|
||||||
|
paths.push("<path d=\"M ".concat(cp[0].x, " ").concat(cp[0].y, " C ").concat(cp[1].x, " ").concat(cp[1].y, " ").concat(cp[2].x, " ").concat(cp[2].y, " ").concat(cp[3].x, " ").concat(cp[3].y, "\" />"));
|
||||||
|
} else if (k === 3) {
|
||||||
|
paths.push("<path d=\"M ".concat(cp[0].x, " ").concat(cp[0].y, " Q ").concat(cp[1].x, " ").concat(cp[1].y, " ").concat(cp[2].x, " ").concat(cp[2].y, "\" />"));
|
||||||
|
}
|
||||||
|
|
||||||
|
controlPointIndex += m;
|
||||||
|
knotIndex += m;
|
||||||
|
}
|
||||||
|
|
||||||
|
return paths;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.piecewiseToPaths = piecewiseToPaths;
|
||||||
|
|
||||||
|
var bezier = function bezier(entity) {
|
||||||
|
var bbox = new _vecks.Box2();
|
||||||
|
entity.controlPoints.forEach(function (p) {
|
||||||
|
bbox = bbox.expandByPoint(p);
|
||||||
|
});
|
||||||
|
var k = entity.degree + 1;
|
||||||
|
var piecewise = (0, _toPiecewiseBezier["default"])(k, entity.controlPoints, entity.knots);
|
||||||
|
var paths = piecewiseToPaths(k, piecewise.knots, piecewise.controlPoints);
|
||||||
|
var element = "<g>".concat(paths.join(''), "</g>");
|
||||||
|
return (0, _transformBoundingBoxAndElement["default"])(bbox, element, entity.transforms);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Switcth the appropriate function on entity type. CIRCLE, ARC and ELLIPSE
|
||||||
|
* produce native SVG elements, the rest produce interpolated polylines.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
var entityToBoundsAndElement = function entityToBoundsAndElement(entity) {
|
||||||
|
switch (entity.type) {
|
||||||
|
case 'CIRCLE':
|
||||||
|
return circle(entity);
|
||||||
|
|
||||||
|
case 'ELLIPSE':
|
||||||
|
return ellipse(entity);
|
||||||
|
|
||||||
|
case 'ARC':
|
||||||
|
return arc(entity);
|
||||||
|
|
||||||
|
case 'SPLINE':
|
||||||
|
{
|
||||||
|
if (entity.degree === 2 || entity.degree === 3) {
|
||||||
|
try {
|
||||||
|
return bezier(entity);
|
||||||
|
} catch (err) {
|
||||||
|
return polyline(entity);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return polyline(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'LINE':
|
||||||
|
case 'LWPOLYLINE':
|
||||||
|
case 'POLYLINE':
|
||||||
|
{
|
||||||
|
return polyline(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
_logger["default"].warn('entity type not supported in SVG rendering:', entity.type);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var _default = function _default(parsed) {
|
||||||
|
var entities = (0, _denormalise["default"])(parsed);
|
||||||
|
|
||||||
|
var _entities$reduce = entities.reduce(function (acc, entity, i) {
|
||||||
|
var rgb = (0, _getRGBForEntity["default"])(parsed.tables.layers, entity);
|
||||||
|
var boundsAndElement = entityToBoundsAndElement(entity); // Ignore entities like MTEXT that don't produce SVG elements
|
||||||
|
|
||||||
|
if (boundsAndElement) {
|
||||||
|
var _bbox = boundsAndElement.bbox,
|
||||||
|
element = boundsAndElement.element; // Ignore invalid bounding boxes
|
||||||
|
|
||||||
|
if (_bbox.valid) {
|
||||||
|
acc.bbox.expandByPoint(_bbox.min);
|
||||||
|
acc.bbox.expandByPoint(_bbox.max);
|
||||||
|
}
|
||||||
|
|
||||||
|
acc.elements.push("<g stroke=\"".concat((0, _rgbToColorAttribute["default"])(rgb), "\">").concat(element, "</g>"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
}, {
|
||||||
|
bbox: new _vecks.Box2(),
|
||||||
|
elements: []
|
||||||
|
}),
|
||||||
|
bbox = _entities$reduce.bbox,
|
||||||
|
elements = _entities$reduce.elements;
|
||||||
|
|
||||||
|
var viewBox = bbox.valid ? {
|
||||||
|
x: bbox.min.x,
|
||||||
|
y: -bbox.max.y,
|
||||||
|
width: bbox.max.x - bbox.min.x,
|
||||||
|
height: bbox.max.y - bbox.min.y
|
||||||
|
} : {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
width: 0,
|
||||||
|
height: 0
|
||||||
|
};
|
||||||
|
return "<?xml version=\"1.0\"?>\n<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\" version=\"1.1\"\n preserveAspectRatio=\"xMinYMin meet\"\n viewBox=\"".concat(viewBox.x, " ").concat(viewBox.y, " ").concat(viewBox.width, " ").concat(viewBox.height, "\"\n width=\"100%\" height=\"100%\"\n>\n <g stroke=\"#000000\" stroke-width=\"0.1%\" fill=\"none\" transform=\"matrix(1,0,0,-1,0,0)\">\n ").concat(_prettyData.pd.xml(elements.join('\n')), "\n </g>\n</svg>");
|
||||||
|
};
|
||||||
|
|
||||||
|
exports["default"] = _default;
|
104
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/util/bSpline.js
generated
vendored
Normal file
104
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/util/bSpline.js
generated
vendored
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = void 0;
|
||||||
|
|
||||||
|
var _round = require("round10");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copied and ported to code standard as the b-spline library is not maintained any longer.
|
||||||
|
* Source:
|
||||||
|
* https://github.com/thibauts/b-spline
|
||||||
|
* Copyright (c) 2015 Thibaut Séguy <thibaut.seguy@gmail.com>
|
||||||
|
*/
|
||||||
|
var _default = function _default(t, degree, points, knots, weights) {
|
||||||
|
var n = points.length; // points count
|
||||||
|
|
||||||
|
var d = points[0].length; // point dimensionality
|
||||||
|
|
||||||
|
if (t < 0 || t > 1) {
|
||||||
|
throw new Error('t out of bounds [0,1]: ' + t);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (degree < 1) throw new Error('degree must be at least 1 (linear)');
|
||||||
|
if (degree > n - 1) throw new Error('degree must be less than or equal to point count - 1');
|
||||||
|
|
||||||
|
if (!weights) {
|
||||||
|
// build weight vector of length [n]
|
||||||
|
weights = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < n; i++) {
|
||||||
|
weights[i] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!knots) {
|
||||||
|
// build knot vector of length [n + degree + 1]
|
||||||
|
knots = [];
|
||||||
|
|
||||||
|
for (var _i = 0; _i < n + degree + 1; _i++) {
|
||||||
|
knots[_i] = _i;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (knots.length !== n + degree + 1) throw new Error('bad knot vector length');
|
||||||
|
}
|
||||||
|
|
||||||
|
var domain = [degree, knots.length - 1 - degree]; // remap t to the domain where the spline is defined
|
||||||
|
|
||||||
|
var low = knots[domain[0]];
|
||||||
|
var high = knots[domain[1]];
|
||||||
|
t = t * (high - low) + low; // Clamp to the upper & lower bounds instead of
|
||||||
|
// throwing an error like in the original lib
|
||||||
|
// https://github.com/bjnortier/dxf/issues/28
|
||||||
|
|
||||||
|
t = Math.max(t, low);
|
||||||
|
t = Math.min(t, high); // find s (the spline segment) for the [t] value provided
|
||||||
|
|
||||||
|
var s;
|
||||||
|
|
||||||
|
for (s = domain[0]; s < domain[1]; s++) {
|
||||||
|
if (t >= knots[s] && t <= knots[s + 1]) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} // convert points to homogeneous coordinates
|
||||||
|
|
||||||
|
|
||||||
|
var v = [];
|
||||||
|
|
||||||
|
for (var _i2 = 0; _i2 < n; _i2++) {
|
||||||
|
v[_i2] = [];
|
||||||
|
|
||||||
|
for (var j = 0; j < d; j++) {
|
||||||
|
v[_i2][j] = points[_i2][j] * weights[_i2];
|
||||||
|
}
|
||||||
|
|
||||||
|
v[_i2][d] = weights[_i2];
|
||||||
|
} // l (level) goes from 1 to the curve degree + 1
|
||||||
|
|
||||||
|
|
||||||
|
var alpha;
|
||||||
|
|
||||||
|
for (var l = 1; l <= degree + 1; l++) {
|
||||||
|
// build level l of the pyramid
|
||||||
|
for (var _i3 = s; _i3 > s - degree - 1 + l; _i3--) {
|
||||||
|
alpha = (t - knots[_i3]) / (knots[_i3 + degree + 1 - l] - knots[_i3]); // interpolate each component
|
||||||
|
|
||||||
|
for (var _j = 0; _j < d + 1; _j++) {
|
||||||
|
v[_i3][_j] = (1 - alpha) * v[_i3 - 1][_j] + alpha * v[_i3][_j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // convert back to cartesian and return
|
||||||
|
|
||||||
|
|
||||||
|
var result = [];
|
||||||
|
|
||||||
|
for (var _i4 = 0; _i4 < d; _i4++) {
|
||||||
|
result[_i4] = (0, _round.round10)(v[s][_i4] / v[s][d], -9);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports["default"] = _default;
|
8
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/util/colors.js
generated
vendored
Normal file
8
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/util/colors.js
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = void 0;
|
||||||
|
var _default = [[0, 0, 0], [255, 0, 0], [255, 255, 0], [0, 255, 0], [0, 255, 255], [0, 0, 255], [255, 0, 255], [255, 255, 255], [65, 65, 65], [128, 128, 128], [255, 0, 0], [255, 170, 170], [189, 0, 0], [189, 126, 126], [129, 0, 0], [129, 86, 86], [104, 0, 0], [104, 69, 69], [79, 0, 0], [79, 53, 53], [255, 63, 0], [255, 191, 170], [189, 46, 0], [189, 141, 126], [129, 31, 0], [129, 96, 86], [104, 25, 0], [104, 78, 69], [79, 19, 0], [79, 59, 53], [255, 127, 0], [255, 212, 170], [189, 94, 0], [189, 157, 126], [129, 64, 0], [129, 107, 86], [104, 52, 0], [104, 86, 69], [79, 39, 0], [79, 66, 53], [255, 191, 0], [255, 234, 170], [189, 141, 0], [189, 173, 126], [129, 96, 0], [129, 118, 86], [104, 78, 0], [104, 95, 69], [79, 59, 0], [79, 73, 53], [255, 255, 0], [255, 255, 170], [189, 189, 0], [189, 189, 126], [129, 129, 0], [129, 129, 86], [104, 104, 0], [104, 104, 69], [79, 79, 0], [79, 79, 53], [191, 255, 0], [234, 255, 170], [141, 189, 0], [173, 189, 126], [96, 129, 0], [118, 129, 86], [78, 104, 0], [95, 104, 69], [59, 79, 0], [73, 79, 53], [127, 255, 0], [212, 255, 170], [94, 189, 0], [157, 189, 126], [64, 129, 0], [107, 129, 86], [52, 104, 0], [86, 104, 69], [39, 79, 0], [66, 79, 53], [63, 255, 0], [191, 255, 170], [46, 189, 0], [141, 189, 126], [31, 129, 0], [96, 129, 86], [25, 104, 0], [78, 104, 69], [19, 79, 0], [59, 79, 53], [0, 255, 0], [170, 255, 170], [0, 189, 0], [126, 189, 126], [0, 129, 0], [86, 129, 86], [0, 104, 0], [69, 104, 69], [0, 79, 0], [53, 79, 53], [0, 255, 63], [170, 255, 191], [0, 189, 46], [126, 189, 141], [0, 129, 31], [86, 129, 96], [0, 104, 25], [69, 104, 78], [0, 79, 19], [53, 79, 59], [0, 255, 127], [170, 255, 212], [0, 189, 94], [126, 189, 157], [0, 129, 64], [86, 129, 107], [0, 104, 52], [69, 104, 86], [0, 79, 39], [53, 79, 66], [0, 255, 191], [170, 255, 234], [0, 189, 141], [126, 189, 173], [0, 129, 96], [86, 129, 118], [0, 104, 78], [69, 104, 95], [0, 79, 59], [53, 79, 73], [0, 255, 255], [170, 255, 255], [0, 189, 189], [126, 189, 189], [0, 129, 129], [86, 129, 129], [0, 104, 104], [69, 104, 104], [0, 79, 79], [53, 79, 79], [0, 191, 255], [170, 234, 255], [0, 141, 189], [126, 173, 189], [0, 96, 129], [86, 118, 129], [0, 78, 104], [69, 95, 104], [0, 59, 79], [53, 73, 79], [0, 127, 255], [170, 212, 255], [0, 94, 189], [126, 157, 189], [0, 64, 129], [86, 107, 129], [0, 52, 104], [69, 86, 104], [0, 39, 79], [53, 66, 79], [0, 63, 255], [170, 191, 255], [0, 46, 189], [126, 141, 189], [0, 31, 129], [86, 96, 129], [0, 25, 104], [69, 78, 104], [0, 19, 79], [53, 59, 79], [0, 0, 255], [170, 170, 255], [0, 0, 189], [126, 126, 189], [0, 0, 129], [86, 86, 129], [0, 0, 104], [69, 69, 104], [0, 0, 79], [53, 53, 79], [63, 0, 255], [191, 170, 255], [46, 0, 189], [141, 126, 189], [31, 0, 129], [96, 86, 129], [25, 0, 104], [78, 69, 104], [19, 0, 79], [59, 53, 79], [127, 0, 255], [212, 170, 255], [94, 0, 189], [157, 126, 189], [64, 0, 129], [107, 86, 129], [52, 0, 104], [86, 69, 104], [39, 0, 79], [66, 53, 79], [191, 0, 255], [234, 170, 255], [141, 0, 189], [173, 126, 189], [96, 0, 129], [118, 86, 129], [78, 0, 104], [95, 69, 104], [59, 0, 79], [73, 53, 79], [255, 0, 255], [255, 170, 255], [189, 0, 189], [189, 126, 189], [129, 0, 129], [129, 86, 129], [104, 0, 104], [104, 69, 104], [79, 0, 79], [79, 53, 79], [255, 0, 191], [255, 170, 234], [189, 0, 141], [189, 126, 173], [129, 0, 96], [129, 86, 118], [104, 0, 78], [104, 69, 95], [79, 0, 59], [79, 53, 73], [255, 0, 127], [255, 170, 212], [189, 0, 94], [189, 126, 157], [129, 0, 64], [129, 86, 107], [104, 0, 52], [104, 69, 86], [79, 0, 39], [79, 53, 66], [255, 0, 63], [255, 170, 191], [189, 0, 46], [189, 126, 141], [129, 0, 31], [129, 86, 96], [104, 0, 25], [104, 69, 78], [79, 0, 19], [79, 53, 59], [51, 51, 51], [80, 80, 80], [105, 105, 105], [130, 130, 130], [190, 190, 190], [255, 255, 255]];
|
||||||
|
exports["default"] = _default;
|
85
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/util/createArcForLWPolyline.js
generated
vendored
Normal file
85
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/util/createArcForLWPolyline.js
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = void 0;
|
||||||
|
|
||||||
|
var _vecks = require("vecks");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the arcs point for a LWPOLYLINE. The start and end are excluded
|
||||||
|
*
|
||||||
|
* See diagram.png in this directory for description of points and angles used.
|
||||||
|
*/
|
||||||
|
var _default = function _default(from, to, bulge, resolution) {
|
||||||
|
// Resolution in degrees
|
||||||
|
if (!resolution) {
|
||||||
|
resolution = 5;
|
||||||
|
} // If the bulge is < 0, the arc goes clockwise. So we simply
|
||||||
|
// reverse a and b and invert sign
|
||||||
|
// Bulge = tan(theta/4)
|
||||||
|
|
||||||
|
|
||||||
|
var theta;
|
||||||
|
var a;
|
||||||
|
var b;
|
||||||
|
|
||||||
|
if (bulge < 0) {
|
||||||
|
theta = Math.atan(-bulge) * 4;
|
||||||
|
a = new _vecks.V2(from[0], from[1]);
|
||||||
|
b = new _vecks.V2(to[0], to[1]);
|
||||||
|
} else {
|
||||||
|
// Default is counter-clockwise
|
||||||
|
theta = Math.atan(bulge) * 4;
|
||||||
|
a = new _vecks.V2(to[0], to[1]);
|
||||||
|
b = new _vecks.V2(from[0], from[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
var ab = b.sub(a);
|
||||||
|
var lengthAB = ab.length();
|
||||||
|
var c = a.add(ab.multiply(0.5)); // Distance from center of arc to line between form and to points
|
||||||
|
|
||||||
|
var lengthCD = Math.abs(lengthAB / 2 / Math.tan(theta / 2));
|
||||||
|
var normAB = ab.norm();
|
||||||
|
var d;
|
||||||
|
|
||||||
|
if (theta < Math.PI) {
|
||||||
|
var normDC = new _vecks.V2(normAB.x * Math.cos(Math.PI / 2) - normAB.y * Math.sin(Math.PI / 2), normAB.y * Math.cos(Math.PI / 2) + normAB.x * Math.sin(Math.PI / 2)); // D is the center of the arc
|
||||||
|
|
||||||
|
d = c.add(normDC.multiply(-lengthCD));
|
||||||
|
} else {
|
||||||
|
var normCD = new _vecks.V2(normAB.x * Math.cos(Math.PI / 2) - normAB.y * Math.sin(Math.PI / 2), normAB.y * Math.cos(Math.PI / 2) + normAB.x * Math.sin(Math.PI / 2)); // D is the center of the arc
|
||||||
|
|
||||||
|
d = c.add(normCD.multiply(lengthCD));
|
||||||
|
} // Add points between start start and eng angle relative
|
||||||
|
// to the center point
|
||||||
|
|
||||||
|
|
||||||
|
var startAngle = Math.atan2(b.y - d.y, b.x - d.x) / Math.PI * 180;
|
||||||
|
var endAngle = Math.atan2(a.y - d.y, a.x - d.x) / Math.PI * 180;
|
||||||
|
|
||||||
|
if (endAngle < startAngle) {
|
||||||
|
endAngle += 360;
|
||||||
|
}
|
||||||
|
|
||||||
|
var r = b.sub(d).length();
|
||||||
|
var startInter = Math.floor(startAngle / resolution) * resolution + resolution;
|
||||||
|
var endInter = Math.ceil(endAngle / resolution) * resolution - resolution;
|
||||||
|
var points = [];
|
||||||
|
|
||||||
|
for (var i = startInter; i <= endInter; i += resolution) {
|
||||||
|
points.push(d.add(new _vecks.V2(Math.cos(i / 180 * Math.PI) * r, Math.sin(i / 180 * Math.PI) * r)));
|
||||||
|
} // Maintain the right ordering to join the from and to points
|
||||||
|
|
||||||
|
|
||||||
|
if (bulge < 0) {
|
||||||
|
points.reverse();
|
||||||
|
}
|
||||||
|
|
||||||
|
return points.map(function (p) {
|
||||||
|
return [p.x, p.y];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports["default"] = _default;
|
79
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/util/insertKnot.js
generated
vendored
Normal file
79
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/util/insertKnot.js
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = void 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Knot insertion is known as "Boehm's algorithm"
|
||||||
|
*
|
||||||
|
* https://math.stackexchange.com/questions/417859/convert-a-b-spline-into-bezier-curves
|
||||||
|
* code adapted from http://preserve.mactech.com/articles/develop/issue_25/schneider.html
|
||||||
|
*/
|
||||||
|
var _default = function _default(k, controlPoints, knots, newKnot) {
|
||||||
|
var x = knots;
|
||||||
|
var b = controlPoints;
|
||||||
|
var n = controlPoints.length;
|
||||||
|
var i = 0;
|
||||||
|
var foundIndex = false;
|
||||||
|
|
||||||
|
for (var j = 0; j < n + k; j++) {
|
||||||
|
if (newKnot > x[j] && newKnot <= x[j + 1]) {
|
||||||
|
i = j;
|
||||||
|
foundIndex = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!foundIndex) {
|
||||||
|
throw new Error('invalid new knot');
|
||||||
|
}
|
||||||
|
|
||||||
|
var xHat = [];
|
||||||
|
|
||||||
|
for (var _j = 0; _j < n + k + 1; _j++) {
|
||||||
|
if (_j <= i) {
|
||||||
|
xHat[_j] = x[_j];
|
||||||
|
} else if (_j === i + 1) {
|
||||||
|
xHat[_j] = newKnot;
|
||||||
|
} else {
|
||||||
|
xHat[_j] = x[_j - 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var alpha;
|
||||||
|
var bHat = [];
|
||||||
|
|
||||||
|
for (var _j2 = 0; _j2 < n + 1; _j2++) {
|
||||||
|
if (_j2 <= i - k + 1) {
|
||||||
|
alpha = 1;
|
||||||
|
} else if (i - k + 2 <= _j2 && _j2 <= i) {
|
||||||
|
if (x[_j2 + k - 1] - x[_j2] === 0) {
|
||||||
|
alpha = 0;
|
||||||
|
} else {
|
||||||
|
alpha = (newKnot - x[_j2]) / (x[_j2 + k - 1] - x[_j2]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
alpha = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (alpha === 0) {
|
||||||
|
bHat[_j2] = b[_j2 - 1];
|
||||||
|
} else if (alpha === 1) {
|
||||||
|
bHat[_j2] = b[_j2];
|
||||||
|
} else {
|
||||||
|
bHat[_j2] = {
|
||||||
|
x: (1 - alpha) * b[_j2 - 1].x + alpha * b[_j2].x,
|
||||||
|
y: (1 - alpha) * b[_j2 - 1].y + alpha * b[_j2].y
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
controlPoints: bHat,
|
||||||
|
knots: xHat
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
exports["default"] = _default;
|
33
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/util/logger.js
generated
vendored
Normal file
33
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/util/logger.js
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = void 0;
|
||||||
|
|
||||||
|
var _config = _interopRequireDefault(require("../config"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
|
function info() {
|
||||||
|
if (_config["default"].verbose) {
|
||||||
|
console.info.apply(undefined, arguments);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function warn() {
|
||||||
|
if (_config["default"].verbose) {
|
||||||
|
console.warn.apply(undefined, arguments);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function error() {
|
||||||
|
console.error.apply(undefined, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
var _default = {
|
||||||
|
info: info,
|
||||||
|
warn: warn,
|
||||||
|
error: error
|
||||||
|
};
|
||||||
|
exports["default"] = _default;
|
20
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/util/rgbToColorAttribute.js
generated
vendored
Normal file
20
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/util/rgbToColorAttribute.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = void 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert an RGB array to a CSS string definition.
|
||||||
|
* Converts white lines to black as the default.
|
||||||
|
*/
|
||||||
|
var _default = function _default(rgb) {
|
||||||
|
if (rgb[0] === 255 && rgb[1] === 255 && rgb[2] === 255) {
|
||||||
|
return 'rgb(0, 0, 0)';
|
||||||
|
} else {
|
||||||
|
return "rgb(".concat(rgb[0], ", ").concat(rgb[1], ", ").concat(rgb[2], ")");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports["default"] = _default;
|
21
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/util/rotate.js
generated
vendored
Normal file
21
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/util/rotate.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = void 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotate a points by the given angle.
|
||||||
|
*
|
||||||
|
* @param points the points
|
||||||
|
* @param angle the rotation angle
|
||||||
|
*/
|
||||||
|
var _default = function _default(p, angle) {
|
||||||
|
return {
|
||||||
|
x: p.x * Math.cos(angle) - p.y * Math.sin(angle),
|
||||||
|
y: p.y * Math.cos(angle) + p.x * Math.sin(angle)
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
exports["default"] = _default;
|
90
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/util/toPiecewiseBezier.js
generated
vendored
Normal file
90
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/util/toPiecewiseBezier.js
generated
vendored
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = exports.computeInsertions = exports.multiplicity = exports.checkPinned = void 0;
|
||||||
|
|
||||||
|
var _insertKnot = _interopRequireDefault(require("./insertKnot"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For a pinned spline, the knots have to be repeated k times
|
||||||
|
* (where k is the order), at both the beginning and the end
|
||||||
|
*/
|
||||||
|
var checkPinned = function checkPinned(k, knots) {
|
||||||
|
// Pinned at the start
|
||||||
|
for (var i = 1; i < k; ++i) {
|
||||||
|
if (knots[i] !== knots[0]) {
|
||||||
|
throw Error("not pinned. order: ".concat(k, " knots: ").concat(knots));
|
||||||
|
}
|
||||||
|
} // Pinned at the end
|
||||||
|
|
||||||
|
|
||||||
|
for (var _i = knots.length - 2; _i > knots.length - k - 1; --_i) {
|
||||||
|
if (knots[_i] !== knots[knots.length - 1]) {
|
||||||
|
throw Error("not pinned. order: ".concat(k, " knots: ").concat(knots));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.checkPinned = checkPinned;
|
||||||
|
|
||||||
|
var multiplicity = function multiplicity(knots, index) {
|
||||||
|
var m = 1;
|
||||||
|
|
||||||
|
for (var i = index + 1; i < knots.length; ++i) {
|
||||||
|
if (knots[i] === knots[index]) {
|
||||||
|
++m;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return m;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* https://saccade.com/writing/graphics/KnotVectors.pdf
|
||||||
|
* A quadratic piecewise Bézier knot vector with seven control points
|
||||||
|
* will look like this [0 0 0 1 1 2 2 3 3 3]. In general, in a
|
||||||
|
* piecewise Bézier knot vector the first k knots are the same,
|
||||||
|
* then each subsequent group of k-1 knots is the same,
|
||||||
|
* until you get to the end.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
exports.multiplicity = multiplicity;
|
||||||
|
|
||||||
|
var computeInsertions = function computeInsertions(k, knots) {
|
||||||
|
var inserts = [];
|
||||||
|
var i = k;
|
||||||
|
|
||||||
|
while (i < knots.length - k) {
|
||||||
|
var knot = knots[i];
|
||||||
|
var m = multiplicity(knots, i);
|
||||||
|
|
||||||
|
for (var j = 0; j < k - m - 1; ++j) {
|
||||||
|
inserts.push(knot);
|
||||||
|
}
|
||||||
|
|
||||||
|
i = i + m;
|
||||||
|
}
|
||||||
|
|
||||||
|
return inserts;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.computeInsertions = computeInsertions;
|
||||||
|
|
||||||
|
var _default = function _default(k, controlPoints, knots) {
|
||||||
|
checkPinned(k, knots);
|
||||||
|
var insertions = computeInsertions(k, knots);
|
||||||
|
return insertions.reduce(function (acc, tNew) {
|
||||||
|
return (0, _insertKnot["default"])(k, acc.controlPoints, acc.knots, tNew);
|
||||||
|
}, {
|
||||||
|
controlPoints: controlPoints,
|
||||||
|
knots: knots
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports["default"] = _default;
|
118
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/util/transformBoundingBoxAndElement.js
generated
vendored
Normal file
118
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/lib/util/transformBoundingBoxAndElement.js
generated
vendored
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports["default"] = void 0;
|
||||||
|
|
||||||
|
var _vecks = require("vecks");
|
||||||
|
|
||||||
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||||
|
|
||||||
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||||
|
|
||||||
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||||
|
|
||||||
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||||
|
|
||||||
|
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||||
|
|
||||||
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transform the bounding box and the SVG element by the given
|
||||||
|
* transforms. The <g> element are created in reverse transform
|
||||||
|
* order and the bounding box in the given order.
|
||||||
|
*/
|
||||||
|
var _default = function _default(bbox, element, transforms) {
|
||||||
|
var transformedElement = '';
|
||||||
|
var matrices = transforms.map(function (transform) {
|
||||||
|
// Create the transformation matrix
|
||||||
|
var tx = transform.x || 0;
|
||||||
|
var ty = transform.y || 0;
|
||||||
|
var sx = transform.scaleX || 1;
|
||||||
|
var sy = transform.scaleY || 1;
|
||||||
|
var angle = (transform.rotation || 0) / 180 * Math.PI;
|
||||||
|
var cos = Math.cos,
|
||||||
|
sin = Math.sin;
|
||||||
|
var a, b, c, d, e, f; // In DXF an extrusionZ value of -1 denote a tranform around the Y axis.
|
||||||
|
|
||||||
|
if (transform.extrusionZ === -1) {
|
||||||
|
a = -sx * cos(angle);
|
||||||
|
b = sx * sin(angle);
|
||||||
|
c = sy * sin(angle);
|
||||||
|
d = sy * cos(angle);
|
||||||
|
e = -tx;
|
||||||
|
f = ty;
|
||||||
|
} else {
|
||||||
|
a = sx * cos(angle);
|
||||||
|
b = sx * sin(angle);
|
||||||
|
c = -sy * sin(angle);
|
||||||
|
d = sy * cos(angle);
|
||||||
|
e = tx;
|
||||||
|
f = ty;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [a, b, c, d, e, f];
|
||||||
|
}); // Only transform the bounding box is it is valid (i.e. not Infinity)
|
||||||
|
|
||||||
|
var transformedBBox = new _vecks.Box2();
|
||||||
|
|
||||||
|
if (bbox.valid) {
|
||||||
|
var bboxPoints = [{
|
||||||
|
x: bbox.min.x,
|
||||||
|
y: bbox.min.y
|
||||||
|
}, {
|
||||||
|
x: bbox.max.x,
|
||||||
|
y: bbox.min.y
|
||||||
|
}, {
|
||||||
|
x: bbox.max.x,
|
||||||
|
y: bbox.max.y
|
||||||
|
}, {
|
||||||
|
x: bbox.min.x,
|
||||||
|
y: bbox.max.y
|
||||||
|
}];
|
||||||
|
matrices.forEach(function (_ref) {
|
||||||
|
var _ref2 = _slicedToArray(_ref, 6),
|
||||||
|
a = _ref2[0],
|
||||||
|
b = _ref2[1],
|
||||||
|
c = _ref2[2],
|
||||||
|
d = _ref2[3],
|
||||||
|
e = _ref2[4],
|
||||||
|
f = _ref2[5];
|
||||||
|
|
||||||
|
bboxPoints = bboxPoints.map(function (point) {
|
||||||
|
return {
|
||||||
|
x: point.x * a + point.y * c + e,
|
||||||
|
y: point.x * b + point.y * d + f
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
transformedBBox = bboxPoints.reduce(function (acc, point) {
|
||||||
|
return acc.expandByPoint(point);
|
||||||
|
}, new _vecks.Box2());
|
||||||
|
}
|
||||||
|
|
||||||
|
matrices.reverse();
|
||||||
|
matrices.forEach(function (_ref3) {
|
||||||
|
var _ref4 = _slicedToArray(_ref3, 6),
|
||||||
|
a = _ref4[0],
|
||||||
|
b = _ref4[1],
|
||||||
|
c = _ref4[2],
|
||||||
|
d = _ref4[3],
|
||||||
|
e = _ref4[4],
|
||||||
|
f = _ref4[5];
|
||||||
|
|
||||||
|
transformedElement += "<g transform=\"matrix(".concat(a, " ").concat(b, " ").concat(c, " ").concat(d, " ").concat(e, " ").concat(f, ")\">");
|
||||||
|
});
|
||||||
|
transformedElement += element;
|
||||||
|
matrices.forEach(function (transform) {
|
||||||
|
transformedElement += '</g>';
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
bbox: transformedBBox,
|
||||||
|
element: transformedElement
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
exports["default"] = _default;
|
419
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/node_modules/commander/CHANGELOG.md
generated
vendored
Normal file
419
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/node_modules/commander/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,419 @@
|
|||||||
|
2.20.3 / 2019-10-11
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Support Node.js 0.10 (Revert #1059)
|
||||||
|
* Ran "npm unpublish commander@2.20.2". There is no 2.20.2.
|
||||||
|
|
||||||
|
2.20.1 / 2019-09-29
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Improve executable subcommand tracking
|
||||||
|
* Update dev dependencies
|
||||||
|
|
||||||
|
2.20.0 / 2019-04-02
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix: resolve symbolic links completely when hunting for subcommands (#935)
|
||||||
|
* Update index.d.ts (#930)
|
||||||
|
* Update Readme.md (#924)
|
||||||
|
* Remove --save option as it isn't required anymore (#918)
|
||||||
|
* Add link to the license file (#900)
|
||||||
|
* Added example of receiving args from options (#858)
|
||||||
|
* Added missing semicolon (#882)
|
||||||
|
* Add extension to .eslintrc (#876)
|
||||||
|
|
||||||
|
2.19.0 / 2018-10-02
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Removed newline after Options and Commands headers (#864)
|
||||||
|
* Bugfix - Error output (#862)
|
||||||
|
* Fix to change default value to string (#856)
|
||||||
|
|
||||||
|
2.18.0 / 2018-09-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Standardize help output (#853)
|
||||||
|
* chmod 644 travis.yml (#851)
|
||||||
|
* add support for execute typescript subcommand via ts-node (#849)
|
||||||
|
|
||||||
|
2.17.1 / 2018-08-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix bug in command emit (#844)
|
||||||
|
|
||||||
|
2.17.0 / 2018-08-03
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fixed newline output after help information (#833)
|
||||||
|
* Fix to emit the action even without command (#778)
|
||||||
|
* npm update (#823)
|
||||||
|
|
||||||
|
2.16.0 / 2018-06-29
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Remove Makefile and `test/run` (#821)
|
||||||
|
* Make 'npm test' run on Windows (#820)
|
||||||
|
* Add badge to display install size (#807)
|
||||||
|
* chore: cache node_modules (#814)
|
||||||
|
* chore: remove Node.js 4 (EOL), add Node.js 10 (#813)
|
||||||
|
* fixed typo in readme (#812)
|
||||||
|
* Fix types (#804)
|
||||||
|
* Update eslint to resolve vulnerabilities in lodash (#799)
|
||||||
|
* updated readme with custom event listeners. (#791)
|
||||||
|
* fix tests (#794)
|
||||||
|
|
||||||
|
2.15.0 / 2018-03-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Update downloads badge to point to graph of downloads over time instead of duplicating link to npm
|
||||||
|
* Arguments description
|
||||||
|
|
||||||
|
2.14.1 / 2018-02-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix typing of help function
|
||||||
|
|
||||||
|
2.14.0 / 2018-02-05
|
||||||
|
==================
|
||||||
|
|
||||||
|
* only register the option:version event once
|
||||||
|
* Fixes issue #727: Passing empty string for option on command is set to undefined
|
||||||
|
* enable eqeqeq rule
|
||||||
|
* resolves #754 add linter configuration to project
|
||||||
|
* resolves #560 respect custom name for version option
|
||||||
|
* document how to override the version flag
|
||||||
|
* document using options per command
|
||||||
|
|
||||||
|
2.13.0 / 2018-01-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Do not print default for --no-
|
||||||
|
* remove trailing spaces in command help
|
||||||
|
* Update CI's Node.js to LTS and latest version
|
||||||
|
* typedefs: Command and Option types added to commander namespace
|
||||||
|
|
||||||
|
2.12.2 / 2017-11-28
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix: typings are not shipped
|
||||||
|
|
||||||
|
2.12.1 / 2017-11-23
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Move @types/node to dev dependency
|
||||||
|
|
||||||
|
2.12.0 / 2017-11-22
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add attributeName() method to Option objects
|
||||||
|
* Documentation updated for options with --no prefix
|
||||||
|
* typings: `outputHelp` takes a string as the first parameter
|
||||||
|
* typings: use overloads
|
||||||
|
* feat(typings): update to match js api
|
||||||
|
* Print default value in option help
|
||||||
|
* Fix translation error
|
||||||
|
* Fail when using same command and alias (#491)
|
||||||
|
* feat(typings): add help callback
|
||||||
|
* fix bug when description is add after command with options (#662)
|
||||||
|
* Format js code
|
||||||
|
* Rename History.md to CHANGELOG.md (#668)
|
||||||
|
* feat(typings): add typings to support TypeScript (#646)
|
||||||
|
* use current node
|
||||||
|
|
||||||
|
2.11.0 / 2017-07-03
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix help section order and padding (#652)
|
||||||
|
* feature: support for signals to subcommands (#632)
|
||||||
|
* Fixed #37, --help should not display first (#447)
|
||||||
|
* Fix translation errors. (#570)
|
||||||
|
* Add package-lock.json
|
||||||
|
* Remove engines
|
||||||
|
* Upgrade package version
|
||||||
|
* Prefix events to prevent conflicts between commands and options (#494)
|
||||||
|
* Removing dependency on graceful-readlink
|
||||||
|
* Support setting name in #name function and make it chainable
|
||||||
|
* Add .vscode directory to .gitignore (Visual Studio Code metadata)
|
||||||
|
* Updated link to ruby commander in readme files
|
||||||
|
|
||||||
|
2.10.0 / 2017-06-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Update .travis.yml. drop support for older node.js versions.
|
||||||
|
* Fix require arguments in README.md
|
||||||
|
* On SemVer you do not start from 0.0.1
|
||||||
|
* Add missing semi colon in readme
|
||||||
|
* Add save param to npm install
|
||||||
|
* node v6 travis test
|
||||||
|
* Update Readme_zh-CN.md
|
||||||
|
* Allow literal '--' to be passed-through as an argument
|
||||||
|
* Test subcommand alias help
|
||||||
|
* link build badge to master branch
|
||||||
|
* Support the alias of Git style sub-command
|
||||||
|
* added keyword commander for better search result on npm
|
||||||
|
* Fix Sub-Subcommands
|
||||||
|
* test node.js stable
|
||||||
|
* Fixes TypeError when a command has an option called `--description`
|
||||||
|
* Update README.md to make it beginner friendly and elaborate on the difference between angled and square brackets.
|
||||||
|
* Add chinese Readme file
|
||||||
|
|
||||||
|
2.9.0 / 2015-10-13
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Add option `isDefault` to set default subcommand #415 @Qix-
|
||||||
|
* Add callback to allow filtering or post-processing of help text #434 @djulien
|
||||||
|
* Fix `undefined` text in help information close #414 #416 @zhiyelee
|
||||||
|
|
||||||
|
2.8.1 / 2015-04-22
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Back out `support multiline description` Close #396 #397
|
||||||
|
|
||||||
|
2.8.0 / 2015-04-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Add `process.execArg` support, execution args like `--harmony` will be passed to sub-commands #387 @DigitalIO @zhiyelee
|
||||||
|
* Fix bug in Git-style sub-commands #372 @zhiyelee
|
||||||
|
* Allow commands to be hidden from help #383 @tonylukasavage
|
||||||
|
* When git-style sub-commands are in use, yet none are called, display help #382 @claylo
|
||||||
|
* Add ability to specify arguments syntax for top-level command #258 @rrthomas
|
||||||
|
* Support multiline descriptions #208 @zxqfox
|
||||||
|
|
||||||
|
2.7.1 / 2015-03-11
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Revert #347 (fix collisions when option and first arg have same name) which causes a bug in #367.
|
||||||
|
|
||||||
|
2.7.0 / 2015-03-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix git-style bug when installed globally. Close #335 #349 @zhiyelee
|
||||||
|
* Fix collisions when option and first arg have same name. Close #346 #347 @tonylukasavage
|
||||||
|
* Add support for camelCase on `opts()`. Close #353 @nkzawa
|
||||||
|
* Add node.js 0.12 and io.js to travis.yml
|
||||||
|
* Allow RegEx options. #337 @palanik
|
||||||
|
* Fixes exit code when sub-command failing. Close #260 #332 @pirelenito
|
||||||
|
* git-style `bin` files in $PATH make sense. Close #196 #327 @zhiyelee
|
||||||
|
|
||||||
|
2.6.0 / 2014-12-30
|
||||||
|
==================
|
||||||
|
|
||||||
|
* added `Command#allowUnknownOption` method. Close #138 #318 @doozr @zhiyelee
|
||||||
|
* Add application description to the help msg. Close #112 @dalssoft
|
||||||
|
|
||||||
|
2.5.1 / 2014-12-15
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fixed two bugs incurred by variadic arguments. Close #291 @Quentin01 #302 @zhiyelee
|
||||||
|
|
||||||
|
2.5.0 / 2014-10-24
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add support for variadic arguments. Closes #277 @whitlockjc
|
||||||
|
|
||||||
|
2.4.0 / 2014-10-17
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fixed a bug on executing the coercion function of subcommands option. Closes #270
|
||||||
|
* added `Command.prototype.name` to retrieve command name. Closes #264 #266 @tonylukasavage
|
||||||
|
* added `Command.prototype.opts` to retrieve all the options as a simple object of key-value pairs. Closes #262 @tonylukasavage
|
||||||
|
* fixed a bug on subcommand name. Closes #248 @jonathandelgado
|
||||||
|
* fixed function normalize doesn’t honor option terminator. Closes #216 @abbr
|
||||||
|
|
||||||
|
2.3.0 / 2014-07-16
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add command alias'. Closes PR #210
|
||||||
|
* fix: Typos. Closes #99
|
||||||
|
* fix: Unused fs module. Closes #217
|
||||||
|
|
||||||
|
2.2.0 / 2014-03-29
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add passing of previous option value
|
||||||
|
* fix: support subcommands on windows. Closes #142
|
||||||
|
* Now the defaultValue passed as the second argument of the coercion function.
|
||||||
|
|
||||||
|
2.1.0 / 2013-11-21
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add: allow cflag style option params, unit test, fixes #174
|
||||||
|
|
||||||
|
2.0.0 / 2013-07-18
|
||||||
|
==================
|
||||||
|
|
||||||
|
* remove input methods (.prompt, .confirm, etc)
|
||||||
|
|
||||||
|
1.3.2 / 2013-07-18
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add support for sub-commands to co-exist with the original command
|
||||||
|
|
||||||
|
1.3.1 / 2013-07-18
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add quick .runningCommand hack so you can opt-out of other logic when running a sub command
|
||||||
|
|
||||||
|
1.3.0 / 2013-07-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add EACCES error handling
|
||||||
|
* fix sub-command --help
|
||||||
|
|
||||||
|
1.2.0 / 2013-06-13
|
||||||
|
==================
|
||||||
|
|
||||||
|
* allow "-" hyphen as an option argument
|
||||||
|
* support for RegExp coercion
|
||||||
|
|
||||||
|
1.1.1 / 2012-11-20
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add more sub-command padding
|
||||||
|
* fix .usage() when args are present. Closes #106
|
||||||
|
|
||||||
|
1.1.0 / 2012-11-16
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add git-style executable subcommand support. Closes #94
|
||||||
|
|
||||||
|
1.0.5 / 2012-10-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix `--name` clobbering. Closes #92
|
||||||
|
* fix examples/help. Closes #89
|
||||||
|
|
||||||
|
1.0.4 / 2012-09-03
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add `outputHelp()` method.
|
||||||
|
|
||||||
|
1.0.3 / 2012-08-30
|
||||||
|
==================
|
||||||
|
|
||||||
|
* remove invalid .version() defaulting
|
||||||
|
|
||||||
|
1.0.2 / 2012-08-24
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add `--foo=bar` support [arv]
|
||||||
|
* fix password on node 0.8.8. Make backward compatible with 0.6 [focusaurus]
|
||||||
|
|
||||||
|
1.0.1 / 2012-08-03
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix issue #56
|
||||||
|
* fix tty.setRawMode(mode) was moved to tty.ReadStream#setRawMode() (i.e. process.stdin.setRawMode())
|
||||||
|
|
||||||
|
1.0.0 / 2012-07-05
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add support for optional option descriptions
|
||||||
|
* add defaulting of `.version()` to package.json's version
|
||||||
|
|
||||||
|
0.6.1 / 2012-06-01
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added: append (yes or no) on confirmation
|
||||||
|
* Added: allow node.js v0.7.x
|
||||||
|
|
||||||
|
0.6.0 / 2012-04-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added `.prompt(obj, callback)` support. Closes #49
|
||||||
|
* Added default support to .choose(). Closes #41
|
||||||
|
* Fixed the choice example
|
||||||
|
|
||||||
|
0.5.1 / 2011-12-20
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fixed `password()` for recent nodes. Closes #36
|
||||||
|
|
||||||
|
0.5.0 / 2011-12-04
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added sub-command option support [itay]
|
||||||
|
|
||||||
|
0.4.3 / 2011-12-04
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fixed custom help ordering. Closes #32
|
||||||
|
|
||||||
|
0.4.2 / 2011-11-24
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added travis support
|
||||||
|
* Fixed: line-buffered input automatically trimmed. Closes #31
|
||||||
|
|
||||||
|
0.4.1 / 2011-11-18
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Removed listening for "close" on --help
|
||||||
|
|
||||||
|
0.4.0 / 2011-11-15
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added support for `--`. Closes #24
|
||||||
|
|
||||||
|
0.3.3 / 2011-11-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fixed: wait for close event when writing help info [Jerry Hamlet]
|
||||||
|
|
||||||
|
0.3.2 / 2011-11-01
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fixed long flag definitions with values [felixge]
|
||||||
|
|
||||||
|
0.3.1 / 2011-10-31
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Changed `--version` short flag to `-V` from `-v`
|
||||||
|
* Changed `.version()` so it's configurable [felixge]
|
||||||
|
|
||||||
|
0.3.0 / 2011-10-31
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added support for long flags only. Closes #18
|
||||||
|
|
||||||
|
0.2.1 / 2011-10-24
|
||||||
|
==================
|
||||||
|
|
||||||
|
* "node": ">= 0.4.x < 0.7.0". Closes #20
|
||||||
|
|
||||||
|
0.2.0 / 2011-09-26
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs]
|
||||||
|
|
||||||
|
0.1.0 / 2011-08-24
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added support for custom `--help` output
|
||||||
|
|
||||||
|
0.0.5 / 2011-08-18
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Changed: when the user enters nothing prompt for password again
|
||||||
|
* Fixed issue with passwords beginning with numbers [NuckChorris]
|
||||||
|
|
||||||
|
0.0.4 / 2011-08-15
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fixed `Commander#args`
|
||||||
|
|
||||||
|
0.0.3 / 2011-08-15
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added default option value support
|
||||||
|
|
||||||
|
0.0.2 / 2011-08-15
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added mask support to `Command#password(str[, mask], fn)`
|
||||||
|
* Added `Command#password(str, fn)`
|
||||||
|
|
||||||
|
0.0.1 / 2010-01-03
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Initial release
|
22
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/node_modules/commander/LICENSE
generated
vendored
Normal file
22
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/node_modules/commander/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
'Software'), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
428
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/node_modules/commander/Readme.md
generated
vendored
Normal file
428
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/node_modules/commander/Readme.md
generated
vendored
Normal file
@ -0,0 +1,428 @@
|
|||||||
|
# Commander.js
|
||||||
|
|
||||||
|
|
||||||
|
[![Build Status](https://api.travis-ci.org/tj/commander.js.svg?branch=master)](http://travis-ci.org/tj/commander.js)
|
||||||
|
[![NPM Version](http://img.shields.io/npm/v/commander.svg?style=flat)](https://www.npmjs.org/package/commander)
|
||||||
|
[![NPM Downloads](https://img.shields.io/npm/dm/commander.svg?style=flat)](https://npmcharts.com/compare/commander?minimal=true)
|
||||||
|
[![Install Size](https://packagephobia.now.sh/badge?p=commander)](https://packagephobia.now.sh/result?p=commander)
|
||||||
|
[![Join the chat at https://gitter.im/tj/commander.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/tj/commander.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||
|
|
||||||
|
The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/commander-rb/commander).
|
||||||
|
[API documentation](http://tj.github.com/commander.js/)
|
||||||
|
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
$ npm install commander
|
||||||
|
|
||||||
|
## Option parsing
|
||||||
|
|
||||||
|
Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.
|
||||||
|
|
||||||
|
```js
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var program = require('commander');
|
||||||
|
|
||||||
|
program
|
||||||
|
.version('0.1.0')
|
||||||
|
.option('-p, --peppers', 'Add peppers')
|
||||||
|
.option('-P, --pineapple', 'Add pineapple')
|
||||||
|
.option('-b, --bbq-sauce', 'Add bbq sauce')
|
||||||
|
.option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
|
||||||
|
.parse(process.argv);
|
||||||
|
|
||||||
|
console.log('you ordered a pizza with:');
|
||||||
|
if (program.peppers) console.log(' - peppers');
|
||||||
|
if (program.pineapple) console.log(' - pineapple');
|
||||||
|
if (program.bbqSauce) console.log(' - bbq');
|
||||||
|
console.log(' - %s cheese', program.cheese);
|
||||||
|
```
|
||||||
|
|
||||||
|
Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc.
|
||||||
|
|
||||||
|
Note that multi-word options starting with `--no` prefix negate the boolean value of the following word. For example, `--no-sauce` sets the value of `program.sauce` to false.
|
||||||
|
|
||||||
|
```js
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var program = require('commander');
|
||||||
|
|
||||||
|
program
|
||||||
|
.option('--no-sauce', 'Remove sauce')
|
||||||
|
.parse(process.argv);
|
||||||
|
|
||||||
|
console.log('you ordered a pizza');
|
||||||
|
if (program.sauce) console.log(' with sauce');
|
||||||
|
else console.log(' without sauce');
|
||||||
|
```
|
||||||
|
|
||||||
|
To get string arguments from options you will need to use angle brackets <> for required inputs or square brackets [] for optional inputs.
|
||||||
|
|
||||||
|
e.g. ```.option('-m --myarg [myVar]', 'my super cool description')```
|
||||||
|
|
||||||
|
Then to access the input if it was passed in.
|
||||||
|
|
||||||
|
e.g. ```var myInput = program.myarg```
|
||||||
|
|
||||||
|
**NOTE**: If you pass a argument without using brackets the example above will return true and not the value passed in.
|
||||||
|
|
||||||
|
|
||||||
|
## Version option
|
||||||
|
|
||||||
|
Calling the `version` implicitly adds the `-V` and `--version` options to the command.
|
||||||
|
When either of these options is present, the command prints the version number and exits.
|
||||||
|
|
||||||
|
$ ./examples/pizza -V
|
||||||
|
0.0.1
|
||||||
|
|
||||||
|
If you want your program to respond to the `-v` option instead of the `-V` option, simply pass custom flags to the `version` method using the same syntax as the `option` method.
|
||||||
|
|
||||||
|
```js
|
||||||
|
program
|
||||||
|
.version('0.0.1', '-v, --version')
|
||||||
|
```
|
||||||
|
|
||||||
|
The version flags can be named anything, but the long option is required.
|
||||||
|
|
||||||
|
## Command-specific options
|
||||||
|
|
||||||
|
You can attach options to a command.
|
||||||
|
|
||||||
|
```js
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
var program = require('commander');
|
||||||
|
|
||||||
|
program
|
||||||
|
.command('rm <dir>')
|
||||||
|
.option('-r, --recursive', 'Remove recursively')
|
||||||
|
.action(function (dir, cmd) {
|
||||||
|
console.log('remove ' + dir + (cmd.recursive ? ' recursively' : ''))
|
||||||
|
})
|
||||||
|
|
||||||
|
program.parse(process.argv)
|
||||||
|
```
|
||||||
|
|
||||||
|
A command's options are validated when the command is used. Any unknown options will be reported as an error. However, if an action-based command does not define an action, then the options are not validated.
|
||||||
|
|
||||||
|
## Coercion
|
||||||
|
|
||||||
|
```js
|
||||||
|
function range(val) {
|
||||||
|
return val.split('..').map(Number);
|
||||||
|
}
|
||||||
|
|
||||||
|
function list(val) {
|
||||||
|
return val.split(',');
|
||||||
|
}
|
||||||
|
|
||||||
|
function collect(val, memo) {
|
||||||
|
memo.push(val);
|
||||||
|
return memo;
|
||||||
|
}
|
||||||
|
|
||||||
|
function increaseVerbosity(v, total) {
|
||||||
|
return total + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
program
|
||||||
|
.version('0.1.0')
|
||||||
|
.usage('[options] <file ...>')
|
||||||
|
.option('-i, --integer <n>', 'An integer argument', parseInt)
|
||||||
|
.option('-f, --float <n>', 'A float argument', parseFloat)
|
||||||
|
.option('-r, --range <a>..<b>', 'A range', range)
|
||||||
|
.option('-l, --list <items>', 'A list', list)
|
||||||
|
.option('-o, --optional [value]', 'An optional value')
|
||||||
|
.option('-c, --collect [value]', 'A repeatable value', collect, [])
|
||||||
|
.option('-v, --verbose', 'A value that can be increased', increaseVerbosity, 0)
|
||||||
|
.parse(process.argv);
|
||||||
|
|
||||||
|
console.log(' int: %j', program.integer);
|
||||||
|
console.log(' float: %j', program.float);
|
||||||
|
console.log(' optional: %j', program.optional);
|
||||||
|
program.range = program.range || [];
|
||||||
|
console.log(' range: %j..%j', program.range[0], program.range[1]);
|
||||||
|
console.log(' list: %j', program.list);
|
||||||
|
console.log(' collect: %j', program.collect);
|
||||||
|
console.log(' verbosity: %j', program.verbose);
|
||||||
|
console.log(' args: %j', program.args);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Regular Expression
|
||||||
|
```js
|
||||||
|
program
|
||||||
|
.version('0.1.0')
|
||||||
|
.option('-s --size <size>', 'Pizza size', /^(large|medium|small)$/i, 'medium')
|
||||||
|
.option('-d --drink [drink]', 'Drink', /^(coke|pepsi|izze)$/i)
|
||||||
|
.parse(process.argv);
|
||||||
|
|
||||||
|
console.log(' size: %j', program.size);
|
||||||
|
console.log(' drink: %j', program.drink);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Variadic arguments
|
||||||
|
|
||||||
|
The last argument of a command can be variadic, and only the last argument. To make an argument variadic you have to
|
||||||
|
append `...` to the argument name. Here is an example:
|
||||||
|
|
||||||
|
```js
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var program = require('commander');
|
||||||
|
|
||||||
|
program
|
||||||
|
.version('0.1.0')
|
||||||
|
.command('rmdir <dir> [otherDirs...]')
|
||||||
|
.action(function (dir, otherDirs) {
|
||||||
|
console.log('rmdir %s', dir);
|
||||||
|
if (otherDirs) {
|
||||||
|
otherDirs.forEach(function (oDir) {
|
||||||
|
console.log('rmdir %s', oDir);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
program.parse(process.argv);
|
||||||
|
```
|
||||||
|
|
||||||
|
An `Array` is used for the value of a variadic argument. This applies to `program.args` as well as the argument passed
|
||||||
|
to your action as demonstrated above.
|
||||||
|
|
||||||
|
## Specify the argument syntax
|
||||||
|
|
||||||
|
```js
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
var program = require('commander');
|
||||||
|
|
||||||
|
program
|
||||||
|
.version('0.1.0')
|
||||||
|
.arguments('<cmd> [env]')
|
||||||
|
.action(function (cmd, env) {
|
||||||
|
cmdValue = cmd;
|
||||||
|
envValue = env;
|
||||||
|
});
|
||||||
|
|
||||||
|
program.parse(process.argv);
|
||||||
|
|
||||||
|
if (typeof cmdValue === 'undefined') {
|
||||||
|
console.error('no command given!');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
console.log('command:', cmdValue);
|
||||||
|
console.log('environment:', envValue || "no environment given");
|
||||||
|
```
|
||||||
|
Angled brackets (e.g. `<cmd>`) indicate required input. Square brackets (e.g. `[env]`) indicate optional input.
|
||||||
|
|
||||||
|
## Git-style sub-commands
|
||||||
|
|
||||||
|
```js
|
||||||
|
// file: ./examples/pm
|
||||||
|
var program = require('commander');
|
||||||
|
|
||||||
|
program
|
||||||
|
.version('0.1.0')
|
||||||
|
.command('install [name]', 'install one or more packages')
|
||||||
|
.command('search [query]', 'search with optional query')
|
||||||
|
.command('list', 'list packages installed', {isDefault: true})
|
||||||
|
.parse(process.argv);
|
||||||
|
```
|
||||||
|
|
||||||
|
When `.command()` is invoked with a description argument, no `.action(callback)` should be called to handle sub-commands, otherwise there will be an error. This tells commander that you're going to use separate executables for sub-commands, much like `git(1)` and other popular tools.
|
||||||
|
The commander will try to search the executables in the directory of the entry script (like `./examples/pm`) with the name `program-command`, like `pm-install`, `pm-search`.
|
||||||
|
|
||||||
|
Options can be passed with the call to `.command()`. Specifying `true` for `opts.noHelp` will remove the subcommand from the generated help output. Specifying `true` for `opts.isDefault` will run the subcommand if no other subcommand is specified.
|
||||||
|
|
||||||
|
If the program is designed to be installed globally, make sure the executables have proper modes, like `755`.
|
||||||
|
|
||||||
|
### `--harmony`
|
||||||
|
|
||||||
|
You can enable `--harmony` option in two ways:
|
||||||
|
* Use `#! /usr/bin/env node --harmony` in the sub-commands scripts. Note some os version don’t support this pattern.
|
||||||
|
* Use the `--harmony` option when call the command, like `node --harmony examples/pm publish`. The `--harmony` option will be preserved when spawning sub-command process.
|
||||||
|
|
||||||
|
## Automated --help
|
||||||
|
|
||||||
|
The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ./examples/pizza --help
|
||||||
|
Usage: pizza [options]
|
||||||
|
|
||||||
|
An application for pizzas ordering
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help output usage information
|
||||||
|
-V, --version output the version number
|
||||||
|
-p, --peppers Add peppers
|
||||||
|
-P, --pineapple Add pineapple
|
||||||
|
-b, --bbq Add bbq sauce
|
||||||
|
-c, --cheese <type> Add the specified type of cheese [marble]
|
||||||
|
-C, --no-cheese You do not want any cheese
|
||||||
|
```
|
||||||
|
|
||||||
|
## Custom help
|
||||||
|
|
||||||
|
You can display arbitrary `-h, --help` information
|
||||||
|
by listening for "--help". Commander will automatically
|
||||||
|
exit once you are done so that the remainder of your program
|
||||||
|
does not execute causing undesired behaviors, for example
|
||||||
|
in the following executable "stuff" will not output when
|
||||||
|
`--help` is used.
|
||||||
|
|
||||||
|
```js
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var program = require('commander');
|
||||||
|
|
||||||
|
program
|
||||||
|
.version('0.1.0')
|
||||||
|
.option('-f, --foo', 'enable some foo')
|
||||||
|
.option('-b, --bar', 'enable some bar')
|
||||||
|
.option('-B, --baz', 'enable some baz');
|
||||||
|
|
||||||
|
// must be before .parse() since
|
||||||
|
// node's emit() is immediate
|
||||||
|
|
||||||
|
program.on('--help', function(){
|
||||||
|
console.log('')
|
||||||
|
console.log('Examples:');
|
||||||
|
console.log(' $ custom-help --help');
|
||||||
|
console.log(' $ custom-help -h');
|
||||||
|
});
|
||||||
|
|
||||||
|
program.parse(process.argv);
|
||||||
|
|
||||||
|
console.log('stuff');
|
||||||
|
```
|
||||||
|
|
||||||
|
Yields the following help output when `node script-name.js -h` or `node script-name.js --help` are run:
|
||||||
|
|
||||||
|
```
|
||||||
|
Usage: custom-help [options]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help output usage information
|
||||||
|
-V, --version output the version number
|
||||||
|
-f, --foo enable some foo
|
||||||
|
-b, --bar enable some bar
|
||||||
|
-B, --baz enable some baz
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
$ custom-help --help
|
||||||
|
$ custom-help -h
|
||||||
|
```
|
||||||
|
|
||||||
|
## .outputHelp(cb)
|
||||||
|
|
||||||
|
Output help information without exiting.
|
||||||
|
Optional callback cb allows post-processing of help text before it is displayed.
|
||||||
|
|
||||||
|
If you want to display help by default (e.g. if no command was provided), you can use something like:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var program = require('commander');
|
||||||
|
var colors = require('colors');
|
||||||
|
|
||||||
|
program
|
||||||
|
.version('0.1.0')
|
||||||
|
.command('getstream [url]', 'get stream URL')
|
||||||
|
.parse(process.argv);
|
||||||
|
|
||||||
|
if (!process.argv.slice(2).length) {
|
||||||
|
program.outputHelp(make_red);
|
||||||
|
}
|
||||||
|
|
||||||
|
function make_red(txt) {
|
||||||
|
return colors.red(txt); //display the help text in red on the console
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## .help(cb)
|
||||||
|
|
||||||
|
Output help information and exit immediately.
|
||||||
|
Optional callback cb allows post-processing of help text before it is displayed.
|
||||||
|
|
||||||
|
|
||||||
|
## Custom event listeners
|
||||||
|
You can execute custom actions by listening to command and option events.
|
||||||
|
|
||||||
|
```js
|
||||||
|
program.on('option:verbose', function () {
|
||||||
|
process.env.VERBOSE = this.verbose;
|
||||||
|
});
|
||||||
|
|
||||||
|
// error on unknown commands
|
||||||
|
program.on('command:*', function () {
|
||||||
|
console.error('Invalid command: %s\nSee --help for a list of available commands.', program.args.join(' '));
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
```js
|
||||||
|
var program = require('commander');
|
||||||
|
|
||||||
|
program
|
||||||
|
.version('0.1.0')
|
||||||
|
.option('-C, --chdir <path>', 'change the working directory')
|
||||||
|
.option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
|
||||||
|
.option('-T, --no-tests', 'ignore test hook');
|
||||||
|
|
||||||
|
program
|
||||||
|
.command('setup [env]')
|
||||||
|
.description('run setup commands for all envs')
|
||||||
|
.option("-s, --setup_mode [mode]", "Which setup mode to use")
|
||||||
|
.action(function(env, options){
|
||||||
|
var mode = options.setup_mode || "normal";
|
||||||
|
env = env || 'all';
|
||||||
|
console.log('setup for %s env(s) with %s mode', env, mode);
|
||||||
|
});
|
||||||
|
|
||||||
|
program
|
||||||
|
.command('exec <cmd>')
|
||||||
|
.alias('ex')
|
||||||
|
.description('execute the given remote cmd')
|
||||||
|
.option("-e, --exec_mode <mode>", "Which exec mode to use")
|
||||||
|
.action(function(cmd, options){
|
||||||
|
console.log('exec "%s" using %s mode', cmd, options.exec_mode);
|
||||||
|
}).on('--help', function() {
|
||||||
|
console.log('');
|
||||||
|
console.log('Examples:');
|
||||||
|
console.log('');
|
||||||
|
console.log(' $ deploy exec sequential');
|
||||||
|
console.log(' $ deploy exec async');
|
||||||
|
});
|
||||||
|
|
||||||
|
program
|
||||||
|
.command('*')
|
||||||
|
.action(function(env){
|
||||||
|
console.log('deploying "%s"', env);
|
||||||
|
});
|
||||||
|
|
||||||
|
program.parse(process.argv);
|
||||||
|
```
|
||||||
|
|
||||||
|
More Demos can be found in the [examples](https://github.com/tj/commander.js/tree/master/examples) directory.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[MIT](https://github.com/tj/commander.js/blob/master/LICENSE)
|
1224
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/node_modules/commander/index.js
generated
vendored
Normal file
1224
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/node_modules/commander/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
70
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/node_modules/commander/package.json
generated
vendored
Normal file
70
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/node_modules/commander/package.json
generated
vendored
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
{
|
||||||
|
"_from": "commander@^2.20.3",
|
||||||
|
"_id": "commander@2.20.3",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
|
||||||
|
"_location": "/dxf/commander",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "commander@^2.20.3",
|
||||||
|
"name": "commander",
|
||||||
|
"escapedName": "commander",
|
||||||
|
"rawSpec": "^2.20.3",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^2.20.3"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/dxf"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||||
|
"_shasum": "fd485e84c03eb4881c20722ba48035e8531aeb33",
|
||||||
|
"_spec": "commander@^2.20.3",
|
||||||
|
"_where": "C:\\node-v10.18.0-win-x64\\node_modules\\dxf",
|
||||||
|
"author": {
|
||||||
|
"name": "TJ Holowaychuk",
|
||||||
|
"email": "tj@vision-media.ca"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/tj/commander.js/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "the complete solution for node.js command-line programs",
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^12.7.8",
|
||||||
|
"eslint": "^6.4.0",
|
||||||
|
"should": "^13.2.3",
|
||||||
|
"sinon": "^7.5.0",
|
||||||
|
"standard": "^14.3.1",
|
||||||
|
"ts-node": "^8.4.1",
|
||||||
|
"typescript": "^3.6.3"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"typings/index.d.ts"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/tj/commander.js#readme",
|
||||||
|
"keywords": [
|
||||||
|
"commander",
|
||||||
|
"command",
|
||||||
|
"option",
|
||||||
|
"parser"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "index",
|
||||||
|
"name": "commander",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/tj/commander.js.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"lint": "eslint index.js",
|
||||||
|
"test": "node test/run.js && npm run test-typings",
|
||||||
|
"test-typings": "tsc -p tsconfig.json"
|
||||||
|
},
|
||||||
|
"typings": "typings/index.d.ts",
|
||||||
|
"version": "2.20.3"
|
||||||
|
}
|
310
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/node_modules/commander/typings/index.d.ts
generated
vendored
Normal file
310
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/node_modules/commander/typings/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,310 @@
|
|||||||
|
// Type definitions for commander 2.11
|
||||||
|
// Project: https://github.com/visionmedia/commander.js
|
||||||
|
// Definitions by: Alan Agius <https://github.com/alan-agius4>, Marcelo Dezem <https://github.com/mdezem>, vvakame <https://github.com/vvakame>, Jules Randolph <https://github.com/sveinburne>
|
||||||
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||||
|
|
||||||
|
declare namespace local {
|
||||||
|
|
||||||
|
class Option {
|
||||||
|
flags: string;
|
||||||
|
required: boolean;
|
||||||
|
optional: boolean;
|
||||||
|
bool: boolean;
|
||||||
|
short?: string;
|
||||||
|
long: string;
|
||||||
|
description: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize a new `Option` with the given `flags` and `description`.
|
||||||
|
*
|
||||||
|
* @param {string} flags
|
||||||
|
* @param {string} [description]
|
||||||
|
*/
|
||||||
|
constructor(flags: string, description?: string);
|
||||||
|
}
|
||||||
|
|
||||||
|
class Command extends NodeJS.EventEmitter {
|
||||||
|
[key: string]: any;
|
||||||
|
|
||||||
|
args: string[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize a new `Command`.
|
||||||
|
*
|
||||||
|
* @param {string} [name]
|
||||||
|
*/
|
||||||
|
constructor(name?: string);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the program version to `str`.
|
||||||
|
*
|
||||||
|
* This method auto-registers the "-V, --version" flag
|
||||||
|
* which will print the version number when passed.
|
||||||
|
*
|
||||||
|
* @param {string} str
|
||||||
|
* @param {string} [flags]
|
||||||
|
* @returns {Command} for chaining
|
||||||
|
*/
|
||||||
|
version(str: string, flags?: string): Command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add command `name`.
|
||||||
|
*
|
||||||
|
* The `.action()` callback is invoked when the
|
||||||
|
* command `name` is specified via __ARGV__,
|
||||||
|
* and the remaining arguments are applied to the
|
||||||
|
* function for access.
|
||||||
|
*
|
||||||
|
* When the `name` is "*" an un-matched command
|
||||||
|
* will be passed as the first arg, followed by
|
||||||
|
* the rest of __ARGV__ remaining.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* program
|
||||||
|
* .version('0.0.1')
|
||||||
|
* .option('-C, --chdir <path>', 'change the working directory')
|
||||||
|
* .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
|
||||||
|
* .option('-T, --no-tests', 'ignore test hook')
|
||||||
|
*
|
||||||
|
* program
|
||||||
|
* .command('setup')
|
||||||
|
* .description('run remote setup commands')
|
||||||
|
* .action(function() {
|
||||||
|
* console.log('setup');
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* program
|
||||||
|
* .command('exec <cmd>')
|
||||||
|
* .description('run the given remote command')
|
||||||
|
* .action(function(cmd) {
|
||||||
|
* console.log('exec "%s"', cmd);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* program
|
||||||
|
* .command('teardown <dir> [otherDirs...]')
|
||||||
|
* .description('run teardown commands')
|
||||||
|
* .action(function(dir, otherDirs) {
|
||||||
|
* console.log('dir "%s"', dir);
|
||||||
|
* if (otherDirs) {
|
||||||
|
* otherDirs.forEach(function (oDir) {
|
||||||
|
* console.log('dir "%s"', oDir);
|
||||||
|
* });
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* program
|
||||||
|
* .command('*')
|
||||||
|
* .description('deploy the given env')
|
||||||
|
* .action(function(env) {
|
||||||
|
* console.log('deploying "%s"', env);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* program.parse(process.argv);
|
||||||
|
*
|
||||||
|
* @param {string} name
|
||||||
|
* @param {string} [desc] for git-style sub-commands
|
||||||
|
* @param {CommandOptions} [opts] command options
|
||||||
|
* @returns {Command} the new command
|
||||||
|
*/
|
||||||
|
command(name: string, desc?: string, opts?: commander.CommandOptions): Command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define argument syntax for the top-level command.
|
||||||
|
*
|
||||||
|
* @param {string} desc
|
||||||
|
* @returns {Command} for chaining
|
||||||
|
*/
|
||||||
|
arguments(desc: string): Command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse expected `args`.
|
||||||
|
*
|
||||||
|
* For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.
|
||||||
|
*
|
||||||
|
* @param {string[]} args
|
||||||
|
* @returns {Command} for chaining
|
||||||
|
*/
|
||||||
|
parseExpectedArgs(args: string[]): Command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register callback `fn` for the command.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* program
|
||||||
|
* .command('help')
|
||||||
|
* .description('display verbose help')
|
||||||
|
* .action(function() {
|
||||||
|
* // output help here
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* @param {(...args: any[]) => void} fn
|
||||||
|
* @returns {Command} for chaining
|
||||||
|
*/
|
||||||
|
action(fn: (...args: any[]) => void): Command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define option with `flags`, `description` and optional
|
||||||
|
* coercion `fn`.
|
||||||
|
*
|
||||||
|
* The `flags` string should contain both the short and long flags,
|
||||||
|
* separated by comma, a pipe or space. The following are all valid
|
||||||
|
* all will output this way when `--help` is used.
|
||||||
|
*
|
||||||
|
* "-p, --pepper"
|
||||||
|
* "-p|--pepper"
|
||||||
|
* "-p --pepper"
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* // simple boolean defaulting to false
|
||||||
|
* program.option('-p, --pepper', 'add pepper');
|
||||||
|
*
|
||||||
|
* --pepper
|
||||||
|
* program.pepper
|
||||||
|
* // => Boolean
|
||||||
|
*
|
||||||
|
* // simple boolean defaulting to true
|
||||||
|
* program.option('-C, --no-cheese', 'remove cheese');
|
||||||
|
*
|
||||||
|
* program.cheese
|
||||||
|
* // => true
|
||||||
|
*
|
||||||
|
* --no-cheese
|
||||||
|
* program.cheese
|
||||||
|
* // => false
|
||||||
|
*
|
||||||
|
* // required argument
|
||||||
|
* program.option('-C, --chdir <path>', 'change the working directory');
|
||||||
|
*
|
||||||
|
* --chdir /tmp
|
||||||
|
* program.chdir
|
||||||
|
* // => "/tmp"
|
||||||
|
*
|
||||||
|
* // optional argument
|
||||||
|
* program.option('-c, --cheese [type]', 'add cheese [marble]');
|
||||||
|
*
|
||||||
|
* @param {string} flags
|
||||||
|
* @param {string} [description]
|
||||||
|
* @param {((arg1: any, arg2: any) => void) | RegExp} [fn] function or default
|
||||||
|
* @param {*} [defaultValue]
|
||||||
|
* @returns {Command} for chaining
|
||||||
|
*/
|
||||||
|
option(flags: string, description?: string, fn?: ((arg1: any, arg2: any) => void) | RegExp, defaultValue?: any): Command;
|
||||||
|
option(flags: string, description?: string, defaultValue?: any): Command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allow unknown options on the command line.
|
||||||
|
*
|
||||||
|
* @param {boolean} [arg] if `true` or omitted, no error will be thrown for unknown options.
|
||||||
|
* @returns {Command} for chaining
|
||||||
|
*/
|
||||||
|
allowUnknownOption(arg?: boolean): Command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse `argv`, settings options and invoking commands when defined.
|
||||||
|
*
|
||||||
|
* @param {string[]} argv
|
||||||
|
* @returns {Command} for chaining
|
||||||
|
*/
|
||||||
|
parse(argv: string[]): Command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse options from `argv` returning `argv` void of these options.
|
||||||
|
*
|
||||||
|
* @param {string[]} argv
|
||||||
|
* @returns {ParseOptionsResult}
|
||||||
|
*/
|
||||||
|
parseOptions(argv: string[]): commander.ParseOptionsResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an object containing options as key-value pairs
|
||||||
|
*
|
||||||
|
* @returns {{[key: string]: any}}
|
||||||
|
*/
|
||||||
|
opts(): { [key: string]: any };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the description to `str`.
|
||||||
|
*
|
||||||
|
* @param {string} str
|
||||||
|
* @param {{[argName: string]: string}} argsDescription
|
||||||
|
* @return {(Command | string)}
|
||||||
|
*/
|
||||||
|
description(str: string, argsDescription?: {[argName: string]: string}): Command;
|
||||||
|
description(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an alias for the command.
|
||||||
|
*
|
||||||
|
* @param {string} alias
|
||||||
|
* @return {(Command | string)}
|
||||||
|
*/
|
||||||
|
alias(alias: string): Command;
|
||||||
|
alias(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set or get the command usage.
|
||||||
|
*
|
||||||
|
* @param {string} str
|
||||||
|
* @return {(Command | string)}
|
||||||
|
*/
|
||||||
|
usage(str: string): Command;
|
||||||
|
usage(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the name of the command.
|
||||||
|
*
|
||||||
|
* @param {string} str
|
||||||
|
* @return {Command}
|
||||||
|
*/
|
||||||
|
name(str: string): Command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name of the command.
|
||||||
|
*
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
|
name(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output help information for this command.
|
||||||
|
*
|
||||||
|
* @param {(str: string) => string} [cb]
|
||||||
|
*/
|
||||||
|
outputHelp(cb?: (str: string) => string): void;
|
||||||
|
|
||||||
|
/** Output help information and exit.
|
||||||
|
*
|
||||||
|
* @param {(str: string) => string} [cb]
|
||||||
|
*/
|
||||||
|
help(cb?: (str: string) => string): never;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
declare namespace commander {
|
||||||
|
|
||||||
|
type Command = local.Command
|
||||||
|
|
||||||
|
type Option = local.Option
|
||||||
|
|
||||||
|
interface CommandOptions {
|
||||||
|
noHelp?: boolean;
|
||||||
|
isDefault?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ParseOptionsResult {
|
||||||
|
args: string[];
|
||||||
|
unknown: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CommanderStatic extends Command {
|
||||||
|
Command: typeof local.Command;
|
||||||
|
Option: typeof local.Option;
|
||||||
|
CommandOptions: CommandOptions;
|
||||||
|
ParseOptionsResult: ParseOptionsResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
declare const commander: commander.CommanderStatic;
|
||||||
|
export = commander;
|
47
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/node_modules/lodash/LICENSE
generated
vendored
Normal file
47
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/node_modules/lodash/LICENSE
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
||||||
|
|
||||||
|
Based on Underscore.js, copyright Jeremy Ashkenas,
|
||||||
|
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
||||||
|
|
||||||
|
This software consists of voluntary contributions made by many
|
||||||
|
individuals. For exact contribution history, see the revision history
|
||||||
|
available at https://github.com/lodash/lodash
|
||||||
|
|
||||||
|
The following license applies to all parts of this software except as
|
||||||
|
documented below:
|
||||||
|
|
||||||
|
====
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
====
|
||||||
|
|
||||||
|
Copyright and related rights for sample code are waived via CC0. Sample
|
||||||
|
code is defined as all source code displayed within the prose of the
|
||||||
|
documentation.
|
||||||
|
|
||||||
|
CC0: http://creativecommons.org/publicdomain/zero/1.0/
|
||||||
|
|
||||||
|
====
|
||||||
|
|
||||||
|
Files located in the node_modules and vendor directories are externally
|
||||||
|
maintained libraries used by this software which have their own
|
||||||
|
licenses; we recommend you read them, as their terms may differ from the
|
||||||
|
terms above.
|
39
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/node_modules/lodash/README.md
generated
vendored
Normal file
39
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/node_modules/lodash/README.md
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# lodash v4.17.20
|
||||||
|
|
||||||
|
The [Lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Using npm:
|
||||||
|
```shell
|
||||||
|
$ npm i -g npm
|
||||||
|
$ npm i --save lodash
|
||||||
|
```
|
||||||
|
|
||||||
|
In Node.js:
|
||||||
|
```js
|
||||||
|
// Load the full build.
|
||||||
|
var _ = require('lodash');
|
||||||
|
// Load the core build.
|
||||||
|
var _ = require('lodash/core');
|
||||||
|
// Load the FP build for immutable auto-curried iteratee-first data-last methods.
|
||||||
|
var fp = require('lodash/fp');
|
||||||
|
|
||||||
|
// Load method categories.
|
||||||
|
var array = require('lodash/array');
|
||||||
|
var object = require('lodash/fp/object');
|
||||||
|
|
||||||
|
// Cherry-pick methods for smaller browserify/rollup/webpack bundles.
|
||||||
|
var at = require('lodash/at');
|
||||||
|
var curryN = require('lodash/fp/curryN');
|
||||||
|
```
|
||||||
|
|
||||||
|
See the [package source](https://github.com/lodash/lodash/tree/4.17.20-npm) for more details.
|
||||||
|
|
||||||
|
**Note:**<br>
|
||||||
|
Install [n_](https://www.npmjs.com/package/n_) for Lodash use in the Node.js < 6 REPL.
|
||||||
|
|
||||||
|
## Support
|
||||||
|
|
||||||
|
Tested in Chrome 74-75, Firefox 66-67, IE 11, Edge 18, Safari 11-12, & Node.js 8-12.<br>
|
||||||
|
Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available.
|
7
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/node_modules/lodash/_DataView.js
generated
vendored
Normal file
7
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/node_modules/lodash/_DataView.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
var getNative = require('./_getNative'),
|
||||||
|
root = require('./_root');
|
||||||
|
|
||||||
|
/* Built-in method references that are verified to be native. */
|
||||||
|
var DataView = getNative(root, 'DataView');
|
||||||
|
|
||||||
|
module.exports = DataView;
|
32
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/node_modules/lodash/_Hash.js
generated
vendored
Normal file
32
extensions/fablabchemnitz/dxf_dwg_importer/node_modules/dxf/node_modules/lodash/_Hash.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
var hashClear = require('./_hashClear'),
|
||||||
|
hashDelete = require('./_hashDelete'),
|
||||||
|
hashGet = require('./_hashGet'),
|
||||||
|
hashHas = require('./_hashHas'),
|
||||||
|
hashSet = require('./_hashSet');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a hash object.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @constructor
|
||||||
|
* @param {Array} [entries] The key-value pairs to cache.
|
||||||
|
*/
|
||||||
|
function Hash(entries) {
|
||||||
|
var index = -1,
|
||||||
|
length = entries == null ? 0 : entries.length;
|
||||||
|
|
||||||
|
this.clear();
|
||||||
|
while (++index < length) {
|
||||||
|
var entry = entries[index];
|
||||||
|
this.set(entry[0], entry[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add methods to `Hash`.
|
||||||
|
Hash.prototype.clear = hashClear;
|
||||||
|
Hash.prototype['delete'] = hashDelete;
|
||||||
|
Hash.prototype.get = hashGet;
|
||||||
|
Hash.prototype.has = hashHas;
|
||||||
|
Hash.prototype.set = hashSet;
|
||||||
|
|
||||||
|
module.exports = Hash;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user