adding back more extensions
This commit is contained in:
parent
fed542ba37
commit
990f87171a
48
extensions/fablabchemnitz/clip_out/clip_out.inx
Normal file
48
extensions/fablabchemnitz/clip_out/clip_out.inx
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||||
|
<name>Clip Out</name>
|
||||||
|
<id>fablabchemnitz.de.clip_out</id>
|
||||||
|
<param name="notebook_main" type="notebook">
|
||||||
|
<page name="settings_page" gui-text="Settings">
|
||||||
|
<param name="clip_type_inverse" type="bool" gui-text="Inverse" gui-description="Make holes :)">false</param>
|
||||||
|
<separator/>
|
||||||
|
<param name="output_set" type="optiongroup" appearance="radio" gui-text="Output">
|
||||||
|
<option value="master_only">Master Only</option>
|
||||||
|
<option value="separate">Separate</option>
|
||||||
|
<option value="master_and_separate">Master & Separate</option>
|
||||||
|
</param>
|
||||||
|
<param name="canvas_to_selection" type="optiongroup" appearance="radio" gui-text="Resize to Selection" gui-description="Crop Canvas To Resulting Clip">
|
||||||
|
<option value="true">Yes</option>
|
||||||
|
<option value="false">No</option>
|
||||||
|
</param>
|
||||||
|
<param name="png_dpi" type="int" min="10" max="99999999" gui-text="PNG dpi">96</param>
|
||||||
|
<separator/>
|
||||||
|
<param type="path" name="save_path" gui-text="File Save Path" mode="folder">None Selected</param>
|
||||||
|
</page>
|
||||||
|
<page name="about_page" gui-text="About">
|
||||||
|
<label xml:space="preserve">
|
||||||
|
Clip Out - Export multiple clipped png images using paths / shapes and a background image
|
||||||
|
</label>
|
||||||
|
<label appearance="url">https://gitlab.com/inklinea/quick-export</label>
|
||||||
|
<label appearance="url">https://inkscape.org/~inklinea/</label>
|
||||||
|
<label xml:space="preserve">
|
||||||
|
Requires Inkscape 1.1+ -->
|
||||||
|
The image to be clipped must be the last selected.
|
||||||
|
An easy way to do this, is select all then shift & left click the image twice to make it the last selected.
|
||||||
|
It does require that you have saved our svg file
|
||||||
|
at least once before using ( will not work on an unsaved svg )
|
||||||
|
</label>
|
||||||
|
</page>
|
||||||
|
</param>
|
||||||
|
<effect needs-live-preview="false">
|
||||||
|
<object-type>path</object-type>
|
||||||
|
<effects-menu>
|
||||||
|
<submenu name="FabLab Chemnitz">
|
||||||
|
<submenu name="Import/Export/Transfer"/>
|
||||||
|
</submenu>
|
||||||
|
</effects-menu>
|
||||||
|
</effect>
|
||||||
|
<script>
|
||||||
|
<command location="inx" interpreter="python">clip_out.py</command>
|
||||||
|
</script>
|
||||||
|
</inkscape-extension>
|
314
extensions/fablabchemnitz/clip_out/clip_out.py
Normal file
314
extensions/fablabchemnitz/clip_out/clip_out.py
Normal file
@ -0,0 +1,314 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# coding=utf-8
|
||||||
|
#
|
||||||
|
# Copyright (C) [2021] [Matt Cottam], [mpcottam@raincloud.co.uk]
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# #############################################################################
|
||||||
|
# Clip Out - Export multiple clipped images using paths / shapes and a background image
|
||||||
|
# After setting the options in the main dialogue
|
||||||
|
# Assign a shortcut in Inkscape Edit>Preferences>Interface>Keyboard to org.inkscape.inklinea.clip_out.noprefs
|
||||||
|
# For shortcut triggered quick export
|
||||||
|
# It does require that you have saved
|
||||||
|
# Your svg file at least once before using ( will not work on an unsaved svg )
|
||||||
|
# Requires Inkscape 1.1+ -->
|
||||||
|
# #############################################################################
|
||||||
|
import random
|
||||||
|
|
||||||
|
import inkex
|
||||||
|
from inkex import command
|
||||||
|
from pathlib import Path
|
||||||
|
from datetime import datetime
|
||||||
|
import tempfile, shutil, os
|
||||||
|
from lxml import etree
|
||||||
|
|
||||||
|
import time
|
||||||
|
|
||||||
|
conversions = {
|
||||||
|
'in': 96.0,
|
||||||
|
'pt': 1.3333333333333333,
|
||||||
|
'px': 1.0,
|
||||||
|
'mm': 3.779527559055118,
|
||||||
|
'cm': 37.79527559055118,
|
||||||
|
'm': 3779.527559055118,
|
||||||
|
'km': 3779527.559055118,
|
||||||
|
'Q': 0.94488188976378,
|
||||||
|
'pc': 16.0,
|
||||||
|
'yd': 3456.0,
|
||||||
|
'ft': 1152.0,
|
||||||
|
'': 1.0, # Default px
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def make_temp_svg(self):
|
||||||
|
temp_svg_file = tempfile.NamedTemporaryFile(mode='r+', delete='false', suffix='.svg')
|
||||||
|
# Write the contents of the updated svg to a tempfile to use with command line
|
||||||
|
my_svg_string = self.svg.root.tostring().decode("utf-8")
|
||||||
|
temp_svg_file.write(my_svg_string)
|
||||||
|
return temp_svg_file
|
||||||
|
|
||||||
|
|
||||||
|
def inkscape_command_line_export(self, my_temp_svg_filename_path, my_export_path, export_png_actions):
|
||||||
|
if Path(my_export_path).is_dir():
|
||||||
|
cli_output = inkex.command.inkscape(my_temp_svg_filename_path, export_png_actions)
|
||||||
|
if len(cli_output) > 0:
|
||||||
|
self.msg("Inkscape returned the following output when trying to run the file export; the file export may still have worked:")
|
||||||
|
self.msg(cli_output)
|
||||||
|
else:
|
||||||
|
inkex.errormsg('Please Select An Export Folder')
|
||||||
|
|
||||||
|
|
||||||
|
def make_image_frame(self, background_image):
|
||||||
|
found_units = self.svg.unit
|
||||||
|
|
||||||
|
unit_conversion_factor = conversions[found_units]
|
||||||
|
|
||||||
|
bbox_x = background_image.bounding_box().left / unit_conversion_factor
|
||||||
|
bbox_y = background_image.bounding_box().top / unit_conversion_factor
|
||||||
|
bbox_width = background_image.bounding_box().width / unit_conversion_factor
|
||||||
|
bbox_height = background_image.bounding_box().height / unit_conversion_factor
|
||||||
|
|
||||||
|
top_left = str(f'{bbox_x} {bbox_y}')
|
||||||
|
top_right_x = str(bbox_x + bbox_width)
|
||||||
|
top_right_y = str(bbox_y)
|
||||||
|
bottom_right_x = str(bbox_x + bbox_width)
|
||||||
|
bottom_right_y = str(bbox_y + bbox_height)
|
||||||
|
bottom_left_x = str(bbox_x)
|
||||||
|
bottom_left_y = str(bbox_y + bbox_height)
|
||||||
|
|
||||||
|
rect_path = f'M {top_left} L {top_right_x} {top_right_y} L {bottom_right_x} {bottom_right_y} L {bottom_left_x} {bottom_left_y} Z'
|
||||||
|
path_id = 'inverse_clip_frame' + str(random.randrange(10000, 99999))
|
||||||
|
parent = self.svg.get_current_layer()
|
||||||
|
rect_path_object = etree.SubElement(parent, inkex.addNS('path', 'svg'))
|
||||||
|
rect_path_object.attrib['id'] = path_id
|
||||||
|
rect_path_object.attrib['d'] = rect_path
|
||||||
|
rect_path_object.style['stroke'] = 'black'
|
||||||
|
rect_path_object.style['stroke-width'] = '1px'
|
||||||
|
|
||||||
|
return rect_path_object.get_id()
|
||||||
|
|
||||||
|
|
||||||
|
def command_line_call(self):
|
||||||
|
|
||||||
|
# Get export path
|
||||||
|
my_export_path = self.options.save_path
|
||||||
|
|
||||||
|
# Get name of currently open Inkscape file
|
||||||
|
my_filename = self.svg.name
|
||||||
|
|
||||||
|
# Check to see if user has saved file at least once
|
||||||
|
if len(my_filename) < 2:
|
||||||
|
inkex.errormsg('Please Save Your File First')
|
||||||
|
return
|
||||||
|
|
||||||
|
# Get png dpi setting
|
||||||
|
png_dpi = self.options.png_dpi
|
||||||
|
|
||||||
|
# Get crop settings
|
||||||
|
if self.options.canvas_to_selection == 'true':
|
||||||
|
canvas_to_selection = 'FitCanvasToSelection;'
|
||||||
|
is_cropped = 'cropped_'
|
||||||
|
else:
|
||||||
|
canvas_to_selection = ''
|
||||||
|
is_cropped = ''
|
||||||
|
|
||||||
|
# Look at selection list 1st item must be background image
|
||||||
|
my_objects = self.svg.selected
|
||||||
|
# Exit if less than 2 objects are selected
|
||||||
|
if len(my_objects) < 2:
|
||||||
|
return
|
||||||
|
if my_objects[-1].TAG != 'image':
|
||||||
|
inkex.errormsg('Last Selected Object Must Be An Image')
|
||||||
|
return
|
||||||
|
|
||||||
|
# Clip background image by each object and export to png
|
||||||
|
|
||||||
|
my_background = my_objects[-1]
|
||||||
|
my_background_id = my_background.get_id()
|
||||||
|
|
||||||
|
# Create a rectangular path same size as image to be clipped used for inverse only
|
||||||
|
image_frame_id = make_image_frame(self, my_background)
|
||||||
|
|
||||||
|
# my_temp_filename_path = make_temp_svg(my_file_path, my_filename)
|
||||||
|
my_temp_svg_file = make_temp_svg(self)
|
||||||
|
my_temp_svg_filename_path = my_temp_svg_file.name
|
||||||
|
|
||||||
|
for my_object in my_objects:
|
||||||
|
|
||||||
|
# current date and time to time stamp
|
||||||
|
timestamp = datetime.today().replace(microsecond=0)
|
||||||
|
timestamp_suffix = str(timestamp.strftime('%Y-%m-%d-%H-%M-%S'))
|
||||||
|
|
||||||
|
# This loop looks at each clipping object, ignores any image objects
|
||||||
|
if my_object.TAG != 'image':
|
||||||
|
my_object_id = my_object.get_id()
|
||||||
|
|
||||||
|
# Build a formatted string for command line actions
|
||||||
|
|
||||||
|
# --batch-process ( or --with-gui ) is required if verbs are used in addition to actions
|
||||||
|
my_actions = '--actions='
|
||||||
|
|
||||||
|
export_png_actions = ''
|
||||||
|
|
||||||
|
# For Positive Clip
|
||||||
|
if self.options.clip_type_inverse is False:
|
||||||
|
|
||||||
|
# Creates individual object clipped files
|
||||||
|
if self.options.output_set == 'separate' or self.options.output_set == 'master_and_separate':
|
||||||
|
my_png_export_filename_path = my_export_path + '/' + my_filename.replace('.svg',
|
||||||
|
'_' + my_object_id + '_' + is_cropped + timestamp_suffix + '.png')
|
||||||
|
|
||||||
|
export_png_actions = my_actions + f'select-by-id:{my_background_id}; \
|
||||||
|
selection-stack-down; \
|
||||||
|
select-by-id:{my_background_id},{my_object_id}; \
|
||||||
|
select-invert; \
|
||||||
|
delete-selection; \
|
||||||
|
select-all; \
|
||||||
|
object-set-clip; \
|
||||||
|
select-all; \
|
||||||
|
{canvas_to_selection} \
|
||||||
|
export-filename:{my_png_export_filename_path}; \
|
||||||
|
export-dpi:{png_dpi}; \
|
||||||
|
export-do'
|
||||||
|
|
||||||
|
export_png_actions = export_png_actions.replace(' ', '')
|
||||||
|
|
||||||
|
inkscape_command_line_export(self, my_temp_svg_filename_path, my_export_path, export_png_actions)
|
||||||
|
|
||||||
|
# For Inverse Clip
|
||||||
|
else:
|
||||||
|
if self.options.output_set == 'separate' or self.options.output_set == 'master_and_separate':
|
||||||
|
my_png_export_filename_path = my_export_path + '/' + my_filename.replace('.svg',
|
||||||
|
'_' + my_object_id + '_''inverse_' + is_cropped + timestamp_suffix + '.png')
|
||||||
|
|
||||||
|
export_png_actions = my_actions + f'select-by-id:{image_frame_id},{my_object_id},{my_background_id}; \
|
||||||
|
select-invert; \
|
||||||
|
delete-selection; \
|
||||||
|
select-by-id:{image_frame_id}; \
|
||||||
|
selection-stack-down; \
|
||||||
|
unselect-by-id:{image_frame_id}; \
|
||||||
|
select-by-id:{image_frame_id},{my_object_id}; \
|
||||||
|
path-difference; \
|
||||||
|
unselect-by-id:{image_frame_id},{my_object_id}; \
|
||||||
|
select-by-id:{my_background_id}; \
|
||||||
|
selection-stack-down; \
|
||||||
|
select-all; \
|
||||||
|
object-set-clip; \
|
||||||
|
select-all; \
|
||||||
|
{canvas_to_selection} \
|
||||||
|
export-filename:{my_png_export_filename_path}; \
|
||||||
|
export-dpi:{png_dpi}; \
|
||||||
|
export-do'
|
||||||
|
|
||||||
|
export_png_actions = export_png_actions.replace(' ', '')
|
||||||
|
|
||||||
|
inkscape_command_line_export(self, my_temp_svg_filename_path, my_export_path, export_png_actions)
|
||||||
|
|
||||||
|
|
||||||
|
if self.options.output_set == 'master_only' or self.options.output_set == 'master_and_separate':
|
||||||
|
|
||||||
|
# Creates a master image with all clipped objects
|
||||||
|
my_actions = '--actions='
|
||||||
|
my_object_id_list = ''
|
||||||
|
|
||||||
|
for my_object in my_objects:
|
||||||
|
if my_object.TAG != 'image':
|
||||||
|
# Build select ID string length - Windows has a max cmdline string length of 8192
|
||||||
|
my_object_id = my_object.get_id()
|
||||||
|
my_object_id_list += f'{my_object_id},'
|
||||||
|
# Remove last comma from id list
|
||||||
|
my_object_id_list = my_object_id_list.rstrip(',')
|
||||||
|
|
||||||
|
if self.options.clip_type_inverse is False:
|
||||||
|
|
||||||
|
my_png_export_filename_path = my_export_path + '/' + my_filename.replace('.svg',
|
||||||
|
'_' + 'master_' + is_cropped + timestamp_suffix + '.png')
|
||||||
|
|
||||||
|
export_png_actions = my_actions + f' \
|
||||||
|
select-by-id:{my_object_id_list},{my_background_id}; \
|
||||||
|
select-invert; \
|
||||||
|
delete-selection; \
|
||||||
|
select-clear; \
|
||||||
|
select-by-id:{my_object_id_list}; \
|
||||||
|
path-combine; \
|
||||||
|
select-clear; \
|
||||||
|
select-by-id:{my_background_id}; \
|
||||||
|
selection-stack-down; \
|
||||||
|
select-clear; \
|
||||||
|
select-all; \
|
||||||
|
object-set-clip; \
|
||||||
|
select-all; \
|
||||||
|
{canvas_to_selection} \
|
||||||
|
export-filename:{my_png_export_filename_path}; \
|
||||||
|
export-dpi:{png_dpi}; \
|
||||||
|
export-do;'
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
my_png_export_filename_path = my_export_path + '/' + my_filename.replace('.svg',
|
||||||
|
'_' + 'inverse_master_' + is_cropped + timestamp_suffix + '.png')
|
||||||
|
|
||||||
|
export_png_actions = my_actions + f' \
|
||||||
|
select-by-id:{my_object_id_list},{my_background_id},{image_frame_id}; \
|
||||||
|
select-invert; \
|
||||||
|
delete-selection; \
|
||||||
|
select-by-id:{my_object_id_list}; \
|
||||||
|
path-combine; \
|
||||||
|
select-clear; \
|
||||||
|
select-by-id:{image_frame_id}; \
|
||||||
|
selection-stack-down; \
|
||||||
|
select-all; \
|
||||||
|
unselect-by-id:{my_background_id}; \
|
||||||
|
path-difference; \
|
||||||
|
select-clear; \
|
||||||
|
select-by-id:{my_background_id}; \
|
||||||
|
selection-stack-down; \
|
||||||
|
select-all; \
|
||||||
|
object-set-clip; \
|
||||||
|
select-all; \
|
||||||
|
{canvas_to_selection} \
|
||||||
|
export-filename:{my_png_export_filename_path}; \
|
||||||
|
export-dpi:{png_dpi}; \
|
||||||
|
export-do;'
|
||||||
|
|
||||||
|
export_png_actions = export_png_actions.replace(' ', '')
|
||||||
|
|
||||||
|
inkscape_command_line_export(self, my_temp_svg_filename_path, my_export_path, export_png_actions)
|
||||||
|
|
||||||
|
# Remove rectangular path
|
||||||
|
image_frame = self.svg.getElementById(image_frame_id)
|
||||||
|
image_frame.delete()
|
||||||
|
|
||||||
|
# Close temp file
|
||||||
|
my_temp_svg_file.close()
|
||||||
|
|
||||||
|
class ClipOut(inkex.EffectExtension):
|
||||||
|
|
||||||
|
def add_arguments(self, pars):
|
||||||
|
pars.add_argument("--clip_type_inverse", type=inkex.Boolean, default=False)
|
||||||
|
pars.add_argument("--notebook_main", default=0)
|
||||||
|
pars.add_argument("--output_set", default=0)
|
||||||
|
pars.add_argument("--canvas_to_selection", default=0)
|
||||||
|
pars.add_argument("--save_path", default=str(Path.home()))
|
||||||
|
pars.add_argument("--png_dpi", type=int, default=96)
|
||||||
|
|
||||||
|
def effect(self):
|
||||||
|
command_line_call(self)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
ClipOut().run()
|
20
extensions/fablabchemnitz/clip_out/meta.json
Normal file
20
extensions/fablabchemnitz/clip_out/meta.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "Clip Out",
|
||||||
|
"id": "fablabchemnitz.de.clip_out",
|
||||||
|
"path": "clip_out",
|
||||||
|
"dependent_extensions": null,
|
||||||
|
"original_name": "Clip Out",
|
||||||
|
"original_id": "org.inkscape.inklinea.clip_out",
|
||||||
|
"license": "GNU GPL v3",
|
||||||
|
"license_url": "https://gitlab.com/inklinea/clip-out/-/blob/main/LICENSE",
|
||||||
|
"comment": "",
|
||||||
|
"source_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.X/src/branch/master/extensions/fablabchemnitz/clip_out",
|
||||||
|
"fork_url": "https://gitlab.com/inklinea/clip-out",
|
||||||
|
"documentation_url": "https://stadtfabrikanten.org/display/IFM/Clip+Out",
|
||||||
|
"inkscape_gallery_url": null,
|
||||||
|
"main_authors": [
|
||||||
|
"github.com/vmario89"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
100
extensions/fablabchemnitz/create_links/create_links.inx
Normal file
100
extensions/fablabchemnitz/create_links/create_links.inx
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||||
|
<name>Create Links (Breakaway Connectors)</name>
|
||||||
|
<id>fablabchemnitz.de.create_links</id>
|
||||||
|
<param name="tab" type="notebook">
|
||||||
|
<page name="tab_settings" gui-text="Settings">
|
||||||
|
<hbox>
|
||||||
|
<vbox>
|
||||||
|
<param name="path_types" type="optiongroup" appearance="combo" gui-text="Apply for">
|
||||||
|
<option value="open_paths">open paths</option>
|
||||||
|
<option value="closed_paths">closed paths</option>
|
||||||
|
<option value="both">both</option>
|
||||||
|
</param>
|
||||||
|
<param name="creationtype" type="optiongroup" appearance="combo" gui-text="Creation">
|
||||||
|
<option value="use_existing">Existing dash style from element</option>
|
||||||
|
<option value="custom_dashpattern">Custom dash pattern</option>
|
||||||
|
<option value="entered_values">Render by unit and link settings</option>
|
||||||
|
</param>
|
||||||
|
<label appearance="header">Creation: Link Settings</label>
|
||||||
|
<param name="creationunit" type="optiongroup" appearance="combo" gui-text="Creation 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>
|
||||||
|
<option value="pc">pc</option>
|
||||||
|
<option value="percent">%</option>
|
||||||
|
</param>
|
||||||
|
<param name="link_count" type="int" min="1" max="9999" gui-text="Link count">1</param>
|
||||||
|
<param name="link_multiplicator" type="int" min="0" max="9999" gui-text="Link multiplicator" gui-description="If set, we create a set of multiple gaps of same size next to the main gap">0</param>
|
||||||
|
<param name="length_link" type="float" min="0.000" max="9999.000" precision="3" gui-text="Link length (the length of the gap)">1.000</param>
|
||||||
|
<param name="link_offset" type="float" min="-9999.000" max="9999.000" precision="3" appearance="full" gui-text="Link offset (+/-)" gui-description="If you selected '%' as creation unit, enter values 0..100. The link will be placed in the middle">0.000</param>
|
||||||
|
<param name="switch_pattern" type="bool" gui-text="Swap links with dashes" gui-description="If enabled, we use gap length as dash length (switches the dasharray pattern).">false</param>
|
||||||
|
<param name="weakening_mode" type="bool" gui-text="Weakening mode" gui-description="If enabled, we colorize the swap links in #0000ff (blue) and disable the option 'Keep selected elements'">false</param>
|
||||||
|
<label appearance="header">Creation: Custom Dash Pattern Settings</label>
|
||||||
|
<param name="custom_dasharray_value" type="string" gui-text="Dash pattern" gui-description="A list of separated lengths that specify the lengths of alternating dashes and gaps. Input only accepts numbers. It ignores percentages or other characters.">10 5.5 2.0 2.0</param>
|
||||||
|
<param name="custom_dashoffset_value" type="float" min="-9999.000" max="9999.000" precision="3" gui-text="Link offset (+/-)">0.000</param>
|
||||||
|
</vbox>
|
||||||
|
<separator/>
|
||||||
|
<vbox>
|
||||||
|
<label appearance="header">General Settings</label>
|
||||||
|
<param name="length_filter" type="bool" gui-text="Enable path length filtering">false</param>
|
||||||
|
<param name="length_filter_value" type="float" min="0.000" max="9999.000" precision="3" gui-text="Paths with length more than">0.000</param>
|
||||||
|
<param name="length_filter_unit" type="optiongroup" appearance="combo" gui-text="Length filter unit">
|
||||||
|
<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>
|
||||||
|
<option value="pc">pc</option>
|
||||||
|
</param>
|
||||||
|
<param name="keep_selected" type="bool" gui-text="Keep selected elements">false</param>
|
||||||
|
<param name="no_convert" type="bool" gui-text="Do not create output path(s) (cosmetic style only)">false</param>
|
||||||
|
<param name="breakapart" type="bool" gui-text="Break apart output path(s) into segments" gui-description="Performs CTRL + SHIFT + K to break the new output path into it's parts. Recommended to enable because default break apart of Inkscape might produce pointy paths.">true</param>
|
||||||
|
<param name="show_info" type="bool" gui-text="Print length, pattern and filtering information/errors" gui-description="Warning: might freeze Inkscape forever if you have a lot of nodes because we create too much print output. Use for debugging only!">false</param>
|
||||||
|
<param name="skip_errors" type="bool" gui-text="Skip errors">false</param>
|
||||||
|
</vbox>
|
||||||
|
</hbox>
|
||||||
|
<separator/>
|
||||||
|
<label>Pro tip: Use 'Keep selected elements' to create links as usual (but with a copy). Then, as second step, work with the 'Swap links' and 'Weakening mode' options on the original element selection to create extra lasercutter weakening lines for better breaking out the parts later after processing.</label>
|
||||||
|
</page>
|
||||||
|
<page name="tab_about" gui-text="About">
|
||||||
|
<label appearance="header">Create Links</label>
|
||||||
|
<label>A utility to create links, also known as tabs, breakaway connectors or bridges. Intended to use with laser cutters.</label>
|
||||||
|
<label>2021 / written by Mario Voigt (Stadtfabrikanten e.V. / FabLab Chemnitz)</label>
|
||||||
|
<spacer/>
|
||||||
|
<label appearance="header">Online Documentation</label>
|
||||||
|
<label appearance="url">https://y.stadtfabrikanten.org/createlinks</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">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>
|
||||||
|
<object-type>path</object-type>
|
||||||
|
<effects-menu>
|
||||||
|
<submenu name="FabLab Chemnitz">
|
||||||
|
<submenu name="Paths - Cut/Intersect/Purge"/>
|
||||||
|
</submenu>
|
||||||
|
</effects-menu>
|
||||||
|
</effect>
|
||||||
|
<script>
|
||||||
|
<command location="inx" interpreter="python">create_links.py</command>
|
||||||
|
</script>
|
||||||
|
</inkscape-extension>
|
300
extensions/fablabchemnitz/create_links/create_links.py
Normal file
300
extensions/fablabchemnitz/create_links/create_links.py
Normal file
@ -0,0 +1,300 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
#
|
||||||
|
# Copyright (C) 2005,2007 Aaron Spike, aaron@ekips.org
|
||||||
|
# Copyright (C) 2009 Alvin Penner, penner@vaxxine.com
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
#
|
||||||
|
"""
|
||||||
|
This extension converts a path into a dashed line using 'stroke-dasharray'
|
||||||
|
It is a modification of the file addelements.py
|
||||||
|
It is a modification of the file convert2dash.py
|
||||||
|
Extension to convert paths into dash-array line
|
||||||
|
|
||||||
|
Extension for InkScape 1.X
|
||||||
|
Author: Mario Voigt / FabLab Chemnitz
|
||||||
|
Mail: mario.voigt@stadtfabrikanten.org
|
||||||
|
Date: 09.04.2021
|
||||||
|
Last patch: 28.10.2021
|
||||||
|
License: GNU GPL v3
|
||||||
|
"""
|
||||||
|
|
||||||
|
import copy
|
||||||
|
import re
|
||||||
|
|
||||||
|
import inkex
|
||||||
|
from inkex import bezier, CubicSuperPath, Group, PathElement
|
||||||
|
from inkex.bezier import csplength
|
||||||
|
|
||||||
|
|
||||||
|
class LinksCreator(inkex.EffectExtension):
|
||||||
|
|
||||||
|
def add_arguments(self, pars):
|
||||||
|
pars.add_argument("--tab")
|
||||||
|
pars.add_argument("--path_types", default="closed_paths", help="Apply for closed paths, open paths or both")
|
||||||
|
pars.add_argument("--creationunit", default="mm", help="Creation Units")
|
||||||
|
pars.add_argument("--creationtype", default="entered_values", help="Creation")
|
||||||
|
pars.add_argument("--link_count", type=int, default=1, help="Link count")
|
||||||
|
pars.add_argument("--link_multiplicator", type=int, default=1, help="If set, we create a set of multiple gaps of same size next to the main gap")
|
||||||
|
pars.add_argument("--length_link", type=float, default=1.000, help="Link length")
|
||||||
|
pars.add_argument("--link_offset", type=float, default=0.000, help="Link offset (+/-)")
|
||||||
|
pars.add_argument("--switch_pattern", type=inkex.Boolean, default=False, help="If enabled, we use gap length as dash length (switches the dasharray pattern")
|
||||||
|
pars.add_argument("--weakening_mode", type=inkex.Boolean, default=False, help="If enabled, we colorize the swap links in #0000ff (blue) and disable the option 'Keep selected elements'")
|
||||||
|
pars.add_argument("--custom_dasharray_value", default="", help="A list of separated lengths that specify the lengths of alternating dashes and gaps. Input only accepts numbers. It ignores percentages or other characters.")
|
||||||
|
pars.add_argument("--custom_dashoffset_value", type=float, default=0.000, help="Link offset (+/-)")
|
||||||
|
pars.add_argument("--length_filter", type=inkex.Boolean, default=False, help="Enable path length filtering")
|
||||||
|
pars.add_argument("--length_filter_value", type=float, default=0.000, help="Paths with length more than")
|
||||||
|
pars.add_argument("--length_filter_unit", default="mm", help="Length filter unit")
|
||||||
|
pars.add_argument("--keep_selected", type=inkex.Boolean, default=False, help="Keep selected elements")
|
||||||
|
pars.add_argument("--no_convert", type=inkex.Boolean, default=False, help="Do not create segments (cosmetic gaps only)")
|
||||||
|
pars.add_argument("--breakapart", type=inkex.Boolean, default=True, help="Performs CTRL + SHIFT + K to break the new output path into it's parts. Recommended to enable because default break apart of Inkscape might produce pointy paths.")
|
||||||
|
pars.add_argument("--show_info", type=inkex.Boolean, default=False, help="Print some length and pattern information")
|
||||||
|
pars.add_argument("--skip_errors", type=inkex.Boolean, default=False, help="Skip errors")
|
||||||
|
|
||||||
|
def breakContours(self, element, breakelements = None): #this does the same as "CTRL + SHIFT + K"
|
||||||
|
if breakelements == None:
|
||||||
|
breakelements = []
|
||||||
|
if element.tag == inkex.addNS('path','svg'):
|
||||||
|
parent = element.getparent()
|
||||||
|
idx = parent.index(element)
|
||||||
|
idSuffix = 0
|
||||||
|
raw = element.path.to_arrays()
|
||||||
|
subPaths, prev = [], 0
|
||||||
|
for i in range(len(raw)): # Breaks compound paths into simple paths
|
||||||
|
if raw[i][0] == 'M' and i != 0:
|
||||||
|
subPaths.append(raw[prev:i])
|
||||||
|
prev = i
|
||||||
|
subPaths.append(raw[prev:])
|
||||||
|
for subpath in subPaths:
|
||||||
|
replacedelement = copy.copy(element)
|
||||||
|
oldId = replacedelement.get('id')
|
||||||
|
csp = CubicSuperPath(subpath)
|
||||||
|
if len(subpath) > 1 and csp[0][0] != csp[0][1]: #avoids pointy paths like M "31.4794 57.6024 Z"
|
||||||
|
replacedelement.set('d', csp)
|
||||||
|
if len(subPaths) == 1:
|
||||||
|
replacedelement.set('id', oldId)
|
||||||
|
else:
|
||||||
|
replacedelement.set('id', oldId + str(idSuffix))
|
||||||
|
idSuffix += 1
|
||||||
|
parent.insert(idx, replacedelement)
|
||||||
|
breakelements.append(replacedelement)
|
||||||
|
parent.remove(element)
|
||||||
|
for child in element.getchildren():
|
||||||
|
self.breakContours(child, breakelements)
|
||||||
|
return breakelements
|
||||||
|
|
||||||
|
def effect(self):
|
||||||
|
def createLinks(element):
|
||||||
|
elementParent = element.getparent()
|
||||||
|
path = element.path.to_arrays() #to_arrays() is deprecated. How to make more modern?
|
||||||
|
pathIsClosed = False
|
||||||
|
if path[-1][0] == 'Z' or \
|
||||||
|
(path[-1][0] == 'L' and path[0][1] == path[-1][1]) or \
|
||||||
|
(path[-1][0] == 'C' and path[0][1] == [path[-1][1][-2], path[-1][1][-1]]) \
|
||||||
|
: #if first is last point the path is also closed. The "Z" command is not required
|
||||||
|
pathIsClosed = True
|
||||||
|
|
||||||
|
if self.options.path_types == 'open_paths' and pathIsClosed is True:
|
||||||
|
return #skip this loop iteration
|
||||||
|
elif self.options.path_types == 'closed_paths' and pathIsClosed is False:
|
||||||
|
return #skip this loop iteration
|
||||||
|
elif self.options.path_types == 'both':
|
||||||
|
pass
|
||||||
|
|
||||||
|
# if keeping is enabled we make of copy of the current element and insert it while modifying the original ones. We could also delete the original and modify a copy...
|
||||||
|
if self.options.keep_selected is True and self.options.weakening_mode is False:
|
||||||
|
parent = element.getparent()
|
||||||
|
idx = parent.index(element)
|
||||||
|
copyelement = copy.copy(element)
|
||||||
|
parent.insert(idx, copyelement)
|
||||||
|
|
||||||
|
# we measure the length of the path to calculate the required dash configuration
|
||||||
|
csp = element.path.transform(element.composed_transform()).to_superpath()
|
||||||
|
slengths, stotal = csplength(csp) #get segment lengths and total length of path in document's internal unit
|
||||||
|
|
||||||
|
if self.options.length_filter is True:
|
||||||
|
if stotal < self.svg.unittouu(str(self.options.length_filter_value) + self.options.length_filter_unit):
|
||||||
|
if self.options.show_info is True: self.msg("element " + element.get('id') + " is shorter than minimum allowed length of {:1.3f} {}. Path length is {:1.3f} {}".format(self.options.length_filter_value, self.options.length_filter_unit, stotal, self.options.creationunit))
|
||||||
|
return #skip this loop iteration
|
||||||
|
|
||||||
|
if self.options.creationunit == "percent":
|
||||||
|
length_link = (self.options.length_link / 100.0) * stotal
|
||||||
|
else:
|
||||||
|
length_link = self.svg.unittouu(str(self.options.length_link) + self.options.creationunit)
|
||||||
|
|
||||||
|
dashes = [] #central dashes array
|
||||||
|
|
||||||
|
if self.options.creationtype == "entered_values":
|
||||||
|
dash_length = ((stotal - length_link * self.options.link_count) / self.options.link_count) - 2 * length_link * self.options.link_multiplicator
|
||||||
|
dashes.append(dash_length)
|
||||||
|
dashes.append(length_link)
|
||||||
|
for i in range(0, self.options.link_multiplicator):
|
||||||
|
dashes.append(length_link) #stroke (=gap)
|
||||||
|
dashes.append(length_link) #gap
|
||||||
|
|
||||||
|
if self.options.switch_pattern is True:
|
||||||
|
dashes = dashes[::-1] #reverse the array
|
||||||
|
|
||||||
|
#validate dashes. May not be negative (dash or gap cannot be longer than the path itself). Otherwise Inkscape will freeze forever. Reason: rendering issue
|
||||||
|
if any(dash <= 0.0 for dash in dashes) == True:
|
||||||
|
if self.options.show_info is True: self.msg("element " + element.get('id') + ": Error! Dash array may not contain negative numbers: " + ' '.join(format(dash, "1.3f") for dash in dashes) + ". Path skipped. Maybe it's too short. Adjust your link count, multiplicator and length accordingly, or set to unit '%'")
|
||||||
|
return False if self.options.skip_errors is True else exit(1)
|
||||||
|
|
||||||
|
if self.options.creationunit == "percent":
|
||||||
|
stroke_dashoffset = (self.options.link_offset / 100.0 * stotal) - length_link/2
|
||||||
|
else:
|
||||||
|
stroke_dashoffset = self.svg.unittouu(str(self.options.link_offset) + self.options.creationunit)
|
||||||
|
|
||||||
|
if self.options.switch_pattern is True:
|
||||||
|
stroke_dashoffset = stroke_dashoffset + ((self.options.link_multiplicator * 2) + 1) * length_link
|
||||||
|
|
||||||
|
if self.options.creationtype == "use_existing":
|
||||||
|
if self.options.no_convert is True:
|
||||||
|
if self.options.show_info is True: self.msg("element " + element.get('id') + ": Nothing to do. Please select another creation method or disable cosmetic style output paths.")
|
||||||
|
return False if self.options.skip_errors is True else exit(1)
|
||||||
|
stroke_dashoffset = 0
|
||||||
|
style = element.style
|
||||||
|
if 'stroke-dashoffset' in style:
|
||||||
|
stroke_dashoffset = style['stroke-dashoffset']
|
||||||
|
try:
|
||||||
|
floats = [float(dash) for dash in re.findall(r"[+]?\d*\.\d+|\d+", style['stroke-dasharray'])] #allow only positive values
|
||||||
|
if len(floats) > 0:
|
||||||
|
dashes = floats #overwrite previously calculated values with custom input
|
||||||
|
else:
|
||||||
|
raise ValueError
|
||||||
|
except:
|
||||||
|
if self.options.show_info is True: self.msg("element " + element.get('id') + ": No dash style to continue with.")
|
||||||
|
return False if self.options.skip_errors is True else exit(1)
|
||||||
|
|
||||||
|
if self.options.creationtype == "custom_dashpattern":
|
||||||
|
stroke_dashoffset = self.options.custom_dashoffset_value
|
||||||
|
try:
|
||||||
|
floats = [float(dash) for dash in re.findall(r"[+]?\d*\.\d+|\d+", self.options.custom_dasharray_value)] #allow only positive values
|
||||||
|
if len(floats) > 0:
|
||||||
|
dashes = floats #overwrite previously calculated values with custom input
|
||||||
|
else:
|
||||||
|
raise ValueError
|
||||||
|
except:
|
||||||
|
if self.options.show_info is True: self.msg("element " + element.get('id') + ": Error in custom dasharray string (might be empty or does not contain any numbers).")
|
||||||
|
return False if self.options.skip_errors is True else exit(1)
|
||||||
|
|
||||||
|
#assign stroke dasharray from entered values, existing style or custom dashpattern
|
||||||
|
stroke_dasharray = ' '.join(format(dash, "1.3f") for dash in dashes)
|
||||||
|
|
||||||
|
# check if the element has a style attribute. If not we create a blank one with a black stroke and without fill
|
||||||
|
style = None
|
||||||
|
default_fill = 'none'
|
||||||
|
default_stroke = '#000000'
|
||||||
|
default_stroke_width = str(self.svg.unittouu('1px'))
|
||||||
|
if element.attrib.has_key('style'):
|
||||||
|
element.style['stroke-dasharray'] = stroke_dasharray
|
||||||
|
element.style['stroke-dashoffset'] = stroke_dashoffset
|
||||||
|
#if has style attribute but the style attribute does not contain fill, stroke, stroke-width, stroke-dasharray or stroke-dashoffset yet
|
||||||
|
if element.style.get('fill') is None: element.style['fill'] = default_fill
|
||||||
|
if element.style.get('stroke') is None: element.style['stroke'] = default_stroke
|
||||||
|
if element.style.get('stroke-width') is None: element.style['stroke-width'] = default_stroke_width
|
||||||
|
else:
|
||||||
|
element.style = 'fill:{};stroke:{};stroke-width:{};stroke-dasharray:{};stroke-dashoffset:{};'.format(
|
||||||
|
default_fill, default_stroke, default_stroke_width, stroke_dasharray, stroke_dashoffset)
|
||||||
|
|
||||||
|
#if enabled, we override stroke color with blue (now, as the element definitely has a style)
|
||||||
|
if self.options.weakening_mode is True and self.options.switch_pattern is True:
|
||||||
|
element.style['stroke'] = "#0000ff"
|
||||||
|
|
||||||
|
# Print some info about values
|
||||||
|
if self.options.show_info is True:
|
||||||
|
self.msg("element " + element.get('id') + ":")
|
||||||
|
if self.options.creationunit == "percent":
|
||||||
|
self.msg(" * total path length = {:1.3f} {}".format(stotal, self.svg.unit)) #show length, converted in selected unit
|
||||||
|
self.msg(" * (calculated) offset: {:1.3f} %".format(stroke_dashoffset))
|
||||||
|
if self.options.creationtype == "entered_values":
|
||||||
|
self.msg(" * (calculated) gap length: {:1.3f} %".format(length_link))
|
||||||
|
else:
|
||||||
|
self.msg(" * total path length = {:1.3f} {} ({:1.3f} {})".format(self.svg.uutounit(stotal, self.options.creationunit), self.options.creationunit, stotal, self.svg.unit)) #show length, converted in selected unit
|
||||||
|
self.msg(" * (calculated) offset: {:1.3f} {}".format(self.svg.uutounit(stroke_dashoffset, self.options.creationunit), self.options.creationunit))
|
||||||
|
if self.options.creationtype == "entered_values":
|
||||||
|
self.msg(" * (calculated) gap length: {:1.3f} {}".format(length_link, self.options.creationunit))
|
||||||
|
if self.options.creationtype == "entered_values":
|
||||||
|
self.msg(" * total gaps = {}".format(self.options.link_count))
|
||||||
|
self.msg(" * (calculated) dash/gap pattern: {} ({})".format(stroke_dasharray, self.svg.unit))
|
||||||
|
|
||||||
|
# Conversion step (split cosmetic path into real segments)
|
||||||
|
if self.options.no_convert is False:
|
||||||
|
style = element.style #get the style again, but this time as style class
|
||||||
|
|
||||||
|
gaps = []
|
||||||
|
new = []
|
||||||
|
for sub in element.path.to_superpath():
|
||||||
|
idash = 0
|
||||||
|
dash = dashes[0]
|
||||||
|
length = float(stroke_dashoffset)
|
||||||
|
while dash < length:
|
||||||
|
length = length - dash
|
||||||
|
idash = (idash + 1) % len(dashes)
|
||||||
|
dash = dashes[idash]
|
||||||
|
new.append([sub[0][:]])
|
||||||
|
i = 1
|
||||||
|
while i < len(sub):
|
||||||
|
dash = dash - length
|
||||||
|
length = bezier.cspseglength(new[-1][-1], sub[i])
|
||||||
|
while dash < length:
|
||||||
|
new[-1][-1], nxt, sub[i] = bezier.cspbezsplitatlength(new[-1][-1], sub[i], dash/length)
|
||||||
|
if idash % 2: # create a gap
|
||||||
|
new.append([nxt[:]])
|
||||||
|
else: # splice the curve
|
||||||
|
new[-1].append(nxt[:])
|
||||||
|
length = length - dash
|
||||||
|
idash = (idash + 1) % len(dashes)
|
||||||
|
dash = dashes[idash]
|
||||||
|
if idash % 2:
|
||||||
|
new.append([sub[i]])
|
||||||
|
else:
|
||||||
|
new[-1].append(sub[i])
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
#filter pointy subpaths
|
||||||
|
final_new = []
|
||||||
|
for sub in new:
|
||||||
|
if len(sub) > 1:
|
||||||
|
final_new.append(sub)
|
||||||
|
|
||||||
|
style.pop('stroke-dasharray')
|
||||||
|
element.pop('sodipodi:type')
|
||||||
|
element.path = CubicSuperPath(final_new)
|
||||||
|
element.style = style
|
||||||
|
|
||||||
|
# break apart the combined path to have multiple elements
|
||||||
|
if self.options.breakapart is True:
|
||||||
|
breakOutputelements = None
|
||||||
|
breakOutputelements = self.breakContours(element, breakOutputelements)
|
||||||
|
breakApartGroup = elementParent.add(inkex.Group())
|
||||||
|
for breakOutputelement in breakOutputelements:
|
||||||
|
breakApartGroup.append(breakOutputelement)
|
||||||
|
#self.msg(replacedelement.get('id'))
|
||||||
|
#self.svg.selection.set(replacedelement.get('id')) #update selection to split paths segments (does not work, so commented out)
|
||||||
|
|
||||||
|
if len(self.svg.selected) > 0:
|
||||||
|
for element in self.svg.selection.values():
|
||||||
|
#at first we need to break down combined elements to single path, otherwise dasharray cannot properly be applied
|
||||||
|
breakInputelements = None
|
||||||
|
breakInputelements = self.breakContours(element, breakInputelements)
|
||||||
|
for breakInputelement in breakInputelements:
|
||||||
|
createLinks(breakInputelement)
|
||||||
|
else:
|
||||||
|
self.msg('Please select some paths first.')
|
||||||
|
return
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
LinksCreator().run()
|
20
extensions/fablabchemnitz/create_links/meta.json
Normal file
20
extensions/fablabchemnitz/create_links/meta.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "Create Links (Breakaway Connectors)",
|
||||||
|
"id": "fablabchemnitz.de.create_links",
|
||||||
|
"path": "create_links",
|
||||||
|
"dependent_extensions": null,
|
||||||
|
"original_name": "Create Links (Breakaway Connectors)",
|
||||||
|
"original_id": "fablabchemnitz.de.create_links",
|
||||||
|
"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/create_links",
|
||||||
|
"fork_url": null,
|
||||||
|
"documentation_url": "https://stadtfabrikanten.org/pages/viewpage.action?pageId=104923235",
|
||||||
|
"inkscape_gallery_url": "https://inkscape.org/~MarioVoigt/%E2%98%85create-links-breakaway-connectors",
|
||||||
|
"main_authors": [
|
||||||
|
"github.com/vmario89"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
2
extensions/fablabchemnitz/dxf2papercraft/.gitignore
vendored
Normal file
2
extensions/fablabchemnitz/dxf2papercraft/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/debug.dat
|
||||||
|
/delete_me_later
|
81
extensions/fablabchemnitz/dxf2papercraft/dxf2papercraft.inx
Normal file
81
extensions/fablabchemnitz/dxf2papercraft/dxf2papercraft.inx
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||||
|
<name>DXF 2 Papercraft</name>
|
||||||
|
<id>fablabchemnitz.de.dxf2papercraft</id>
|
||||||
|
<param name="tab" type="notebook">
|
||||||
|
<page name="tab_settings" gui-text="DXF 2 Papercraft">
|
||||||
|
<label appearance="header">Unfolding settings</label>
|
||||||
|
<param name="nomerge" type="bool" gui-text="No merging of faces into single polygon">false</param>
|
||||||
|
<param name="number" type="bool" gui-text="Print face numbers (labels)" gui-description="Disable this if you want to split custom faces">false</param>
|
||||||
|
<param name="divide" type="bool" gui-text="Draw each face separate">false</param>
|
||||||
|
<param name="overlap" type="bool" gui-text="Allow overlapping faces in cut-out sheet">false</param>
|
||||||
|
<param name="hide" type="bool" gui-text="Hide glue tabs. Does not work if 'Print face numbers (labels)' is activated">false</param>
|
||||||
|
<param name="force" type="bool" gui-text="Force glue tabs, even if intersecting faces">false</param>
|
||||||
|
<param name="split" type="string" gui-text="Comma separated list of face numbers to disconnect from the rest" gui-description="Enable face numbers tp have a view on it. If face number option is activated the splitting will not be performed!"></param>
|
||||||
|
<param name="strategy" type="optiongroup" appearance="combo" gui-text="Generation strategy">
|
||||||
|
<option value="0">Draw smallest polygon first</option>
|
||||||
|
<option value="1">Draw largest first </option>
|
||||||
|
<option value="2">As ordered in file</option>
|
||||||
|
<option value="3">Keep adjacent faces continuous</option>
|
||||||
|
<option value="4">Stretch 2D layout wide</option>
|
||||||
|
<option value="5">Keep layout dense</option>
|
||||||
|
</param>
|
||||||
|
<separator/>
|
||||||
|
<label appearance="header">General</label>
|
||||||
|
<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="scalefactor" type="float" precision="3" min="0.0001" max="10000.0" gui-text="Manual scale factor" gui-description="default is 1.0">1.0</param>
|
||||||
|
<separator/>
|
||||||
|
<label appearance="header">Input File</label>
|
||||||
|
<param name="inputfile" type="path" gui-text=" " gui-description="The model to unfold" filetypes="dxf" mode="file">/your/dxf/file</param>
|
||||||
|
</page>
|
||||||
|
<page name="tab_about" gui-text="About">
|
||||||
|
<label appearance="header">DXF 2 Papercraft</label>
|
||||||
|
<label>Unfold and import DXF into InkScape using dxf2papercraft. This is some kind of wrapper extension utilizing kabeja to convert the dxf output from dxf2papercraft into SVG. To make it work you need to install at least java.</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/dxf2papercraft</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">http://dxf2papercraft.sourceforge.net</label>
|
||||||
|
<label appearance="url">http://kabeja.sourceforge.net</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 Boxes/Papercraft">
|
||||||
|
<submenu name="Papercraft Flatteners"/>
|
||||||
|
</submenu>
|
||||||
|
</effects-menu>
|
||||||
|
</effect>
|
||||||
|
<script>
|
||||||
|
<command location="inx" interpreter="python">dxf2papercraft.py</command>
|
||||||
|
</script>
|
||||||
|
</inkscape-extension>
|
154
extensions/fablabchemnitz/dxf2papercraft/dxf2papercraft.py
Normal file
154
extensions/fablabchemnitz/dxf2papercraft/dxf2papercraft.py
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import inkex
|
||||||
|
import tempfile
|
||||||
|
import subprocess
|
||||||
|
from subprocess import Popen, PIPE
|
||||||
|
from lxml import etree
|
||||||
|
from inkex import Transform
|
||||||
|
|
||||||
|
"""
|
||||||
|
Extension for InkScape 1.0
|
||||||
|
|
||||||
|
Unfold and import DXF into InkScape using dxf2papercraft. This is some kind of wrapper extension utilizing kabeja to convert the dxf output from dxf2papercraft into SVG.
|
||||||
|
To make it work you need to install at least java.
|
||||||
|
|
||||||
|
Author: Mario Voigt / FabLab Chemnitz
|
||||||
|
Mail: mario.voigt@stadtfabrikanten.org
|
||||||
|
Date: 11.09.2020
|
||||||
|
Last patch: 26.10.2021
|
||||||
|
License: GNU GPL v3
|
||||||
|
|
||||||
|
Module licenses
|
||||||
|
- dxf2papercraft (dxf2papercraft.sourceforge.net) - GPL v3 License
|
||||||
|
- kabeja (http://kabeja.sourceforge.net/) - Apache v2 License
|
||||||
|
|
||||||
|
ToDos:
|
||||||
|
- in case of errors maybe think about adding ezdxf library to filter unsupported entities (similar like done in dxfdwgimporter extension)
|
||||||
|
- maybe add some DXF model preview tool (maybe a useless idea at all)
|
||||||
|
"""
|
||||||
|
|
||||||
|
class DXF2Papercraft(inkex.EffectExtension):
|
||||||
|
|
||||||
|
def add_arguments(self, pars):
|
||||||
|
pars.add_argument("--tab")
|
||||||
|
pars.add_argument("--inputfile")
|
||||||
|
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")
|
||||||
|
pars.add_argument("--scalefactor", type=float, default=1.0, help="Manual scale factor")
|
||||||
|
pars.add_argument("--nomerge", type=inkex.Boolean, default=False, help="No merging of faces into single polygon")
|
||||||
|
pars.add_argument("--number", type=inkex.Boolean, default=False, help="Print face numbers (labels)")
|
||||||
|
pars.add_argument("--divide", type=inkex.Boolean, default=False, help="Draw each face separate")
|
||||||
|
pars.add_argument("--overlap", type=inkex.Boolean, default=False, help="Allow overlapping faces in cut-out sheet")
|
||||||
|
pars.add_argument("--hide", type=inkex.Boolean, default=False, help="Hide glue tabs")
|
||||||
|
pars.add_argument("--force", type=inkex.Boolean, default=False, help="Force glue tabs, even if intersecting faces")
|
||||||
|
pars.add_argument("--split", default="", help="Comma separated list of face numbers to disconnect from the rest")
|
||||||
|
pars.add_argument("--strategy", default=0, help="Generation strategy")
|
||||||
|
|
||||||
|
def effect(self):
|
||||||
|
dxf_input = self.options.inputfile
|
||||||
|
if not os.path.exists(dxf_input):
|
||||||
|
inkex.utils.debug("The input file does not exist. Please select a proper file and try again.")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
# Prepare output
|
||||||
|
dxf_output = os.path.join(tempfile.gettempdir(), os.path.splitext(os.path.basename(dxf_input))[0] + ".dxf")
|
||||||
|
svg_output = os.path.join(tempfile.gettempdir(), os.path.splitext(os.path.basename(dxf_input))[0] + ".svg")
|
||||||
|
|
||||||
|
# Clean up possibly previously generated output file from dxf2papercraft
|
||||||
|
if os.path.exists(dxf_output):
|
||||||
|
try:
|
||||||
|
os.remove(dxf_output)
|
||||||
|
except OSError as e:
|
||||||
|
inkex.utils.debug("Error while deleting previously generated output file " + dxf_input)
|
||||||
|
|
||||||
|
if os.path.exists("delete_me_later"):
|
||||||
|
try:
|
||||||
|
os.remove("delete_me_later")
|
||||||
|
except OSError as e:
|
||||||
|
pass
|
||||||
|
if os.path.exists("debug.dat"):
|
||||||
|
try:
|
||||||
|
os.remove("debug.dat")
|
||||||
|
except OSError as e:
|
||||||
|
pass
|
||||||
|
|
||||||
|
# Run dxf2papercraft (make unfold)
|
||||||
|
if os.name=="nt":
|
||||||
|
dxf2ppc_cmd = "dxf2papercraft\\dxf2papercraft.exe "
|
||||||
|
else:
|
||||||
|
dxf2ppc_cmd = "./dxf2papercraft/dxf2papercraft "
|
||||||
|
if self.options.nomerge == True: dxf2ppc_cmd += "--nomerge "
|
||||||
|
if self.options.number == True: dxf2ppc_cmd += "--number "
|
||||||
|
if self.options.divide == True: dxf2ppc_cmd += "--divide "
|
||||||
|
if self.options.overlap == True: dxf2ppc_cmd += "--overlap "
|
||||||
|
if self.options.hide == True: dxf2ppc_cmd += "--hide "
|
||||||
|
if self.options.force == True: dxf2ppc_cmd += "--force "
|
||||||
|
if self.options.split is not None and self.options.split != "":
|
||||||
|
dxf2ppc_cmd += "--split " + str(self.options.split) + " " #warning. this option has no validator!
|
||||||
|
dxf2ppc_cmd += "--strategy " + self.options.strategy + " "
|
||||||
|
dxf2ppc_cmd += "\"" + dxf_input + "\" "
|
||||||
|
dxf2ppc_cmd += "\"" + dxf_output + "\""
|
||||||
|
p = Popen(dxf2ppc_cmd, shell=True, stdout=PIPE, stderr=PIPE)
|
||||||
|
stdout, stderr = p.communicate()
|
||||||
|
p.wait()
|
||||||
|
if p.returncode != 0:
|
||||||
|
inkex.utils.debug("dxf2papercraft failed: %d %s %s" % (p.returncode, stdout, stderr))
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
#print command
|
||||||
|
#inkex.utils.debug(dxf2ppc_cmd)
|
||||||
|
|
||||||
|
if not os.path.exists(dxf_output):
|
||||||
|
inkex.utils.debug("There was no DXF output generated by dxf2papercraft. Maybe the input file is not a correct 3D DXF. Please check your model file.")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
# Convert the DXF output to SVG
|
||||||
|
wd = os.path.join(os.getcwd(), "kabeja")
|
||||||
|
proc = subprocess.Popen("java -jar launcher.jar -nogui -pipeline svg " + dxf_output + " " + svg_output, cwd=wd, shell=True, stdout=PIPE, stderr=PIPE)
|
||||||
|
stdout, stderr = proc.communicate()
|
||||||
|
if proc.returncode != 0:
|
||||||
|
inkex.errormsg("kabeja failed: %d %s %s" % (proc.returncode, stdout, stderr))
|
||||||
|
|
||||||
|
# Write the generated SVG into InkScape's canvas
|
||||||
|
try:
|
||||||
|
stream = open(svg_output, 'r')
|
||||||
|
except FileNotFoundError as e:
|
||||||
|
inkex.utils.debug("There was no SVG output generated by kabeja. Cannot continue")
|
||||||
|
exit(1)
|
||||||
|
p = etree.XMLParser(huge_tree=True)
|
||||||
|
doc = etree.parse(stream, parser=etree.XMLParser(huge_tree=True)).getroot()
|
||||||
|
stream.close()
|
||||||
|
|
||||||
|
dxfGroup = inkex.Group(id=self.svg.get_unique_id("dxf2papercraft-"))
|
||||||
|
for element in doc.iter("{http://www.w3.org/2000/svg}g"):
|
||||||
|
if element.get('id') != "draft":
|
||||||
|
dxfGroup.append(element)
|
||||||
|
self.document.getroot().add(dxfGroup)
|
||||||
|
|
||||||
|
#apply scale factor
|
||||||
|
translation_matrix = [[self.options.scalefactor, 0.0, 0.0], [0.0, self.options.scalefactor, 0.0]]
|
||||||
|
dxfGroup.transform = Transform(translation_matrix) @ dxfGroup.transform
|
||||||
|
|
||||||
|
#Adjust viewport and width/height to have the import at the center of the canvas
|
||||||
|
if self.options.resizetoimport:
|
||||||
|
#push some calculation of all bounding boxes. seems to refresh something in the background which makes the bbox calculation working at the bottom
|
||||||
|
for element in self.document.getroot().iter("*"):
|
||||||
|
try:
|
||||||
|
element.bounding_box()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
bbox = dxfGroup.bounding_box() #only works because we process bounding boxes previously. see top
|
||||||
|
if bbox is not None:
|
||||||
|
root = self.svg.getElement('//svg:svg');
|
||||||
|
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 resizing to bounding box.")
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
DXF2Papercraft().run()
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
extensions/fablabchemnitz/dxf2papercraft/dxf2papercraft/dxf2papercraft
Executable file
BIN
extensions/fablabchemnitz/dxf2papercraft/dxf2papercraft/dxf2papercraft
Executable file
Binary file not shown.
BIN
extensions/fablabchemnitz/dxf2papercraft/dxf2papercraft/dxf2papercraft.exe
Executable file
BIN
extensions/fablabchemnitz/dxf2papercraft/dxf2papercraft/dxf2papercraft.exe
Executable file
Binary file not shown.
26
extensions/fablabchemnitz/dxf2papercraft/kabeja/INSTALL
Normal file
26
extensions/fablabchemnitz/dxf2papercraft/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/dxf2papercraft/kabeja/README
Normal file
148
extensions/fablabchemnitz/dxf2papercraft/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>
|
180
extensions/fablabchemnitz/dxf2papercraft/kabeja/conf/process.xml
Normal file
180
extensions/fablabchemnitz/dxf2papercraft/kabeja/conf/process.xml
Normal file
@ -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>
|
18
extensions/fablabchemnitz/dxf2papercraft/kabeja/conf/ui.xml
Normal file
18
extensions/fablabchemnitz/dxf2papercraft/kabeja/conf/ui.xml
Normal file
@ -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/dxf2papercraft/kabeja/doc/userguide.pdf
Normal file
1000
extensions/fablabchemnitz/dxf2papercraft/kabeja/doc/userguide.pdf
Normal file
File diff suppressed because one or more lines are too long
27
extensions/fablabchemnitz/dxf2papercraft/kabeja/font.xml
Normal file
27
extensions/fablabchemnitz/dxf2papercraft/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/dxf2papercraft/kabeja/kabeja.exe
Normal file
BIN
extensions/fablabchemnitz/dxf2papercraft/kabeja/kabeja.exe
Normal file
Binary file not shown.
7
extensions/fablabchemnitz/dxf2papercraft/kabeja/kabeja.sh
Executable file
7
extensions/fablabchemnitz/dxf2papercraft/kabeja/kabeja.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
JAVA_MEM=256m
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
java -Xmx$JAVA_MEM -jar launcher.jar $@
|
BIN
extensions/fablabchemnitz/dxf2papercraft/kabeja/launcher.jar
Normal file
BIN
extensions/fablabchemnitz/dxf2papercraft/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/dxf2papercraft/kabeja/lib/js.jar
Normal file
BIN
extensions/fablabchemnitz/dxf2papercraft/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.
BIN
extensions/fablabchemnitz/dxf2papercraft/kabeja/lib/xml-apis.jar
Normal file
BIN
extensions/fablabchemnitz/dxf2papercraft/kabeja/lib/xml-apis.jar
Normal file
Binary file not shown.
255532
extensions/fablabchemnitz/dxf2papercraft/kabeja/samples/dxf/draft1.dxf
Normal file
255532
extensions/fablabchemnitz/dxf2papercraft/kabeja/samples/dxf/draft1.dxf
Normal file
File diff suppressed because it is too large
Load Diff
118370
extensions/fablabchemnitz/dxf2papercraft/kabeja/samples/dxf/draft2.dxf
Normal file
118370
extensions/fablabchemnitz/dxf2papercraft/kabeja/samples/dxf/draft2.dxf
Normal file
File diff suppressed because it is too large
Load Diff
137444
extensions/fablabchemnitz/dxf2papercraft/kabeja/samples/dxf/draft3.dxf
Normal file
137444
extensions/fablabchemnitz/dxf2papercraft/kabeja/samples/dxf/draft3.dxf
Normal file
File diff suppressed because it is too large
Load Diff
77318
extensions/fablabchemnitz/dxf2papercraft/kabeja/samples/dxf/draft4.dxf
Normal file
77318
extensions/fablabchemnitz/dxf2papercraft/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
21
extensions/fablabchemnitz/dxf2papercraft/meta.json
Normal file
21
extensions/fablabchemnitz/dxf2papercraft/meta.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "DXF 2 Papercraft",
|
||||||
|
"id": "fablabchemnitz.de.dxf2papercraft",
|
||||||
|
"path": "dxf2papercraft",
|
||||||
|
"dependent_extensions": null,
|
||||||
|
"original_name": "DXF 2 Papercraft",
|
||||||
|
"original_id": "fablabchemnitz.de.dxf2papercraft",
|
||||||
|
"license": "GNU GPL v3",
|
||||||
|
"license_url": "https://sourceforge.net/projects/dxf2papercraft/files/dxf2papercraft_v0.2.tgz/download",
|
||||||
|
"comment": "Written by Mario Voigt",
|
||||||
|
"source_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.X/src/branch/master/extensions/fablabchemnitz/dxf2papercraft",
|
||||||
|
"fork_url": "",
|
||||||
|
"documentation_url": "https://stadtfabrikanten.org/display/IFM/DXF+2+Papercraft",
|
||||||
|
"inkscape_gallery_url": "https://inkscape.org/~MarioVoigt/%E2%98%85dxf2papercraft",
|
||||||
|
"main_authors": [
|
||||||
|
"sourceforge.net/haenselmann",
|
||||||
|
"github.com/vmario89"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
@ -165,14 +165,11 @@ class ExportObject(inkex.EffectExtension):
|
|||||||
|
|
||||||
template.append(group)
|
template.append(group)
|
||||||
svg_out = os.path.join(tempfile.gettempdir(), svg_filename)
|
svg_out = os.path.join(tempfile.gettempdir(), svg_filename)
|
||||||
|
|
||||||
if self.options.wrap_transform is False:
|
if self.options.wrap_transform is False:
|
||||||
#self.load(inkscape_command(template.tostring(), select=GROUP_ID, verbs=['SelectionUnGroup;FileSave'])) #fails due to new bug
|
|
||||||
|
|
||||||
#workaround
|
|
||||||
self.save_document(template, svg_out) #export recent file
|
self.save_document(template, svg_out) #export recent file
|
||||||
actions_list=[]
|
actions_list=[]
|
||||||
actions_list.append("SelectionUnGroup")
|
actions_list.append("selection-ungroup")
|
||||||
actions_list.append("export-type:svg")
|
actions_list.append("export-type:svg")
|
||||||
actions_list.append("export-filename:{}".format(svg_out))
|
actions_list.append("export-filename:{}".format(svg_out))
|
||||||
actions_list.append("export-do")
|
actions_list.append("export-do")
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||||
|
<name>Guitar Fretboard</name>
|
||||||
|
<id>fablabchemnitz.de.guitar_fretboard</id>
|
||||||
|
<param name="scale" type="string" gui-text="Scalelenght:">25.00in</param>
|
||||||
|
<param name="lnut" type="string" gui-text="Width at Nut:">43mm</param>
|
||||||
|
<param name="l12" type="string" gui-text="Width at fret 12:">53mm</param>
|
||||||
|
<param name="numfret" type="int" min="1" max="36" gui-text="Number of frets:">22</param>
|
||||||
|
<param name="fbext" type="string" gui-text="Extension below last fret:">8mm</param>
|
||||||
|
<param name="fretwidth" type="string" gui-text="Fret Width:">2mm</param>
|
||||||
|
<effect>
|
||||||
|
<object-type>all</object-type>
|
||||||
|
<effects-menu>
|
||||||
|
<submenu name="FabLab Chemnitz">
|
||||||
|
<submenu name="Music"/></submenu>
|
||||||
|
</effects-menu>
|
||||||
|
</effect>
|
||||||
|
<script>
|
||||||
|
<command location="inx" interpreter="python">guitar_fretboard.py</command>
|
||||||
|
</script>
|
||||||
|
</inkscape-extension>
|
237
extensions/fablabchemnitz/guitar_fretboard/guitar_fretboard.py
Normal file
237
extensions/fablabchemnitz/guitar_fretboard/guitar_fretboard.py
Normal file
@ -0,0 +1,237 @@
|
|||||||
|
#! /usr/bin/env python
|
||||||
|
'''
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2021 Christophe Grellier
|
||||||
|
|
||||||
|
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.
|
||||||
|
'''
|
||||||
|
|
||||||
|
__version__ = "0.1"
|
||||||
|
|
||||||
|
import inkex
|
||||||
|
from lxml import etree
|
||||||
|
|
||||||
|
|
||||||
|
class Fretboard:
|
||||||
|
|
||||||
|
def __init__(self, scale=635.0):
|
||||||
|
self.scale = scale
|
||||||
|
self.nb_frets = 24
|
||||||
|
self.fret_width = 2.0
|
||||||
|
self.width_nut = 43.0
|
||||||
|
self.width_12 = 53.0
|
||||||
|
self.extension = 8.0
|
||||||
|
|
||||||
|
def fret_distance_bridge(self, fret):
|
||||||
|
return self.scale / pow(2.0, (fret / 12.0))
|
||||||
|
|
||||||
|
def fret_distance_nut(self, fret):
|
||||||
|
return self.scale - self.fret_distance_bridge(fret)
|
||||||
|
|
||||||
|
def fb_lenght(self):
|
||||||
|
return self.fret_distance_nut(self.nb_frets) + self.extension
|
||||||
|
|
||||||
|
def fb_width_at(self, dist):
|
||||||
|
return self.width_nut + 2.0 * (self.width_12 - self.width_nut) * dist / self.scale
|
||||||
|
|
||||||
|
def fret_bounds(self, fret):
|
||||||
|
distup = self.fret_distance_nut(fret) - self.fret_width / 2.0
|
||||||
|
distdown = self.fret_distance_nut(fret) + self.fret_width / 2.0
|
||||||
|
width_up = self.fb_width_at(distup)
|
||||||
|
width_down = self.fb_width_at(distdown)
|
||||||
|
return distup, distdown, width_up, width_down
|
||||||
|
|
||||||
|
def svg_polyline(self, pts, closed=False):
|
||||||
|
svg = ""
|
||||||
|
for pt in pts:
|
||||||
|
svg += "L {},{} ".format(pt[0], pt[1])
|
||||||
|
svg = "M" + svg[1:]
|
||||||
|
if closed:
|
||||||
|
svg += "Z"
|
||||||
|
return svg
|
||||||
|
|
||||||
|
def svg_contour(self):
|
||||||
|
lfb = self.fb_lenght()
|
||||||
|
lowwidth = self.fb_width_at(lfb)
|
||||||
|
pts = [(-self.width_nut / 2.0, 0),
|
||||||
|
(self.width_nut / 2.0, 0),
|
||||||
|
(lowwidth / 2.0, lfb),
|
||||||
|
(-lowwidth / 2.0, lfb)]
|
||||||
|
return self.svg_polyline(pts, True)
|
||||||
|
|
||||||
|
def svg_h_line(self, width, y):
|
||||||
|
pts = [(-width / 2.0, y),
|
||||||
|
(width / 2.0, y)]
|
||||||
|
return self.svg_polyline(pts)
|
||||||
|
|
||||||
|
def svg_fret_centerline(self, fret):
|
||||||
|
dist = self.fret_distance_nut(fret)
|
||||||
|
return self.svg_h_line(self.fb_width_at(dist), dist)
|
||||||
|
|
||||||
|
def svg_fret_contour(self, fret):
|
||||||
|
distup, distdown, width_up, width_down = self.fret_bounds(fret)
|
||||||
|
pts = [(-width_up / 2.0, distup),
|
||||||
|
(width_up / 2.0, distup),
|
||||||
|
(width_down / 2.0, distdown),
|
||||||
|
(-width_down / 2.0, distdown)]
|
||||||
|
return self.svg_polyline(pts, True)
|
||||||
|
|
||||||
|
def svg_fret_end(self, fret, side=1.0):
|
||||||
|
distup, distdown, width_up, width_down = self.fret_bounds(fret)
|
||||||
|
return 'M {},{} C {},{} {},{} {},{} Z'.format(side * width_up / 2.0, distup,
|
||||||
|
side * width_up / 2.0 - side * self.fret_width / 2.0, distup,
|
||||||
|
side * width_down / 2.0 - side * self.fret_width / 2.0, distdown,
|
||||||
|
side * width_down / 2.0, distdown)
|
||||||
|
|
||||||
|
def svg_fret_cross(self, fret):
|
||||||
|
upperfretpos = self.fret_distance_nut(fret - 1)
|
||||||
|
lowerfretpos = self.fret_distance_nut(fret)
|
||||||
|
markerpos = upperfretpos + (lowerfretpos - upperfretpos) / 2.0
|
||||||
|
hline_cross_path = 'M {},{} L {},{}'.format(-self.fb_width_at(markerpos) / 2.0, markerpos,
|
||||||
|
self.fb_width_at(markerpos) / 2.0, markerpos)
|
||||||
|
vline_cross_path = ' M {},{} L {},{}'.format(0, upperfretpos,
|
||||||
|
0, lowerfretpos)
|
||||||
|
return hline_cross_path, vline_cross_path
|
||||||
|
|
||||||
|
|
||||||
|
class GuitarFretboard(inkex.EffectExtension):
|
||||||
|
|
||||||
|
def add_arguments(self, pars):
|
||||||
|
pars.add_argument("-s", "--scale", default="25in", help="The fingerboard scalelenght")
|
||||||
|
pars.add_argument("-w", "--lnut", default="43mm", help="The fingerboard width at nut")
|
||||||
|
pars.add_argument("-x", "--l12", default="53mm", help="The fingerboard width at fret 12")
|
||||||
|
pars.add_argument("-n", "--numfret", type=int, default=22, help="Number of frets")
|
||||||
|
pars.add_argument("-e", "--fbext", default="8mm", help="Lenght of the fingerboard extension below last fret")
|
||||||
|
pars.add_argument("-f", "--fretwidth", default="2mm", help="Fret Width")
|
||||||
|
|
||||||
|
def effect(self):
|
||||||
|
svg = self.document.getroot()
|
||||||
|
|
||||||
|
# ************ Layer 1 Definition ***************
|
||||||
|
|
||||||
|
layer = etree.SubElement(svg, 'g')
|
||||||
|
layer.set(inkex.addNS('label', 'inkscape'), 'Fretboard')
|
||||||
|
layer.set(inkex.addNS('groupmode', 'inkscape'), 'layer')
|
||||||
|
|
||||||
|
# ************ Layer 2 Definition ***************
|
||||||
|
|
||||||
|
layer2 = etree.SubElement(svg, 'g')
|
||||||
|
layer2.set(inkex.addNS('label', 'inkscape'), 'Fret positions')
|
||||||
|
layer2.set(inkex.addNS('groupmode', 'inkscape'), 'layer')
|
||||||
|
|
||||||
|
# ************ Group Definitions ***************
|
||||||
|
|
||||||
|
fb_id = svg.get_unique_id('fretboard')
|
||||||
|
self.box = g = etree.SubElement(layer, 'g', {'id': fb_id})
|
||||||
|
fp_id = svg.get_unique_id('fret-positions')
|
||||||
|
self.box2 = g3 = etree.SubElement(layer2, 'g', {'id': fp_id})
|
||||||
|
fm_id = svg.get_unique_id('fretmarkers')
|
||||||
|
self.box4 = g4 = etree.SubElement(layer2, 'g', {'id': fm_id})
|
||||||
|
|
||||||
|
# ************ Style Definition ***************
|
||||||
|
|
||||||
|
fill_black_style = str(inkex.Style({'stroke': 'none', 'fill': '#222222'}))
|
||||||
|
fill_grey_style = str(inkex.Style({'stroke': 'none', 'fill': '#aaaaaa'}))
|
||||||
|
fill_lightgrey_style = str(inkex.Style({'stroke': 'none', 'fill': '#dddddd'}))
|
||||||
|
stroke_black_style = str(inkex.Style({'stroke': '#000000', 'fill': 'none'}))
|
||||||
|
stroke_red_style = str(inkex.Style({'stroke': '#ff0000', 'fill': 'none'}))
|
||||||
|
text_style = "font-family:DejaVu Sans;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-size:10px;"
|
||||||
|
text_attributes = {'x': '12mm', 'y': '10mm', inkex.addNS("space", "xml"): "preserve", 'style': text_style}
|
||||||
|
|
||||||
|
text = "Scalelenght : {}\n".format(self.options.scale)
|
||||||
|
text += "Nut width : {}\n".format(self.options.lnut)
|
||||||
|
text += "12th fret width : {}\n".format(self.options.l12)
|
||||||
|
text += "Number of frets : {}\n".format(self.options.numfret)
|
||||||
|
text += "Extension below last fret : {}\n".format(self.options.fbext)
|
||||||
|
text += "Fret width : {}".format(self.options.fretwidth)
|
||||||
|
|
||||||
|
fretboard = Fretboard(svg.unittouu(str(self.options.scale)))
|
||||||
|
fretboard.width_nut = svg.unittouu(str(self.options.lnut))
|
||||||
|
fretboard.width_12 = svg.unittouu(str(self.options.l12))
|
||||||
|
fretboard.extension = svg.unittouu(str(self.options.fbext))
|
||||||
|
fretboard.nb_frets = self.options.numfret
|
||||||
|
fretboard.fret_width = svg.unittouu(str(self.options.fretwidth))
|
||||||
|
|
||||||
|
fb_body_path = fretboard.svg_contour()
|
||||||
|
nut_line = fretboard.svg_fret_centerline(0)
|
||||||
|
bridge_line = fretboard.svg_h_line(fretboard.fb_width_at(fretboard.scale), fretboard.scale)
|
||||||
|
|
||||||
|
# ************ Apply style to objects ***************
|
||||||
|
|
||||||
|
fb_body_object = {'style': fill_black_style, 'id': fb_id + '-shape', 'd': fb_body_path}
|
||||||
|
nut_line_object = {'style': stroke_black_style, 'id': 'fret-0', 'd': nut_line}
|
||||||
|
bridge_line_object = {'style': stroke_black_style, 'id': 'bridge-line', 'd': bridge_line}
|
||||||
|
|
||||||
|
# ************ Add objects to groups ***************
|
||||||
|
|
||||||
|
etree.SubElement(g, inkex.addNS('path', 'svg'), fb_body_object)
|
||||||
|
etree.SubElement(g, inkex.addNS('path', 'svg'), bridge_line_object)
|
||||||
|
etree.SubElement(g3, inkex.addNS('path', 'svg'), bridge_line_object)
|
||||||
|
etree.SubElement(g3, inkex.addNS('path', 'svg'), nut_line_object)
|
||||||
|
|
||||||
|
t = etree.SubElement(layer2, inkex.addNS('text', 'svg'), text_attributes)
|
||||||
|
|
||||||
|
text = str(text).split("\n")
|
||||||
|
y = 100
|
||||||
|
for s in text:
|
||||||
|
span = etree.SubElement(t, inkex.addNS('tspan', 'svg'),
|
||||||
|
{'x': '12', 'y': str(y),
|
||||||
|
inkex.addNS("role", "sodipodi"): "line", })
|
||||||
|
y += 24
|
||||||
|
span.text = str(s)
|
||||||
|
|
||||||
|
for index in range(1, self.options.numfret + 1):
|
||||||
|
|
||||||
|
linefret_path = fretboard.svg_fret_centerline(index)
|
||||||
|
fretpos_id = svg.get_unique_id('fretpos-' + str(index))
|
||||||
|
linefret_atts = {'style': stroke_black_style, 'id': fretpos_id, 'd': linefret_path}
|
||||||
|
etree.SubElement(g3, inkex.addNS('path', 'svg'), linefret_atts)
|
||||||
|
|
||||||
|
line_path = fretboard.svg_fret_contour(index)
|
||||||
|
curve_path = fretboard.svg_fret_end(index, 1.0)
|
||||||
|
curve_path2 = fretboard.svg_fret_end(index, -1.0)
|
||||||
|
fret_id = svg.get_unique_id('fret-' + str(index))
|
||||||
|
self.fret = g2 = etree.SubElement(self.box, 'g', {'id': fret_id})
|
||||||
|
|
||||||
|
fretbody_id = svg.get_unique_id('fret-' + str(index) + '-body')
|
||||||
|
fretend_id1 = svg.get_unique_id('fret-' + str(index) + '-end1')
|
||||||
|
fretend_id2 = svg.get_unique_id('fret-' + str(index) + '-end2')
|
||||||
|
|
||||||
|
line_atts = {'style': fill_grey_style, 'id': fretbody_id, 'd': line_path}
|
||||||
|
curve_atts = {'style': fill_lightgrey_style, 'id': fretend_id1, 'd': curve_path}
|
||||||
|
curve2_atts = {'style': fill_lightgrey_style, 'id': fretend_id2, 'd': curve_path2}
|
||||||
|
|
||||||
|
etree.SubElement(g2, inkex.addNS('path', 'svg'), line_atts)
|
||||||
|
etree.SubElement(g2, inkex.addNS('path', 'svg'), curve_atts)
|
||||||
|
etree.SubElement(g2, inkex.addNS('path', 'svg'), curve2_atts)
|
||||||
|
|
||||||
|
# ************ Add inlay cross ***************
|
||||||
|
val = index % 12
|
||||||
|
if val in [0, 3, 5, 7, 9]:
|
||||||
|
hline_cross_path, vline_cross_path = fretboard.svg_fret_cross(index)
|
||||||
|
fretpos_id = svg.get_unique_id('marker-cross-' + str(index))
|
||||||
|
hline_atts = {'style': stroke_red_style, 'id': fretpos_id, 'd': hline_cross_path}
|
||||||
|
vline_atts = {'style': stroke_red_style, 'id': fretpos_id, 'd': vline_cross_path}
|
||||||
|
etree.SubElement(g4, inkex.addNS('path', 'svg'), hline_atts)
|
||||||
|
etree.SubElement(g4, inkex.addNS('path', 'svg'), vline_atts)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
GuitarFretboard().run()
|
21
extensions/fablabchemnitz/guitar_fretboard/meta.json
Normal file
21
extensions/fablabchemnitz/guitar_fretboard/meta.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "Guitar Fretboard",
|
||||||
|
"id": "fablabchemnitz.de.guitar_fretboard",
|
||||||
|
"path": "guitar_fretboard",
|
||||||
|
"dependent_extensions": null,
|
||||||
|
"original_name": "Guitar Fretboard",
|
||||||
|
"original_id": "org.inkscape.render.Guitar-Fretboard",
|
||||||
|
"license": "MIT License",
|
||||||
|
"license_url": "https://github.com/tomate44/GuitarFretboard/blob/main/LICENSE",
|
||||||
|
"comment": "",
|
||||||
|
"source_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.X/src/branch/master/extensions/fablabchemnitz/guitar_fretboard",
|
||||||
|
"fork_url": "https://github.com/tomate44/GuitarFretboard",
|
||||||
|
"documentation_url": "https://stadtfabrikanten.org/display/IFM/Guitar+Fretboard",
|
||||||
|
"inkscape_gallery_url": null,
|
||||||
|
"main_authors": [
|
||||||
|
"github.com/tomate44",
|
||||||
|
"github.com/vmario89"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
@ -0,0 +1,19 @@
|
|||||||
|
#Name:Cube
|
||||||
|
#Type:Face-specified
|
||||||
|
#Direction:Clockwise
|
||||||
|
|
||||||
|
v -0.5 -0.5 -0.5
|
||||||
|
v -0.5 -0.5 0.5
|
||||||
|
v -0.5 0.5 -0.5
|
||||||
|
v -0.5 0.5 0.5
|
||||||
|
v 0.5 -0.5 -0.5
|
||||||
|
v 0.5 -0.5 0.5
|
||||||
|
v 0.5 0.5 -0.5
|
||||||
|
v 0.5 0.5 0.5
|
||||||
|
|
||||||
|
f 8 4 2 6
|
||||||
|
f 8 6 5 7
|
||||||
|
f 8 7 3 4
|
||||||
|
f 4 3 1 2
|
||||||
|
f 1 3 7 5
|
||||||
|
f 2 1 5 6
|
@ -0,0 +1,30 @@
|
|||||||
|
#Name:Cuboctahedron
|
||||||
|
#Type:Face_specified
|
||||||
|
|
||||||
|
v -1. 0 0
|
||||||
|
v -0.5 -0.5 -0.70710678
|
||||||
|
v -0.5 -0.5 0.70710678
|
||||||
|
v -0.5 0.5 -0.70710678
|
||||||
|
v -0.5 0.5 0.70710678
|
||||||
|
v 0 -1. 0
|
||||||
|
v 0 1. 0
|
||||||
|
v 0.5 -0.5 -0.70710678
|
||||||
|
v 0.5 -0.5 0.70710678
|
||||||
|
v 0.5 0.5 -0.70710678
|
||||||
|
v 0.5 0.5 0.70710678
|
||||||
|
v 1. 0 0
|
||||||
|
|
||||||
|
f 12 11 9
|
||||||
|
f 3 5 1
|
||||||
|
f 6 9 3
|
||||||
|
f 5 11 7
|
||||||
|
f 8 10 12
|
||||||
|
f 1 4 2
|
||||||
|
f 2 8 6
|
||||||
|
f 7 10 4
|
||||||
|
f 4 10 8 2
|
||||||
|
f 3 9 11 5
|
||||||
|
f 9 6 8 12
|
||||||
|
f 3 1 2 6
|
||||||
|
f 5 7 4 1
|
||||||
|
f 11 12 10 7
|
@ -0,0 +1,36 @@
|
|||||||
|
#NameDodecahedron
|
||||||
|
#Type:Face_specified
|
||||||
|
|
||||||
|
v 0 0 1.4012585
|
||||||
|
v 0 0 -1.4012585
|
||||||
|
v 0.17841104 -1.3090170 0.46708618
|
||||||
|
v 0.17841104 1.3090170 0.46708618
|
||||||
|
v 0.46708618 -0.80901699 -1.0444364
|
||||||
|
v 0.46708618 0.80901699 -1.0444364
|
||||||
|
v 1.0444364 -0.80901699 0.46708618
|
||||||
|
v 1.0444364 0.80901699 0.46708618
|
||||||
|
v -1.2228475 -0.5 0.46708618
|
||||||
|
v -1.2228475 0.5 0.46708618
|
||||||
|
v 1.2228475 -0.5 -0.46708618
|
||||||
|
v 1.2228475 0.5 -0.46708618
|
||||||
|
v -0.93417236 0 -1.0444364
|
||||||
|
v -0.46708618 -0.80901699 1.0444364
|
||||||
|
v -0.46708618 0.80901699 1.0444364
|
||||||
|
v 0.93417236 0 1.0444364
|
||||||
|
v -1.0444364 -0.80901699 -0.46708618
|
||||||
|
v -1.0444364 0.80901699 -0.46708618
|
||||||
|
v -0.17841104 -1.3090170 -0.46708618
|
||||||
|
v -0.17841104 1.3090170 -0.46708618
|
||||||
|
|
||||||
|
f 15 10 9 14 1
|
||||||
|
f 2 6 12 11 5
|
||||||
|
f 5 11 7 3 19
|
||||||
|
f 11 12 8 16 7
|
||||||
|
f 12 6 20 4 8
|
||||||
|
f 6 2 13 18 20
|
||||||
|
f 2 5 19 17 13
|
||||||
|
f 4 20 18 10 15
|
||||||
|
f 18 13 17 9 10
|
||||||
|
f 17 19 3 14 9
|
||||||
|
f 3 7 16 1 14
|
||||||
|
f 16 8 4 15 1
|
@ -0,0 +1,96 @@
|
|||||||
|
#Name:Great Dodecahedron
|
||||||
|
#Type:Face_specified
|
||||||
|
|
||||||
|
v 0. 0. -0.951057
|
||||||
|
v 0. 0. 0.951057
|
||||||
|
v -0.425325 -0.309017 -0.100406
|
||||||
|
v -0.425325 0.309017 -0.100406
|
||||||
|
v 0.425325 -0.309017 0.100406
|
||||||
|
v 0.425325 0.309017 0.100406
|
||||||
|
v -0.688191 -0.5 0.425325
|
||||||
|
v -0.688191 0.5 0.425325
|
||||||
|
v 0.688191 -0.5 -0.425325
|
||||||
|
v 0.688191 0.5 -0.425325
|
||||||
|
v -0.850651 0. -0.425325
|
||||||
|
v 0.850651 0. 0.425325
|
||||||
|
v -0.100406 -0.309017 0.425325
|
||||||
|
v -0.100406 0.309017 0.425325
|
||||||
|
v 0.100406 -0.309017 -0.425325
|
||||||
|
v 0.100406 0.309017 -0.425325
|
||||||
|
v -0.32492 0. 0.425325
|
||||||
|
v -0.16246 -0.5 0.100406
|
||||||
|
v -0.16246 0.5 0.100406
|
||||||
|
v 0.16246 -0.5 -0.100406
|
||||||
|
v 0.16246 0.5 -0.100406
|
||||||
|
v 0.32492 0. -0.425325
|
||||||
|
v -0.525731 0. 0.100406
|
||||||
|
v -0.262866 -0.809017 -0.425325
|
||||||
|
v -0.262866 0.190983 -0.425325
|
||||||
|
v -0.262866 -0.190983 -0.425325
|
||||||
|
v -0.262866 0.809017 -0.425325
|
||||||
|
v 0.262866 -0.809017 0.425325
|
||||||
|
v 0.262866 0.190983 0.425325
|
||||||
|
v 0.262866 -0.190983 0.425325
|
||||||
|
v 0.262866 0.809017 0.425325
|
||||||
|
v 0.525731 0. -0.100406
|
||||||
|
|
||||||
|
f 14 2 31
|
||||||
|
f 14 31 8
|
||||||
|
f 14 8 2
|
||||||
|
f 17 2 8
|
||||||
|
f 17 8 7
|
||||||
|
f 17 7 2
|
||||||
|
f 13 2 7
|
||||||
|
f 13 7 28
|
||||||
|
f 13 28 2
|
||||||
|
f 30 2 28
|
||||||
|
f 30 28 12
|
||||||
|
f 30 12 2
|
||||||
|
f 29 2 12
|
||||||
|
f 29 12 31
|
||||||
|
f 29 31 2
|
||||||
|
f 15 9 24
|
||||||
|
f 15 24 1
|
||||||
|
f 15 1 9
|
||||||
|
f 22 10 9
|
||||||
|
f 22 9 1
|
||||||
|
f 22 1 10
|
||||||
|
f 16 27 10
|
||||||
|
f 16 10 1
|
||||||
|
f 16 1 27
|
||||||
|
f 25 11 27
|
||||||
|
f 25 27 1
|
||||||
|
f 25 1 11
|
||||||
|
f 26 24 11
|
||||||
|
f 26 11 1
|
||||||
|
f 26 1 24
|
||||||
|
f 19 31 27
|
||||||
|
f 19 27 8
|
||||||
|
f 19 8 31
|
||||||
|
f 23 8 11
|
||||||
|
f 23 11 7
|
||||||
|
f 23 7 8
|
||||||
|
f 18 7 24
|
||||||
|
f 18 24 28
|
||||||
|
f 18 28 7
|
||||||
|
f 5 28 9
|
||||||
|
f 5 9 12
|
||||||
|
f 5 12 28
|
||||||
|
f 6 12 10
|
||||||
|
f 6 10 31
|
||||||
|
f 6 31 12
|
||||||
|
f 20 9 28
|
||||||
|
f 20 28 24
|
||||||
|
f 20 24 9
|
||||||
|
f 32 10 12
|
||||||
|
f 32 12 9
|
||||||
|
f 32 9 10
|
||||||
|
f 21 27 31
|
||||||
|
f 21 31 10
|
||||||
|
f 21 10 27
|
||||||
|
f 4 11 8
|
||||||
|
f 4 8 27
|
||||||
|
f 4 27 11
|
||||||
|
f 3 24 7
|
||||||
|
f 3 7 11
|
||||||
|
f 3 11 24
|
@ -0,0 +1,185 @@
|
|||||||
|
#Name:Great Rhombicosidodecahedron
|
||||||
|
#Type:face_specified
|
||||||
|
v -1. -1.30902 -3.42705
|
||||||
|
v -1. -1.30902 3.42705
|
||||||
|
v -1. 1.30902 -3.42705
|
||||||
|
v -1. 1.30902 3.42705
|
||||||
|
v -0.5 -0.5 -3.73607
|
||||||
|
v -0.5 -0.5 3.73607
|
||||||
|
v -0.5 0.5 -3.73607
|
||||||
|
v -0.5 0.5 3.73607
|
||||||
|
v -0.5 -3.73607 -0.5
|
||||||
|
v -0.5 -3.73607 0.5
|
||||||
|
v -0.5 -2.11803 -3.11803
|
||||||
|
v -0.5 -2.11803 3.11803
|
||||||
|
v -0.5 3.73607 -0.5
|
||||||
|
v -0.5 3.73607 0.5
|
||||||
|
v -0.5 2.11803 -3.11803
|
||||||
|
v -0.5 2.11803 3.11803
|
||||||
|
v 0.5 -0.5 -3.73607
|
||||||
|
v 0.5 -0.5 3.73607
|
||||||
|
v 0.5 0.5 -3.73607
|
||||||
|
v 0.5 0.5 3.73607
|
||||||
|
v 0.5 -3.73607 -0.5
|
||||||
|
v 0.5 -3.73607 0.5
|
||||||
|
v 0.5 -2.11803 -3.11803
|
||||||
|
v 0.5 -2.11803 3.11803
|
||||||
|
v 0.5 3.73607 -0.5
|
||||||
|
v 0.5 3.73607 0.5
|
||||||
|
v 0.5 2.11803 -3.11803
|
||||||
|
v 0.5 2.11803 3.11803
|
||||||
|
v 1. -1.30902 -3.42705
|
||||||
|
v 1. -1.30902 3.42705
|
||||||
|
v 1. 1.30902 -3.42705
|
||||||
|
v 1. 1.30902 3.42705
|
||||||
|
v -3.42705 -1. -1.30902
|
||||||
|
v -3.42705 -1. 1.30902
|
||||||
|
v -3.42705 1. -1.30902
|
||||||
|
v -3.42705 1. 1.30902
|
||||||
|
v -2.92705 -1.80902 -1.61803
|
||||||
|
v -2.92705 -1.80902 1.61803
|
||||||
|
v -2.92705 1.80902 -1.61803
|
||||||
|
v -2.92705 1.80902 1.61803
|
||||||
|
v -1.80902 -1.61803 -2.92705
|
||||||
|
v -1.80902 -1.61803 2.92705
|
||||||
|
v -1.80902 1.61803 -2.92705
|
||||||
|
v -1.80902 1.61803 2.92705
|
||||||
|
v -1.30902 -3.42705 -1.
|
||||||
|
v -1.30902 -3.42705 1.
|
||||||
|
v -1.30902 -2.42705 -2.61803
|
||||||
|
v -1.30902 -2.42705 2.61803
|
||||||
|
v -1.30902 2.42705 -2.61803
|
||||||
|
v -1.30902 2.42705 2.61803
|
||||||
|
v -1.30902 3.42705 -1.
|
||||||
|
v -1.30902 3.42705 1.
|
||||||
|
v -2.61803 -1.30902 -2.42705
|
||||||
|
v -2.61803 -1.30902 2.42705
|
||||||
|
v -2.61803 1.30902 -2.42705
|
||||||
|
v -2.61803 1.30902 2.42705
|
||||||
|
v -3.73607 -0.5 -0.5
|
||||||
|
v -3.73607 -0.5 0.5
|
||||||
|
v -3.73607 0.5 -0.5
|
||||||
|
v -3.73607 0.5 0.5
|
||||||
|
v -1.61803 -2.92705 -1.80902
|
||||||
|
v -1.61803 -2.92705 1.80902
|
||||||
|
v -1.61803 2.92705 -1.80902
|
||||||
|
v -1.61803 2.92705 1.80902
|
||||||
|
v -3.11803 -0.5 -2.11803
|
||||||
|
v -3.11803 -0.5 2.11803
|
||||||
|
v -3.11803 0.5 -2.11803
|
||||||
|
v -3.11803 0.5 2.11803
|
||||||
|
v -2.11803 -3.11803 -0.5
|
||||||
|
v -2.11803 -3.11803 0.5
|
||||||
|
v -2.11803 3.11803 -0.5
|
||||||
|
v -2.11803 3.11803 0.5
|
||||||
|
v -2.42705 -2.61803 -1.30902
|
||||||
|
v -2.42705 -2.61803 1.30902
|
||||||
|
v -2.42705 2.61803 -1.30902
|
||||||
|
v -2.42705 2.61803 1.30902
|
||||||
|
v 1.61803 -2.92705 -1.80902
|
||||||
|
v 1.61803 -2.92705 1.80902
|
||||||
|
v 1.61803 2.92705 -1.80902
|
||||||
|
v 1.61803 2.92705 1.80902
|
||||||
|
v 2.42705 -2.61803 -1.30902
|
||||||
|
v 2.42705 -2.61803 1.30902
|
||||||
|
v 2.42705 2.61803 -1.30902
|
||||||
|
v 2.42705 2.61803 1.30902
|
||||||
|
v 3.73607 -0.5 -0.5
|
||||||
|
v 3.73607 -0.5 0.5
|
||||||
|
v 3.73607 0.5 -0.5
|
||||||
|
v 3.73607 0.5 0.5
|
||||||
|
v 2.11803 -3.11803 -0.5
|
||||||
|
v 2.11803 -3.11803 0.5
|
||||||
|
v 2.11803 3.11803 -0.5
|
||||||
|
v 2.11803 3.11803 0.5
|
||||||
|
v 1.30902 -3.42705 -1.
|
||||||
|
v 1.30902 -3.42705 1.
|
||||||
|
v 1.30902 -2.42705 -2.61803
|
||||||
|
v 1.30902 -2.42705 2.61803
|
||||||
|
v 1.30902 2.42705 -2.61803
|
||||||
|
v 1.30902 2.42705 2.61803
|
||||||
|
v 1.30902 3.42705 -1.
|
||||||
|
v 1.30902 3.42705 1.
|
||||||
|
v 2.61803 -1.30902 -2.42705
|
||||||
|
v 2.61803 -1.30902 2.42705
|
||||||
|
v 2.61803 1.30902 -2.42705
|
||||||
|
v 2.61803 1.30902 2.42705
|
||||||
|
v 3.11803 -0.5 -2.11803
|
||||||
|
v 3.11803 -0.5 2.11803
|
||||||
|
v 3.11803 0.5 -2.11803
|
||||||
|
v 3.11803 0.5 2.11803
|
||||||
|
v 1.80902 -1.61803 -2.92705
|
||||||
|
v 1.80902 -1.61803 2.92705
|
||||||
|
v 1.80902 1.61803 -2.92705
|
||||||
|
v 1.80902 1.61803 2.92705
|
||||||
|
v 2.92705 -1.80902 -1.61803
|
||||||
|
v 2.92705 -1.80902 1.61803
|
||||||
|
v 2.92705 1.80902 -1.61803
|
||||||
|
v 2.92705 1.80902 1.61803
|
||||||
|
v 3.42705 -1. -1.30902
|
||||||
|
v 3.42705 -1. 1.30902
|
||||||
|
v 3.42705 1. -1.30902
|
||||||
|
v 3.42705 1. 1.30902
|
||||||
|
|
||||||
|
f 2 6 8 4 44 56 68 66 54 42
|
||||||
|
f 109 29 17 19 31 111 103 107 105 101
|
||||||
|
f 24 30 18 6 2 12
|
||||||
|
f 7 3 15 27 31 19
|
||||||
|
f 58 57 33 37 73 69 70 74 38 34
|
||||||
|
f 84 116 120 88 87 119 115 83 91 92
|
||||||
|
f 90 89 81 113 117 85 86 118 114 82
|
||||||
|
f 36 40 76 72 71 75 39 35 59 60
|
||||||
|
f 5 17 29 23 11 1
|
||||||
|
f 4 8 20 32 28 16
|
||||||
|
f 67 55 43 3 7 5 1 41 53 65
|
||||||
|
f 18 30 110 102 106 108 104 112 32 20
|
||||||
|
f 79 83 115 103 111 97
|
||||||
|
f 38 74 62 48 42 54
|
||||||
|
f 4 16 50 44
|
||||||
|
f 23 29 109 95
|
||||||
|
f 96 110 30 24
|
||||||
|
f 43 49 15 3
|
||||||
|
f 53 41 47 61 73 37
|
||||||
|
f 98 112 104 116 84 80
|
||||||
|
f 69 45 9 10 46 70
|
||||||
|
f 26 100 92 91 99 25
|
||||||
|
f 82 114 102 110 96 78
|
||||||
|
f 55 39 75 63 49 43
|
||||||
|
f 1 11 47 41
|
||||||
|
f 28 32 112 98
|
||||||
|
f 61 47 11 23 95 77 93 21 9 45
|
||||||
|
f 50 16 28 98 80 100 26 14 52 64
|
||||||
|
f 97 111 31 27
|
||||||
|
f 42 48 12 2
|
||||||
|
f 44 50 64 76 40 56
|
||||||
|
f 77 95 109 101 113 81
|
||||||
|
f 63 51 13 25 99 79 97 27 15 49
|
||||||
|
f 46 10 22 94 78 96 24 12 48 62
|
||||||
|
f 52 14 13 51 71 72
|
||||||
|
f 22 21 93 89 90 94
|
||||||
|
f 115 119 107 103
|
||||||
|
f 34 38 54 66
|
||||||
|
f 71 51 63 75
|
||||||
|
f 94 90 82 78
|
||||||
|
f 114 118 106 102
|
||||||
|
f 35 39 55 67
|
||||||
|
f 70 46 62 74
|
||||||
|
f 99 91 83 79
|
||||||
|
f 65 53 37 33
|
||||||
|
f 104 108 120 116
|
||||||
|
f 77 81 89 93
|
||||||
|
f 76 64 52 72
|
||||||
|
f 59 35 67 65 33 57
|
||||||
|
f 106 118 86 88 120 108
|
||||||
|
f 68 56 40 36
|
||||||
|
f 101 105 117 113
|
||||||
|
f 80 84 92 100
|
||||||
|
f 73 61 45 69
|
||||||
|
f 34 66 68 36 60 58
|
||||||
|
f 105 107 119 87 85 117
|
||||||
|
f 7 19 17 5
|
||||||
|
f 6 18 20 8
|
||||||
|
f 14 26 25 13
|
||||||
|
f 9 21 22 10
|
||||||
|
f 58 60 59 57
|
||||||
|
f 85 87 88 86
|
@ -0,0 +1,77 @@
|
|||||||
|
#Name:Great Rhombicuboctahedron
|
||||||
|
#Type:face_specified
|
||||||
|
v -0.5 1.20711 -1.91421
|
||||||
|
v -0.5 1.20711 1.91421
|
||||||
|
v -0.5 -1.20711 -1.91421
|
||||||
|
v -0.5 -1.20711 1.91421
|
||||||
|
v -0.5 -1.91421 1.20711
|
||||||
|
v -0.5 -1.91421 -1.20711
|
||||||
|
v -0.5 1.91421 1.20711
|
||||||
|
v -0.5 1.91421 -1.20711
|
||||||
|
v 0.5 1.20711 -1.91421
|
||||||
|
v 0.5 1.20711 1.91421
|
||||||
|
v 0.5 -1.20711 -1.91421
|
||||||
|
v 0.5 -1.20711 1.91421
|
||||||
|
v 0.5 -1.91421 1.20711
|
||||||
|
v 0.5 -1.91421 -1.20711
|
||||||
|
v 0.5 1.91421 1.20711
|
||||||
|
v 0.5 1.91421 -1.20711
|
||||||
|
v 1.20711 -0.5 -1.91421
|
||||||
|
v 1.20711 -0.5 1.91421
|
||||||
|
v 1.20711 0.5 -1.91421
|
||||||
|
v 1.20711 0.5 1.91421
|
||||||
|
v 1.20711 -1.91421 -0.5
|
||||||
|
v 1.20711 -1.91421 0.5
|
||||||
|
v 1.20711 1.91421 -0.5
|
||||||
|
v 1.20711 1.91421 0.5
|
||||||
|
v -1.20711 -0.5 -1.91421
|
||||||
|
v -1.20711 -0.5 1.91421
|
||||||
|
v -1.20711 0.5 -1.91421
|
||||||
|
v -1.20711 0.5 1.91421
|
||||||
|
v -1.20711 -1.91421 -0.5
|
||||||
|
v -1.20711 -1.91421 0.5
|
||||||
|
v -1.20711 1.91421 -0.5
|
||||||
|
v -1.20711 1.91421 0.5
|
||||||
|
v -1.91421 -0.5 1.20711
|
||||||
|
v -1.91421 -0.5 -1.20711
|
||||||
|
v -1.91421 0.5 1.20711
|
||||||
|
v -1.91421 0.5 -1.20711
|
||||||
|
v -1.91421 1.20711 -0.5
|
||||||
|
v -1.91421 1.20711 0.5
|
||||||
|
v -1.91421 -1.20711 -0.5
|
||||||
|
v -1.91421 -1.20711 0.5
|
||||||
|
v 1.91421 -0.5 1.20711
|
||||||
|
v 1.91421 -0.5 -1.20711
|
||||||
|
v 1.91421 0.5 1.20711
|
||||||
|
v 1.91421 0.5 -1.20711
|
||||||
|
v 1.91421 1.20711 -0.5
|
||||||
|
v 1.91421 1.20711 0.5
|
||||||
|
v 1.91421 -1.20711 -0.5
|
||||||
|
v 1.91421 -1.20711 0.5
|
||||||
|
|
||||||
|
f 44 42 17 19
|
||||||
|
f 14 6 3 11
|
||||||
|
f 34 36 27 25
|
||||||
|
f 8 16 9 1
|
||||||
|
f 20 18 41 43
|
||||||
|
f 12 4 5 13
|
||||||
|
f 26 28 35 33
|
||||||
|
f 2 10 15 7
|
||||||
|
f 45 23 24 46
|
||||||
|
f 39 29 30 40
|
||||||
|
f 48 22 21 47
|
||||||
|
f 38 32 31 37
|
||||||
|
f 9 19 17 11 3 25 27 1
|
||||||
|
f 2 28 26 4 12 18 20 10
|
||||||
|
f 41 48 47 42 44 45 46 43
|
||||||
|
f 35 38 37 36 34 39 40 33
|
||||||
|
f 15 24 23 16 8 31 32 7
|
||||||
|
f 5 30 29 6 14 21 22 13
|
||||||
|
f 46 24 15 10 20 43
|
||||||
|
f 35 28 2 7 32 38
|
||||||
|
f 41 18 12 13 22 48
|
||||||
|
f 40 30 5 4 26 33
|
||||||
|
f 44 19 9 16 23 45
|
||||||
|
f 37 31 8 1 27 36
|
||||||
|
f 47 21 14 11 17 42
|
||||||
|
f 34 25 3 6 29 39
|
@ -0,0 +1,96 @@
|
|||||||
|
#Name:Great Stellated Dodecahedron
|
||||||
|
#Type:face_specified
|
||||||
|
|
||||||
|
v 0. 0. -0.951057
|
||||||
|
v 0. 0. 0.951057
|
||||||
|
v -0.425325 -1.30902 1.80171
|
||||||
|
v -0.425325 1.30902 1.80171
|
||||||
|
v 0.425325 -1.30902 -1.80171
|
||||||
|
v 0.425325 1.30902 -1.80171
|
||||||
|
v -0.688191 -0.5 0.425325
|
||||||
|
v -0.688191 0.5 0.425325
|
||||||
|
v -0.688191 -2.11803 0.425325
|
||||||
|
v -0.688191 2.11803 0.425325
|
||||||
|
v 0.688191 -0.5 -0.425325
|
||||||
|
v 0.688191 0.5 -0.425325
|
||||||
|
v 0.688191 -2.11803 -0.425325
|
||||||
|
v 0.688191 2.11803 -0.425325
|
||||||
|
v -0.850651 0. -0.425325
|
||||||
|
v 0.850651 0. 0.425325
|
||||||
|
v -1.11352 -0.809017 -1.80171
|
||||||
|
v -1.11352 0.809017 -1.80171
|
||||||
|
v 1.11352 -0.809017 1.80171
|
||||||
|
v 1.11352 0.809017 1.80171
|
||||||
|
v -1.80171 -1.30902 -0.425325
|
||||||
|
v -1.80171 1.30902 -0.425325
|
||||||
|
v 1.80171 -1.30902 0.425325
|
||||||
|
v 1.80171 1.30902 0.425325
|
||||||
|
v -2.22703 0. 0.425325
|
||||||
|
v 2.22703 0. -0.425325
|
||||||
|
v -0.262866 -0.809017 -0.425325
|
||||||
|
v -0.262866 0.809017 -0.425325
|
||||||
|
v 0.262866 -0.809017 0.425325
|
||||||
|
v 0.262866 0.809017 0.425325
|
||||||
|
v -1.37638 0. 1.80171
|
||||||
|
v 1.37638 0. -1.80171
|
||||||
|
|
||||||
|
f 4 2 30
|
||||||
|
f 4 30 8
|
||||||
|
f 4 8 2
|
||||||
|
f 31 2 8
|
||||||
|
f 31 8 7
|
||||||
|
f 31 7 2
|
||||||
|
f 3 2 7
|
||||||
|
f 3 7 29
|
||||||
|
f 3 29 2
|
||||||
|
f 19 2 29
|
||||||
|
f 19 29 16
|
||||||
|
f 19 16 2
|
||||||
|
f 20 2 16
|
||||||
|
f 20 16 30
|
||||||
|
f 20 30 2
|
||||||
|
f 5 11 27
|
||||||
|
f 5 27 1
|
||||||
|
f 5 1 11
|
||||||
|
f 32 12 11
|
||||||
|
f 32 11 1
|
||||||
|
f 32 1 12
|
||||||
|
f 6 28 12
|
||||||
|
f 6 12 1
|
||||||
|
f 6 1 28
|
||||||
|
f 18 15 28
|
||||||
|
f 18 28 1
|
||||||
|
f 18 1 15
|
||||||
|
f 17 27 15
|
||||||
|
f 17 15 1
|
||||||
|
f 17 1 27
|
||||||
|
f 10 30 28
|
||||||
|
f 10 28 8
|
||||||
|
f 10 8 30
|
||||||
|
f 25 8 15
|
||||||
|
f 25 15 7
|
||||||
|
f 25 7 8
|
||||||
|
f 9 7 27
|
||||||
|
f 9 27 29
|
||||||
|
f 9 29 7
|
||||||
|
f 23 29 11
|
||||||
|
f 23 11 16
|
||||||
|
f 23 16 29
|
||||||
|
f 24 16 12
|
||||||
|
f 24 12 30
|
||||||
|
f 24 30 16
|
||||||
|
f 13 11 29
|
||||||
|
f 13 29 27
|
||||||
|
f 13 27 11
|
||||||
|
f 26 12 16
|
||||||
|
f 26 16 11
|
||||||
|
f 26 11 12
|
||||||
|
f 14 28 30
|
||||||
|
f 14 30 12
|
||||||
|
f 14 12 28
|
||||||
|
f 22 15 8
|
||||||
|
f 22 8 28
|
||||||
|
f 22 28 15
|
||||||
|
f 21 27 7
|
||||||
|
f 21 7 15
|
||||||
|
f 21 15 27
|
@ -0,0 +1,36 @@
|
|||||||
|
#Name:Icosahedron
|
||||||
|
#Type:face_specified
|
||||||
|
|
||||||
|
v 0 0 -0.95105652
|
||||||
|
v 0 0 0.95105652
|
||||||
|
v -0.85065081 0 -0.42532540
|
||||||
|
v 0.85065081 0 0.42532540
|
||||||
|
v 0.68819096 -0.50000000 -0.42532540
|
||||||
|
v 0.68819096 0.50000000 -0.42532540
|
||||||
|
v -0.68819096 -0.50000000 0.42532540
|
||||||
|
v -0.68819096 0.50000000 0.42532540
|
||||||
|
v -0.26286556 -0.80901699 -0.42532540
|
||||||
|
v -0.26286556 0.80901699 -0.42532540
|
||||||
|
v 0.26286556 -0.80901699 0.42532540
|
||||||
|
v 0.26286556 0.80901699 0.42532540
|
||||||
|
|
||||||
|
f 2 12 8
|
||||||
|
f 2 8 7
|
||||||
|
f 2 7 11
|
||||||
|
f 2 11 4
|
||||||
|
f 2 4 12
|
||||||
|
f 5 9 1
|
||||||
|
f 6 5 1
|
||||||
|
f 10 6 1
|
||||||
|
f 3 10 1
|
||||||
|
f 9 3 1
|
||||||
|
f 12 10 8
|
||||||
|
f 8 3 7
|
||||||
|
f 7 9 11
|
||||||
|
f 11 5 4
|
||||||
|
f 4 6 12
|
||||||
|
f 5 11 9
|
||||||
|
f 6 4 5
|
||||||
|
f 10 12 6
|
||||||
|
f 3 8 10
|
||||||
|
f 9 7 3
|
@ -0,0 +1,65 @@
|
|||||||
|
#Name:Icosidodecahedron
|
||||||
|
#Type:face_specified
|
||||||
|
v 0. -1.61803 0.
|
||||||
|
v 0. 1.61803 0.
|
||||||
|
v 0.262866 -0.809017 -1.37638
|
||||||
|
v 0.262866 0.809017 -1.37638
|
||||||
|
v 0.425325 -1.30902 0.850651
|
||||||
|
v 0.425325 1.30902 0.850651
|
||||||
|
v 0.688191 -0.5 1.37638
|
||||||
|
v 0.688191 0.5 1.37638
|
||||||
|
v 1.11352 -0.809017 -0.850651
|
||||||
|
v 1.11352 0.809017 -0.850651
|
||||||
|
v -1.37638 0. -0.850651
|
||||||
|
v -0.688191 -0.5 -1.37638
|
||||||
|
v -0.688191 0.5 -1.37638
|
||||||
|
v 1.37638 0. 0.850651
|
||||||
|
v 0.951057 -1.30902 0.
|
||||||
|
v 0.951057 1.30902 0.
|
||||||
|
v 0.850651 0. -1.37638
|
||||||
|
v -0.951057 -1.30902 0.
|
||||||
|
v -0.951057 1.30902 0.
|
||||||
|
v -1.53884 -0.5 0.
|
||||||
|
v -1.53884 0.5 0.
|
||||||
|
v 1.53884 -0.5 0.
|
||||||
|
v 1.53884 0.5 0.
|
||||||
|
v -0.850651 0. 1.37638
|
||||||
|
v -1.11352 -0.809017 0.850651
|
||||||
|
v -1.11352 0.809017 0.850651
|
||||||
|
v -0.425325 -1.30902 -0.850651
|
||||||
|
v -0.425325 1.30902 -0.850651
|
||||||
|
v -0.262866 -0.809017 1.37638
|
||||||
|
v -0.262866 0.809017 1.37638
|
||||||
|
|
||||||
|
f 30 24 29 7 8
|
||||||
|
f 26 24 30
|
||||||
|
f 25 29 24
|
||||||
|
f 5 7 29
|
||||||
|
f 14 8 7
|
||||||
|
f 6 30 8
|
||||||
|
f 16 2 6
|
||||||
|
f 19 21 26
|
||||||
|
f 20 18 25
|
||||||
|
f 1 15 5
|
||||||
|
f 22 23 14
|
||||||
|
f 2 19 26 30 6
|
||||||
|
f 21 20 25 24 26
|
||||||
|
f 18 1 5 29 25
|
||||||
|
f 15 22 14 7 5
|
||||||
|
f 23 16 6 8 14
|
||||||
|
f 12 13 4 17 3
|
||||||
|
f 3 17 9
|
||||||
|
f 17 4 10
|
||||||
|
f 4 13 28
|
||||||
|
f 13 12 11
|
||||||
|
f 12 3 27
|
||||||
|
f 27 1 18
|
||||||
|
f 9 22 15
|
||||||
|
f 10 16 23
|
||||||
|
f 28 19 2
|
||||||
|
f 11 20 21
|
||||||
|
f 27 3 9 15 1
|
||||||
|
f 9 17 10 23 22
|
||||||
|
f 10 4 28 2 16
|
||||||
|
f 28 13 11 21 19
|
||||||
|
f 11 12 27 18 20
|
@ -0,0 +1,35 @@
|
|||||||
|
#Name:Jessen's Orthogonal Icosahedron
|
||||||
|
#Type:face_specified
|
||||||
|
v 0. -0.809017 0.5
|
||||||
|
v 0. -0.809017 -0.5
|
||||||
|
v 0. 0.809017 0.5
|
||||||
|
v 0. 0.809017 -0.5
|
||||||
|
v 0.5 0. -0.809017
|
||||||
|
v 0.5 0. 0.809017
|
||||||
|
v -0.5 0. -0.809017
|
||||||
|
v -0.5 0. 0.809017
|
||||||
|
v -0.809017 0.5 0.
|
||||||
|
v -0.809017 -0.5 0.
|
||||||
|
v 0.809017 0.5 0.
|
||||||
|
v 0.809017 -0.5 0.
|
||||||
|
|
||||||
|
f 3 1 6
|
||||||
|
f 6 1 12
|
||||||
|
f 6 12 5
|
||||||
|
f 11 3 6
|
||||||
|
f 6 5 11
|
||||||
|
f 12 1 10
|
||||||
|
f 12 10 2
|
||||||
|
f 5 12 2
|
||||||
|
f 3 11 9
|
||||||
|
f 1 3 8
|
||||||
|
f 8 10 1
|
||||||
|
f 7 2 10
|
||||||
|
f 10 8 7
|
||||||
|
f 3 9 8
|
||||||
|
f 7 8 9
|
||||||
|
f 5 2 4
|
||||||
|
f 2 7 4
|
||||||
|
f 7 9 4
|
||||||
|
f 4 9 11
|
||||||
|
f 5 4 11
|
@ -0,0 +1,13 @@
|
|||||||
|
#Name:Methane Molecule
|
||||||
|
#Type:edge_specified
|
||||||
|
|
||||||
|
v 0 0 0
|
||||||
|
v 0 0 0.61237244
|
||||||
|
v -0.28867513 -0.50000000 -0.20412415
|
||||||
|
v -0.28867513 0.50000000 -0.20412415
|
||||||
|
v 0.57735027 0 -0.20412415
|
||||||
|
|
||||||
|
l 1 2
|
||||||
|
l 1 3
|
||||||
|
l 1 4
|
||||||
|
l 1 5
|
@ -0,0 +1,17 @@
|
|||||||
|
#Name:Octahedron
|
||||||
|
#Type:face_specified
|
||||||
|
v -0.5 -0.5 0
|
||||||
|
v -0.5 0.5 0
|
||||||
|
v 0 0 -0.70710678
|
||||||
|
v 0 0 0.70710678
|
||||||
|
v 0.5 -0.5 0
|
||||||
|
v 0.5 0.5 0
|
||||||
|
|
||||||
|
f 4 5 6
|
||||||
|
f 4 6 2
|
||||||
|
f 4 2 1
|
||||||
|
f 4 1 5
|
||||||
|
f 5 1 3
|
||||||
|
f 5 3 6
|
||||||
|
f 3 1 2
|
||||||
|
f 6 3 2
|
@ -0,0 +1,12 @@
|
|||||||
|
#Name:Right Handed Coordinate Axes
|
||||||
|
#Type:Edge_specified
|
||||||
|
|
||||||
|
v 0 0 0
|
||||||
|
v 1 0 0
|
||||||
|
v 0 1 0
|
||||||
|
v 0 0 1
|
||||||
|
|
||||||
|
l 1 2
|
||||||
|
l 1 3
|
||||||
|
l 1 4
|
||||||
|
|
@ -0,0 +1,29 @@
|
|||||||
|
#Name:Rhombic Dodecahedron
|
||||||
|
#Type:face_specified
|
||||||
|
v -0.816497 -0.816497 0.
|
||||||
|
v -0.816497 0. -0.57735
|
||||||
|
v -0.816497 0. 0.57735
|
||||||
|
v -0.816497 0.816497 0.
|
||||||
|
v 0. -0.816497 -0.57735
|
||||||
|
v 0. -0.816497 0.57735
|
||||||
|
v 0. 0. -1.1547
|
||||||
|
v 0. 0. 1.1547
|
||||||
|
v 0. 0.816497 -0.57735
|
||||||
|
v 0. 0.816497 0.57735
|
||||||
|
v 0.816497 -0.816497 0.
|
||||||
|
v 0.816497 0. -0.57735
|
||||||
|
v 0.816497 0. 0.57735
|
||||||
|
v 0.816497 0.816497 0.
|
||||||
|
|
||||||
|
f 2 1 3 4
|
||||||
|
f 1 2 7 5
|
||||||
|
f 6 8 3 1
|
||||||
|
f 2 4 9 7
|
||||||
|
f 8 10 4 3
|
||||||
|
f 11 6 1 5
|
||||||
|
f 9 4 10 14
|
||||||
|
f 5 7 12 11
|
||||||
|
f 11 13 8 6
|
||||||
|
f 7 9 14 12
|
||||||
|
f 13 14 10 8
|
||||||
|
f 14 13 11 12
|
@ -0,0 +1,65 @@
|
|||||||
|
#Name:Rhombic Triacontahedron
|
||||||
|
#Type:face_specified
|
||||||
|
v 0. 0. -1.61803
|
||||||
|
v 0. 0. 1.61803
|
||||||
|
v 0.276393 -0.850651 1.17082
|
||||||
|
v 0.276393 0.850651 1.17082
|
||||||
|
v 0.894427 0. 1.17082
|
||||||
|
v 1.17082 -0.850651 0.723607
|
||||||
|
v 1.17082 -0.850651 -0.276393
|
||||||
|
v 1.17082 0.850651 0.723607
|
||||||
|
v 1.17082 0.850651 -0.276393
|
||||||
|
v -0.894427 0. -1.17082
|
||||||
|
v -0.447214 -1.37638 0.723607
|
||||||
|
v -0.447214 -1.37638 -0.276393
|
||||||
|
v -0.447214 1.37638 0.723607
|
||||||
|
v -0.447214 1.37638 -0.276393
|
||||||
|
v 0.447214 -1.37638 0.276393
|
||||||
|
v 0.447214 -1.37638 -0.723607
|
||||||
|
v 0.447214 1.37638 0.276393
|
||||||
|
v 0.447214 1.37638 -0.723607
|
||||||
|
v -1.44721 0. 0.723607
|
||||||
|
v -1.44721 0. -0.276393
|
||||||
|
v -0.723607 -0.525731 1.17082
|
||||||
|
v -0.723607 0.525731 1.17082
|
||||||
|
v 0.723607 -0.525731 -1.17082
|
||||||
|
v 0.723607 0.525731 -1.17082
|
||||||
|
v 1.44721 0. 0.276393
|
||||||
|
v 1.44721 0. -0.723607
|
||||||
|
v -1.17082 -0.850651 0.276393
|
||||||
|
v -1.17082 -0.850651 -0.723607
|
||||||
|
v -1.17082 0.850651 0.276393
|
||||||
|
v -1.17082 0.850651 -0.723607
|
||||||
|
v -0.276393 -0.850651 -1.17082
|
||||||
|
v -0.276393 0.850651 -1.17082
|
||||||
|
|
||||||
|
f 16 15 11 12
|
||||||
|
f 14 13 17 18
|
||||||
|
f 10 28 20 30
|
||||||
|
f 8 5 6 25
|
||||||
|
f 12 28 31 16
|
||||||
|
f 32 30 14 18
|
||||||
|
f 6 3 11 15
|
||||||
|
f 8 17 13 4
|
||||||
|
f 11 21 19 27
|
||||||
|
f 13 29 19 22
|
||||||
|
f 7 16 23 26
|
||||||
|
f 24 18 9 26
|
||||||
|
f 12 11 27 28
|
||||||
|
f 30 29 13 14
|
||||||
|
f 7 6 15 16
|
||||||
|
f 18 17 8 9
|
||||||
|
f 2 22 19 21
|
||||||
|
f 23 1 24 26
|
||||||
|
f 3 2 21 11
|
||||||
|
f 4 13 22 2
|
||||||
|
f 16 31 1 23
|
||||||
|
f 1 32 18 24
|
||||||
|
f 31 28 10 1
|
||||||
|
f 10 30 32 1
|
||||||
|
f 6 5 2 3
|
||||||
|
f 8 4 2 5
|
||||||
|
f 28 27 19 20
|
||||||
|
f 20 19 29 30
|
||||||
|
f 26 25 6 7
|
||||||
|
f 9 8 25 26
|
@ -0,0 +1,127 @@
|
|||||||
|
#Name:Small Rhombicosidodecahedron
|
||||||
|
#Type:face_specified
|
||||||
|
|
||||||
|
v -0.5 -0.5 -2.11803
|
||||||
|
v -0.5 -0.5 2.11803
|
||||||
|
v -0.5 0.5 -2.11803
|
||||||
|
v -0.5 0.5 2.11803
|
||||||
|
v -0.5 -2.11803 -0.5
|
||||||
|
v -0.5 -2.11803 0.5
|
||||||
|
v -0.5 2.11803 -0.5
|
||||||
|
v -0.5 2.11803 0.5
|
||||||
|
v 0. -1.30902 -1.80902
|
||||||
|
v 0. -1.30902 1.80902
|
||||||
|
v 0. 1.30902 -1.80902
|
||||||
|
v 0. 1.30902 1.80902
|
||||||
|
v 0.5 -0.5 -2.11803
|
||||||
|
v 0.5 -0.5 2.11803
|
||||||
|
v 0.5 0.5 -2.11803
|
||||||
|
v 0.5 0.5 2.11803
|
||||||
|
v 0.5 -2.11803 -0.5
|
||||||
|
v 0.5 -2.11803 0.5
|
||||||
|
v 0.5 2.11803 -0.5
|
||||||
|
v 0.5 2.11803 0.5
|
||||||
|
v -1.80902 0. -1.30902
|
||||||
|
v -1.80902 0. 1.30902
|
||||||
|
v -0.809017 -1.61803 -1.30902
|
||||||
|
v -0.809017 -1.61803 1.30902
|
||||||
|
v -0.809017 1.61803 -1.30902
|
||||||
|
v -0.809017 1.61803 1.30902
|
||||||
|
v -1.61803 -1.30902 -0.809017
|
||||||
|
v -1.61803 -1.30902 0.809017
|
||||||
|
v -1.61803 1.30902 -0.809017
|
||||||
|
v -1.61803 1.30902 0.809017
|
||||||
|
v -2.11803 -0.5 -0.5
|
||||||
|
v -2.11803 -0.5 0.5
|
||||||
|
v -2.11803 0.5 -0.5
|
||||||
|
v -2.11803 0.5 0.5
|
||||||
|
v -1.30902 -1.80902 0.
|
||||||
|
v -1.30902 -0.809017 -1.61803
|
||||||
|
v -1.30902 -0.809017 1.61803
|
||||||
|
v -1.30902 0.809017 -1.61803
|
||||||
|
v -1.30902 0.809017 1.61803
|
||||||
|
v -1.30902 1.80902 0.
|
||||||
|
v 0.809017 -1.61803 -1.30902
|
||||||
|
v 0.809017 -1.61803 1.30902
|
||||||
|
v 0.809017 1.61803 -1.30902
|
||||||
|
v 0.809017 1.61803 1.30902
|
||||||
|
v 1.61803 -1.30902 -0.809017
|
||||||
|
v 1.61803 -1.30902 0.809017
|
||||||
|
v 1.61803 1.30902 -0.809017
|
||||||
|
v 1.61803 1.30902 0.809017
|
||||||
|
v 2.11803 -0.5 -0.5
|
||||||
|
v 2.11803 -0.5 0.5
|
||||||
|
v 2.11803 0.5 -0.5
|
||||||
|
v 2.11803 0.5 0.5
|
||||||
|
v 1.30902 -1.80902 0.
|
||||||
|
v 1.30902 -0.809017 -1.61803
|
||||||
|
v 1.30902 -0.809017 1.61803
|
||||||
|
v 1.30902 0.809017 -1.61803
|
||||||
|
v 1.30902 0.809017 1.61803
|
||||||
|
v 1.30902 1.80902 0.
|
||||||
|
v 1.80902 0. -1.30902
|
||||||
|
v 1.80902 0. 1.30902
|
||||||
|
|
||||||
|
f 36 23 27
|
||||||
|
f 37 28 24
|
||||||
|
f 40 8 7
|
||||||
|
f 35 5 6
|
||||||
|
f 38 29 25
|
||||||
|
f 39 26 30
|
||||||
|
f 10 14 2
|
||||||
|
f 9 1 13
|
||||||
|
f 12 4 16
|
||||||
|
f 11 15 3
|
||||||
|
f 54 45 41
|
||||||
|
f 55 42 46
|
||||||
|
f 58 19 20
|
||||||
|
f 53 18 17
|
||||||
|
f 56 43 47
|
||||||
|
f 57 48 44
|
||||||
|
f 34 32 22
|
||||||
|
f 33 21 31
|
||||||
|
f 59 51 49
|
||||||
|
f 60 50 52
|
||||||
|
f 27 31 21 36
|
||||||
|
f 23 36 1 9
|
||||||
|
f 10 2 37 24
|
||||||
|
f 37 22 32 28
|
||||||
|
f 8 40 30 26
|
||||||
|
f 25 29 40 7
|
||||||
|
f 35 27 23 5
|
||||||
|
f 6 24 28 35
|
||||||
|
f 3 38 25 11
|
||||||
|
f 21 33 29 38
|
||||||
|
f 39 30 34 22
|
||||||
|
f 12 26 39 4
|
||||||
|
f 55 14 10 42
|
||||||
|
f 41 9 13 54
|
||||||
|
f 57 44 12 16
|
||||||
|
f 15 11 43 56
|
||||||
|
f 45 54 59 49
|
||||||
|
f 50 60 55 46
|
||||||
|
f 48 58 20 44
|
||||||
|
f 43 19 58 47
|
||||||
|
f 53 17 41 45
|
||||||
|
f 46 42 18 53
|
||||||
|
f 59 56 47 51
|
||||||
|
f 52 48 57 60
|
||||||
|
f 31 32 34 33
|
||||||
|
f 17 18 6 5
|
||||||
|
f 1 3 15 13
|
||||||
|
f 14 16 4 2
|
||||||
|
f 7 8 20 19
|
||||||
|
f 51 52 50 49
|
||||||
|
f 3 1 36 21 38
|
||||||
|
f 22 37 2 4 39
|
||||||
|
f 29 33 34 30 40
|
||||||
|
f 27 35 28 32 31
|
||||||
|
f 42 10 24 6 18
|
||||||
|
f 41 17 5 23 9
|
||||||
|
f 20 8 26 12 44
|
||||||
|
f 11 25 7 19 43
|
||||||
|
f 56 59 54 13 15
|
||||||
|
f 57 16 14 55 60
|
||||||
|
f 58 48 52 51 47
|
||||||
|
f 49 50 46 53 45
|
||||||
|
|
@ -0,0 +1,54 @@
|
|||||||
|
#Name:Small Rhombicuboctahedron
|
||||||
|
#Type:face_specified
|
||||||
|
|
||||||
|
v -0.5 -0.5 -1.20711
|
||||||
|
v -0.5 -0.5 1.20711
|
||||||
|
v -0.5 0.5 -1.20711
|
||||||
|
v -0.5 0.5 1.20711
|
||||||
|
v -0.5 -1.20711 -0.5
|
||||||
|
v -0.5 -1.20711 0.5
|
||||||
|
v -0.5 1.20711 -0.5
|
||||||
|
v -0.5 1.20711 0.5
|
||||||
|
v 0.5 -0.5 -1.20711
|
||||||
|
v 0.5 -0.5 1.20711
|
||||||
|
v 0.5 0.5 -1.20711
|
||||||
|
v 0.5 0.5 1.20711
|
||||||
|
v 0.5 -1.20711 -0.5
|
||||||
|
v 0.5 -1.20711 0.5
|
||||||
|
v 0.5 1.20711 -0.5
|
||||||
|
v 0.5 1.20711 0.5
|
||||||
|
v -1.20711 -0.5 -0.5
|
||||||
|
v -1.20711 -0.5 0.5
|
||||||
|
v -1.20711 0.5 -0.5
|
||||||
|
v -1.20711 0.5 0.5
|
||||||
|
v 1.20711 -0.5 -0.5
|
||||||
|
v 1.20711 -0.5 0.5
|
||||||
|
v 1.20711 0.5 -0.5
|
||||||
|
v 1.20711 0.5 0.5
|
||||||
|
|
||||||
|
f 3 11 9 1
|
||||||
|
f 2 10 12 4
|
||||||
|
f 24 22 21 23
|
||||||
|
f 19 17 18 20
|
||||||
|
f 5 13 14 6
|
||||||
|
f 8 16 15 7
|
||||||
|
f 13 21 22 14
|
||||||
|
f 16 24 23 15
|
||||||
|
f 6 18 17 5
|
||||||
|
f 7 19 20 8
|
||||||
|
f 6 14 10 2
|
||||||
|
f 4 12 16 8
|
||||||
|
f 22 24 12 10
|
||||||
|
f 2 4 20 18
|
||||||
|
f 1 9 13 5
|
||||||
|
f 7 15 11 3
|
||||||
|
f 9 11 23 21
|
||||||
|
f 17 19 3 1
|
||||||
|
f 22 10 14
|
||||||
|
f 16 12 24
|
||||||
|
f 6 2 18
|
||||||
|
f 20 4 8
|
||||||
|
f 13 9 21
|
||||||
|
f 23 11 15
|
||||||
|
f 17 1 5
|
||||||
|
f 7 3 19
|
@ -0,0 +1,95 @@
|
|||||||
|
#Name:Small Triambic Icosahedron
|
||||||
|
#Type:face_specified
|
||||||
|
v 0. 0. -0.951057
|
||||||
|
v 0. 0. 0.951057
|
||||||
|
v 0.262866 -0.809017 0.425325
|
||||||
|
v 0.262866 0.809017 0.425325
|
||||||
|
v 0.688191 -0.5 -0.425325
|
||||||
|
v 0.688191 0.5 -0.425325
|
||||||
|
v 0.995959 0. -0.190211
|
||||||
|
v -0.688191 -0.5 0.425325
|
||||||
|
v -0.688191 0.5 0.425325
|
||||||
|
v -0.49798 -0.361803 -0.805748
|
||||||
|
v -0.49798 0.361803 -0.805748
|
||||||
|
v 0.49798 -0.361803 0.805748
|
||||||
|
v 0.49798 0.361803 0.805748
|
||||||
|
v 0.190211 -0.58541 -0.805748
|
||||||
|
v 0.190211 0.58541 -0.805748
|
||||||
|
v 0.850651 0. 0.425325
|
||||||
|
v -0.190211 -0.58541 0.805748
|
||||||
|
v -0.190211 0.58541 0.805748
|
||||||
|
v -0.615537 0. 0.805748
|
||||||
|
v -0.307768 -0.947214 0.190211
|
||||||
|
v -0.307768 0.947214 0.190211
|
||||||
|
v 0.307768 -0.947214 -0.190211
|
||||||
|
v 0.307768 0.947214 -0.190211
|
||||||
|
v 0.615537 0. -0.805748
|
||||||
|
v 0.805748 -0.58541 0.190211
|
||||||
|
v 0.805748 0.58541 0.190211
|
||||||
|
v -0.850651 0. -0.425325
|
||||||
|
v -0.262866 -0.809017 -0.425325
|
||||||
|
v -0.262866 0.809017 -0.425325
|
||||||
|
v -0.995959 0. 0.190211
|
||||||
|
v -0.805748 -0.58541 -0.190211
|
||||||
|
v -0.805748 0.58541 -0.190211
|
||||||
|
|
||||||
|
f 18 2 4
|
||||||
|
f 18 4 9
|
||||||
|
f 18 9 2
|
||||||
|
f 19 2 9
|
||||||
|
f 19 9 8
|
||||||
|
f 19 8 2
|
||||||
|
f 17 2 8
|
||||||
|
f 17 8 3
|
||||||
|
f 17 3 2
|
||||||
|
f 12 2 3
|
||||||
|
f 12 3 16
|
||||||
|
f 12 16 2
|
||||||
|
f 13 2 16
|
||||||
|
f 13 16 4
|
||||||
|
f 13 4 2
|
||||||
|
f 14 5 28
|
||||||
|
f 14 28 1
|
||||||
|
f 14 1 5
|
||||||
|
f 24 6 5
|
||||||
|
f 24 5 1
|
||||||
|
f 24 1 6
|
||||||
|
f 15 29 6
|
||||||
|
f 15 6 1
|
||||||
|
f 15 1 29
|
||||||
|
f 11 27 29
|
||||||
|
f 11 29 1
|
||||||
|
f 11 1 27
|
||||||
|
f 10 28 27
|
||||||
|
f 10 27 1
|
||||||
|
f 10 1 28
|
||||||
|
f 21 4 29
|
||||||
|
f 21 29 9
|
||||||
|
f 21 9 4
|
||||||
|
f 30 9 27
|
||||||
|
f 30 27 8
|
||||||
|
f 30 8 9
|
||||||
|
f 20 8 28
|
||||||
|
f 20 28 3
|
||||||
|
f 20 3 8
|
||||||
|
f 25 3 5
|
||||||
|
f 25 5 16
|
||||||
|
f 25 16 3
|
||||||
|
f 26 16 6
|
||||||
|
f 26 6 4
|
||||||
|
f 26 4 16
|
||||||
|
f 22 5 3
|
||||||
|
f 22 3 28
|
||||||
|
f 22 28 5
|
||||||
|
f 7 6 16
|
||||||
|
f 7 16 5
|
||||||
|
f 7 5 6
|
||||||
|
f 23 29 4
|
||||||
|
f 23 4 6
|
||||||
|
f 23 6 29
|
||||||
|
f 32 27 9
|
||||||
|
f 32 9 29
|
||||||
|
f 32 29 27
|
||||||
|
f 31 28 8
|
||||||
|
f 31 8 27
|
||||||
|
f 31 27 28
|
@ -0,0 +1,65 @@
|
|||||||
|
#Name:Snub Cube
|
||||||
|
#Type:face_specified
|
||||||
|
v -1.1426135 -0.33775397 -0.62122641
|
||||||
|
v -1.1426135 0.33775397 0.62122641
|
||||||
|
v -1.1426135 -0.62122641 0.33775397
|
||||||
|
v -1.1426135 0.62122641 -0.33775397
|
||||||
|
v 1.1426135 -0.33775397 0.62122641
|
||||||
|
v 1.1426135 0.33775397 -0.62122641
|
||||||
|
v 1.1426135 -0.62122641 -0.33775397
|
||||||
|
v 1.1426135 0.62122641 0.33775397
|
||||||
|
v -0.33775397 -1.1426135 0.62122641
|
||||||
|
v -0.33775397 1.1426135 -0.62122641
|
||||||
|
v -0.33775397 -0.62122641 -1.1426135
|
||||||
|
v -0.33775397 0.62122641 1.1426135
|
||||||
|
v 0.33775397 -1.1426135 -0.62122641
|
||||||
|
v 0.33775397 1.1426135 0.62122641
|
||||||
|
v 0.33775397 -0.62122641 1.1426135
|
||||||
|
v 0.33775397 0.62122641 -1.1426135
|
||||||
|
v -0.62122641 -1.1426135 -0.33775397
|
||||||
|
v -0.62122641 1.1426135 0.33775397
|
||||||
|
v -0.62122641 -0.33775397 1.1426135
|
||||||
|
v -0.62122641 0.33775397 -1.1426135
|
||||||
|
v 0.62122641 -1.1426135 0.33775397
|
||||||
|
v 0.62122641 1.1426135 -0.33775397
|
||||||
|
v 0.62122641 -0.33775397 -1.1426135
|
||||||
|
v 0.62122641 0.33775397 1.1426135
|
||||||
|
|
||||||
|
f 3 1 17
|
||||||
|
f 3 17 9
|
||||||
|
f 3 19 2
|
||||||
|
f 3 9 19
|
||||||
|
f 1 4 20
|
||||||
|
f 1 20 11
|
||||||
|
f 1 11 17
|
||||||
|
f 2 19 12
|
||||||
|
f 2 18 4
|
||||||
|
f 2 12 18
|
||||||
|
f 4 18 10
|
||||||
|
f 4 10 20
|
||||||
|
f 17 11 13
|
||||||
|
f 19 9 15
|
||||||
|
f 18 12 14
|
||||||
|
f 20 10 16
|
||||||
|
f 9 21 15
|
||||||
|
f 11 23 13
|
||||||
|
f 12 24 14
|
||||||
|
f 10 22 16
|
||||||
|
f 13 23 7
|
||||||
|
f 13 7 21
|
||||||
|
f 15 21 5
|
||||||
|
f 15 5 24
|
||||||
|
f 16 22 6
|
||||||
|
f 16 6 23
|
||||||
|
f 14 24 8
|
||||||
|
f 14 8 22
|
||||||
|
f 21 7 5
|
||||||
|
f 23 6 7
|
||||||
|
f 24 5 8
|
||||||
|
f 22 8 6
|
||||||
|
f 1 3 2 4
|
||||||
|
f 21 9 17 13
|
||||||
|
f 24 12 19 15
|
||||||
|
f 10 18 14 22
|
||||||
|
f 11 20 16 23
|
||||||
|
f 8 5 7 6
|
@ -0,0 +1,156 @@
|
|||||||
|
#Name:Snub Dodecahedron
|
||||||
|
#Type:face_specified
|
||||||
|
|
||||||
|
v -2.0502159 -0.64302961 0.17539263
|
||||||
|
v 2.0502159 -0.64302961 -0.17539263
|
||||||
|
v -1.6450691 0.64302961 1.2360806
|
||||||
|
v 1.6450691 0.64302961 -1.2360806
|
||||||
|
v -2.0927544 0.33092102 0.39812710
|
||||||
|
v 2.0927544 0.33092102 -0.39812710
|
||||||
|
v -1.3329632 1.6469179 -0.39812710
|
||||||
|
v 1.3329632 1.6469179 0.39812710
|
||||||
|
v -1.8252651 -0.33092102 1.0984232
|
||||||
|
v 1.8252651 -0.33092102 -1.0984232
|
||||||
|
v -0.62604653 1.7461864 -1.0984232
|
||||||
|
v 0.62604653 1.7461864 1.0984232
|
||||||
|
v -1.0622158 1.4540242 1.1853886
|
||||||
|
v 1.0622158 1.4540242 -1.1853886
|
||||||
|
v -1.9321359 0.84755005 -0.44288192
|
||||||
|
v 1.9321359 0.84755005 0.44288192
|
||||||
|
v -1.1448745 -0.84755005 1.6181953
|
||||||
|
v 1.1448745 -0.84755005 -1.6181953
|
||||||
|
v -1.5819879 -1.4540242 -0.17539263
|
||||||
|
v 1.5819879 -1.4540242 0.17539263
|
||||||
|
v -1.0574124 0.37482166 -1.8409298
|
||||||
|
v 1.0574124 0.37482166 1.8409298
|
||||||
|
v -0.43913786 -0.37482166 -2.0770897
|
||||||
|
v 0.43913786 -0.37482166 2.0770897
|
||||||
|
v -1.5624104 -1.2495038 0.80327387
|
||||||
|
v 1.5624104 -1.2495038 -0.80327387
|
||||||
|
v -1.8633072 -0.72833518 -0.80327387
|
||||||
|
v 1.8633072 -0.72833518 0.80327387
|
||||||
|
v -1.7000678 1.2495038 0.44288192
|
||||||
|
v 1.7000678 1.2495038 -0.44288192
|
||||||
|
v -0.72811404 -1.6469179 1.1853886
|
||||||
|
v 0.72811404 -1.6469179 -1.1853886
|
||||||
|
v -0.26565458 -1.7461864 -1.2360806
|
||||||
|
v 0.26565458 -1.7461864 1.2360806
|
||||||
|
v -0.75979117 -1.9778390 -0.39812710
|
||||||
|
v 0.75979117 -1.9778390 0.39812710
|
||||||
|
v -1.1992186 -1.4152654 -1.0984232
|
||||||
|
v 1.1992186 -1.4152654 1.0984232
|
||||||
|
v -1.7903298 0.19289371 -1.1853886
|
||||||
|
v 1.7903298 0.19289371 1.1853886
|
||||||
|
v -1.3064371 -0.56771537 -1.6181953
|
||||||
|
v 1.3064371 -0.56771537 1.6181953
|
||||||
|
v -0.85331128 0.72833518 1.8409298
|
||||||
|
v 0.85331128 0.72833518 -1.8409298
|
||||||
|
v -1.3794145 1.1031568 -1.2360806
|
||||||
|
v 1.3794145 1.1031568 1.2360806
|
||||||
|
v -0.10503615 0.56771537 -2.0770897
|
||||||
|
v 0.10503615 0.56771537 2.0770897
|
||||||
|
v -0.46822796 2.0970538 -0.17539263
|
||||||
|
v 0.46822796 2.0970538 0.17539263
|
||||||
|
v -0.30089684 1.9778390 0.80327387
|
||||||
|
v 0.30089684 1.9778390 -0.80327387
|
||||||
|
v -0.16156263 1.4152654 1.6181953
|
||||||
|
v 0.16156263 1.4152654 -1.6181953
|
||||||
|
v -0.54417401 -0.19289371 2.0770897
|
||||||
|
v 0.54417401 -0.19289371 -2.0770897
|
||||||
|
v -0.23206810 -2.0970538 0.44288192
|
||||||
|
v 0.23206810 -2.0970538 -0.44288192
|
||||||
|
v -0.20410113 -1.1031568 1.8409298
|
||||||
|
v 0.20410113 -1.1031568 -1.8409298
|
||||||
|
|
||||||
|
f 5 1 9
|
||||||
|
f 5 9 3
|
||||||
|
f 5 29 15
|
||||||
|
f 5 3 29
|
||||||
|
f 1 27 19
|
||||||
|
f 1 19 25
|
||||||
|
f 1 25 9
|
||||||
|
f 15 29 7
|
||||||
|
f 15 45 39
|
||||||
|
f 15 7 45
|
||||||
|
f 27 39 41
|
||||||
|
f 27 41 37
|
||||||
|
f 27 37 19
|
||||||
|
f 9 25 17
|
||||||
|
f 39 45 21
|
||||||
|
f 39 21 41
|
||||||
|
f 29 3 13
|
||||||
|
f 3 43 13
|
||||||
|
f 19 37 35
|
||||||
|
f 25 31 17
|
||||||
|
f 45 7 11
|
||||||
|
f 7 49 11
|
||||||
|
f 41 21 23
|
||||||
|
f 37 33 35
|
||||||
|
f 17 31 59
|
||||||
|
f 17 59 55
|
||||||
|
f 13 43 53
|
||||||
|
f 13 53 51
|
||||||
|
f 21 47 23
|
||||||
|
f 43 55 48
|
||||||
|
f 43 48 53
|
||||||
|
f 35 33 58
|
||||||
|
f 35 58 57
|
||||||
|
f 31 57 34
|
||||||
|
f 31 34 59
|
||||||
|
f 11 49 52
|
||||||
|
f 11 52 54
|
||||||
|
f 55 59 24
|
||||||
|
f 55 24 48
|
||||||
|
f 49 51 50
|
||||||
|
f 49 50 52
|
||||||
|
f 23 47 56
|
||||||
|
f 23 56 60
|
||||||
|
f 51 53 12
|
||||||
|
f 51 12 50
|
||||||
|
f 33 60 32
|
||||||
|
f 33 32 58
|
||||||
|
f 57 58 36
|
||||||
|
f 57 36 34
|
||||||
|
f 47 54 44
|
||||||
|
f 47 44 56
|
||||||
|
f 48 24 22
|
||||||
|
f 54 52 14
|
||||||
|
f 54 14 44
|
||||||
|
f 60 56 18
|
||||||
|
f 60 18 32
|
||||||
|
f 34 36 38
|
||||||
|
f 24 42 22
|
||||||
|
f 50 12 8
|
||||||
|
f 12 46 8
|
||||||
|
f 32 18 26
|
||||||
|
f 36 20 38
|
||||||
|
f 44 14 4
|
||||||
|
f 22 42 40
|
||||||
|
f 22 40 46
|
||||||
|
f 14 30 4
|
||||||
|
f 18 10 26
|
||||||
|
f 38 20 28
|
||||||
|
f 38 28 42
|
||||||
|
f 42 28 40
|
||||||
|
f 8 46 16
|
||||||
|
f 8 16 30
|
||||||
|
f 46 40 16
|
||||||
|
f 26 10 2
|
||||||
|
f 26 2 20
|
||||||
|
f 20 2 28
|
||||||
|
f 4 30 6
|
||||||
|
f 4 6 10
|
||||||
|
f 30 16 6
|
||||||
|
f 10 6 2
|
||||||
|
f 39 27 1 5 15
|
||||||
|
f 3 9 17 55 43
|
||||||
|
f 51 49 7 29 13
|
||||||
|
f 57 31 25 19 35
|
||||||
|
f 47 21 45 11 54
|
||||||
|
f 33 37 41 23 60
|
||||||
|
f 42 24 59 34 38
|
||||||
|
f 46 12 53 48 22
|
||||||
|
f 36 58 32 26 20
|
||||||
|
f 14 52 50 8 30
|
||||||
|
f 44 4 10 18 56
|
||||||
|
f 16 40 28 2 6
|
@ -0,0 +1,24 @@
|
|||||||
|
#Face:Szilassi Polyhedron
|
||||||
|
#Type:face_specified
|
||||||
|
v -4.8 0. 4.8
|
||||||
|
v -2.8 -1. 0.8
|
||||||
|
v -2.8 0. 0.8
|
||||||
|
v -1.8 1. 0.8
|
||||||
|
v -1.5 -1.5 -1.2
|
||||||
|
v -0.8 2. -3.2
|
||||||
|
v 0. -5.04 -4.8
|
||||||
|
v 0. 5.04 -4.8
|
||||||
|
v 0.8 -2. -3.2
|
||||||
|
v 1.5 1.5 -1.2
|
||||||
|
v 1.8 -1. 0.8
|
||||||
|
v 2.8 0. 0.8
|
||||||
|
v 2.8 1. 0.8
|
||||||
|
v 4.8 0. 4.8
|
||||||
|
|
||||||
|
f 4 10 6 1 14 13
|
||||||
|
f 3 2 1 6 8 7
|
||||||
|
f 5 10 4 3 7 9
|
||||||
|
f 10 5 11 12 8 6
|
||||||
|
f 12 13 14 9 7 8
|
||||||
|
f 11 5 9 14 1 2
|
||||||
|
f 13 12 11 2 3 4
|
@ -0,0 +1,12 @@
|
|||||||
|
#Name:Tetrahedron
|
||||||
|
#Type:face_specified
|
||||||
|
|
||||||
|
v 0 0 0.61237244
|
||||||
|
v -0.28867513 -0.50000000 -0.20412415
|
||||||
|
v -0.28867513 0.50000000 -0.20412415
|
||||||
|
v 0.57735027 0 -0.20412415
|
||||||
|
|
||||||
|
f 2 3 4
|
||||||
|
f 3 2 1
|
||||||
|
f 4 1 2
|
||||||
|
f 1 4 3
|
@ -0,0 +1,42 @@
|
|||||||
|
#Name:Truncated Cube
|
||||||
|
#Type:face_specified
|
||||||
|
|
||||||
|
v -0.5 1.2071068 1.2071068
|
||||||
|
v -0.5 1.2071068 -1.2071068
|
||||||
|
v -0.5 -1.2071068 1.2071068
|
||||||
|
v -0.5 -1.2071068 -1.2071068
|
||||||
|
v 0.5 1.2071068 1.2071068
|
||||||
|
v 0.5 1.2071068 -1.2071068
|
||||||
|
v 0.5 -1.2071068 1.2071068
|
||||||
|
v 0.5 -1.2071068 -1.2071068
|
||||||
|
v 1.2071068 -0.5 1.2071068
|
||||||
|
v 1.2071068 -0.5 -1.2071068
|
||||||
|
v 1.2071068 0.5 1.2071068
|
||||||
|
v 1.2071068 0.5 -1.2071068
|
||||||
|
v 1.2071068 1.2071068 -0.5
|
||||||
|
v 1.2071068 1.2071068 0.5
|
||||||
|
v 1.2071068 -1.2071068 -0.5
|
||||||
|
v 1.2071068 -1.2071068 0.5
|
||||||
|
v -1.2071068 -0.5 1.2071068
|
||||||
|
v -1.2071068 -0.5 -1.2071068
|
||||||
|
v -1.2071068 0.5 1.2071068
|
||||||
|
v -1.2071068 0.5 -1.2071068
|
||||||
|
v -1.2071068 1.2071068 -0.5
|
||||||
|
v -1.2071068 1.2071068 0.5
|
||||||
|
v -1.2071068 -1.2071068 -0.5
|
||||||
|
v -1.2071068 -1.2071068 0.5
|
||||||
|
|
||||||
|
f 6 12 10 8 4 18 20 2
|
||||||
|
f 1 19 17 3 7 9 11 5
|
||||||
|
f 3 24 23 4 8 15 16 7
|
||||||
|
f 5 14 13 6 2 21 22 1
|
||||||
|
f 9 16 15 10 12 13 14 11
|
||||||
|
f 19 22 21 20 18 23 24 17
|
||||||
|
f 16 9 7
|
||||||
|
f 5 11 14
|
||||||
|
f 3 17 24
|
||||||
|
f 22 19 1
|
||||||
|
f 8 10 15
|
||||||
|
f 13 12 6
|
||||||
|
f 23 18 4
|
||||||
|
f 2 20 21
|
@ -0,0 +1,96 @@
|
|||||||
|
#Name:Truncated Dodecahedron
|
||||||
|
#Type:face_specified
|
||||||
|
|
||||||
|
v 0 -1.6180340 2.4898983
|
||||||
|
v 0 -1.6180340 -2.4898983
|
||||||
|
v 0 1.6180340 2.4898983
|
||||||
|
v 0 1.6180340 -2.4898983
|
||||||
|
v 0.42532540 -2.9270510 0.26286556
|
||||||
|
v 0.42532540 2.9270510 0.26286556
|
||||||
|
v 0.68819096 -2.1180340 1.9641672
|
||||||
|
v 0.68819096 2.1180340 1.9641672
|
||||||
|
v -2.7527638 0 -1.1135164
|
||||||
|
v -2.0645729 -2.1180340 0.26286556
|
||||||
|
v -2.0645729 2.1180340 0.26286556
|
||||||
|
v -1.3763819 -2.6180340 -0.26286556
|
||||||
|
v -1.3763819 2.6180340 -0.26286556
|
||||||
|
v -0.68819096 -2.1180340 -1.9641672
|
||||||
|
v -0.68819096 2.1180340 -1.9641672
|
||||||
|
v 1.3763819 -2.6180340 0.26286556
|
||||||
|
v 1.3763819 2.6180340 0.26286556
|
||||||
|
v 2.7527638 0 1.1135164
|
||||||
|
v 1.8017073 -1.3090170 -1.9641672
|
||||||
|
v 1.8017073 1.3090170 -1.9641672
|
||||||
|
v 2.0645729 -2.1180340 -0.26286556
|
||||||
|
v 2.0645729 2.1180340 -0.26286556
|
||||||
|
v 2.2270327 0 1.9641672
|
||||||
|
v 2.2270327 -1.6180340 -1.1135164
|
||||||
|
v 2.2270327 1.6180340 -1.1135164
|
||||||
|
v -2.6523581 -1.3090170 0.26286556
|
||||||
|
v -2.6523581 1.3090170 0.26286556
|
||||||
|
v 2.6523581 -1.3090170 -0.26286556
|
||||||
|
v 2.6523581 1.3090170 -0.26286556
|
||||||
|
v 2.9152237 -0.5 0.26286556
|
||||||
|
v 2.9152237 0.5 0.26286556
|
||||||
|
v -2.9152237 -0.5 -0.26286556
|
||||||
|
v -2.9152237 0.5 -0.26286556
|
||||||
|
v 0.95105652 -1.3090170 2.4898983
|
||||||
|
v 0.95105652 -1.3090170 -2.4898983
|
||||||
|
v 0.95105652 1.3090170 2.4898983
|
||||||
|
v 0.95105652 1.3090170 -2.4898983
|
||||||
|
v 0.85065081 -2.6180340 1.1135164
|
||||||
|
v 0.85065081 2.6180340 1.1135164
|
||||||
|
v -0.95105652 -1.3090170 2.4898983
|
||||||
|
v -0.95105652 -1.3090170 -2.4898983
|
||||||
|
v -0.95105652 1.3090170 2.4898983
|
||||||
|
v -0.95105652 1.3090170 -2.4898983
|
||||||
|
v -1.5388418 -0.5 2.4898983
|
||||||
|
v -1.5388418 -0.5 -2.4898983
|
||||||
|
v -1.5388418 0.5 2.4898983
|
||||||
|
v -1.5388418 0.5 -2.4898983
|
||||||
|
v 1.5388418 -0.5 2.4898983
|
||||||
|
v 1.5388418 -0.5 -2.4898983
|
||||||
|
v 1.5388418 0.5 2.4898983
|
||||||
|
v 1.5388418 0.5 -2.4898983
|
||||||
|
v -2.2270327 0 -1.9641672
|
||||||
|
v -2.2270327 -1.6180340 1.1135164
|
||||||
|
v -2.2270327 1.6180340 1.1135164
|
||||||
|
v -0.85065081 -2.6180340 -1.1135164
|
||||||
|
v -0.85065081 2.6180340 -1.1135164
|
||||||
|
v -1.8017073 -1.3090170 1.9641672
|
||||||
|
v -1.8017073 1.3090170 1.9641672
|
||||||
|
v -0.42532540 -2.9270510 -0.26286556
|
||||||
|
v -0.42532540 2.9270510 -0.26286556
|
||||||
|
|
||||||
|
f 3 42 46 44 40 1 34 48 50 36
|
||||||
|
f 47 43 4 37 51 49 35 2 41 45
|
||||||
|
f 2 35 19 24 21 16 5 59 55 14
|
||||||
|
f 49 51 20 25 29 31 30 28 24 19
|
||||||
|
f 37 4 15 56 60 6 17 22 25 20
|
||||||
|
f 43 47 52 9 33 27 11 13 56 15
|
||||||
|
f 45 41 14 55 12 10 26 32 9 52
|
||||||
|
f 6 60 13 11 54 58 42 3 8 39
|
||||||
|
f 27 33 32 26 53 57 44 46 58 54
|
||||||
|
f 10 12 59 5 38 7 1 40 57 53
|
||||||
|
f 16 21 28 30 18 23 48 34 7 38
|
||||||
|
f 31 29 22 17 39 8 36 50 23 18
|
||||||
|
f 9 32 33
|
||||||
|
f 18 30 31
|
||||||
|
f 47 45 52
|
||||||
|
f 50 48 23
|
||||||
|
f 10 53 26
|
||||||
|
f 27 54 11
|
||||||
|
f 21 24 28
|
||||||
|
f 29 25 22
|
||||||
|
f 40 44 57
|
||||||
|
f 58 46 42
|
||||||
|
f 35 49 19
|
||||||
|
f 20 51 37
|
||||||
|
f 12 55 59
|
||||||
|
f 60 56 13
|
||||||
|
f 41 2 14
|
||||||
|
f 15 4 43
|
||||||
|
f 34 1 7
|
||||||
|
f 8 3 36
|
||||||
|
f 38 5 16
|
||||||
|
f 17 6 39
|
@ -0,0 +1,96 @@
|
|||||||
|
#Name:Truncated Icosahedron
|
||||||
|
#Type:Face_specified
|
||||||
|
|
||||||
|
v -0.16245985 -2.1180340 1.2759762
|
||||||
|
v -0.16245985 2.1180340 1.2759762
|
||||||
|
v 0.16245985 -2.1180340 -1.2759762
|
||||||
|
v 0.16245985 2.1180340 -1.2759762
|
||||||
|
v -0.26286556 -0.80901699 -2.3274384
|
||||||
|
v -0.26286556 -2.4270510 -0.42532540
|
||||||
|
v -0.26286556 0.80901699 -2.3274384
|
||||||
|
v -0.26286556 2.4270510 -0.42532540
|
||||||
|
v 0.26286556 -0.80901699 2.3274384
|
||||||
|
v 0.26286556 -2.4270510 0.42532540
|
||||||
|
v 0.26286556 0.80901699 2.3274384
|
||||||
|
v 0.26286556 2.4270510 0.42532540
|
||||||
|
v 0.68819096 -0.5 -2.3274384
|
||||||
|
v 0.68819096 0.5 -2.3274384
|
||||||
|
v 1.2139221 -2.1180340 0.42532540
|
||||||
|
v 1.2139221 2.1180340 0.42532540
|
||||||
|
v -2.0645729 -0.5 1.2759762
|
||||||
|
v -2.0645729 0.5 1.2759762
|
||||||
|
v -1.3763819 -1.0 1.8017073
|
||||||
|
v -1.3763819 1.0 1.8017073
|
||||||
|
v -1.3763819 -1.6180340 -1.2759762
|
||||||
|
v -1.3763819 1.6180340 -1.2759762
|
||||||
|
v -0.68819096 -0.5 2.3274384
|
||||||
|
v -0.68819096 0.5 2.3274384
|
||||||
|
v 1.3763819 -1.0 -1.8017073
|
||||||
|
v 1.3763819 1.0 -1.8017073
|
||||||
|
v 1.3763819 -1.6180340 1.2759762
|
||||||
|
v 1.3763819 1.6180340 1.2759762
|
||||||
|
v -1.7013016 0 -1.8017073
|
||||||
|
v 1.7013016 0 1.8017073
|
||||||
|
v -1.2139221 -2.1180340 -0.42532540
|
||||||
|
v -1.2139221 2.1180340 -0.42532540
|
||||||
|
v -1.9641672 -0.80901699 -1.2759762
|
||||||
|
v -1.9641672 0.80901699 -1.2759762
|
||||||
|
v 2.0645729 -0.5 -1.2759762
|
||||||
|
v 2.0645729 0.5 -1.2759762
|
||||||
|
v 2.2270327 -1.0 -0.42532540
|
||||||
|
v 2.2270327 1.0 -0.42532540
|
||||||
|
v 2.3894926 -0.5 0.42532540
|
||||||
|
v 2.3894926 0.5 0.42532540
|
||||||
|
v -1.1135164 -1.8090170 1.2759762
|
||||||
|
v -1.1135164 1.8090170 1.2759762
|
||||||
|
v 1.1135164 -1.8090170 -1.2759762
|
||||||
|
v 1.1135164 1.8090170 -1.2759762
|
||||||
|
v -2.3894926 -0.5 -0.42532540
|
||||||
|
v -2.3894926 0.5 -0.42532540
|
||||||
|
v -1.6392475 -1.8090170 0.42532540
|
||||||
|
v -1.6392475 1.8090170 0.42532540
|
||||||
|
v 1.6392475 -1.8090170 -0.42532540
|
||||||
|
v 1.6392475 1.8090170 -0.42532540
|
||||||
|
v 1.9641672 -0.80901699 1.2759762
|
||||||
|
v 1.9641672 0.80901699 1.2759762
|
||||||
|
v 0.85065081 0 2.3274384
|
||||||
|
v -2.2270327 -1.0 0.42532540
|
||||||
|
v -2.2270327 1.0 0.42532540
|
||||||
|
v -0.85065081 0 -2.3274384
|
||||||
|
v -0.52573111 -1.6180340 -1.8017073
|
||||||
|
v -0.52573111 1.6180340 -1.8017073
|
||||||
|
v 0.52573111 -1.6180340 1.8017073
|
||||||
|
v 0.52573111 1.6180340 1.8017073
|
||||||
|
|
||||||
|
f 53 11 24 23 9
|
||||||
|
f 51 39 40 52 30
|
||||||
|
f 60 28 16 12 2
|
||||||
|
f 20 42 48 55 18
|
||||||
|
f 19 17 54 47 41
|
||||||
|
f 1 10 15 27 59
|
||||||
|
f 36 26 44 50 38
|
||||||
|
f 4 58 22 32 8
|
||||||
|
f 34 29 33 45 46
|
||||||
|
f 21 57 3 6 31
|
||||||
|
f 37 49 43 25 35
|
||||||
|
f 13 5 56 7 14
|
||||||
|
f 9 59 27 51 30 53
|
||||||
|
f 53 30 52 28 60 11
|
||||||
|
f 11 60 2 42 20 24
|
||||||
|
f 24 20 18 17 19 23
|
||||||
|
f 23 19 41 1 59 9
|
||||||
|
f 13 25 43 3 57 5
|
||||||
|
f 5 57 21 33 29 56
|
||||||
|
f 56 29 34 22 58 7
|
||||||
|
f 7 58 4 44 26 14
|
||||||
|
f 14 26 36 35 25 13
|
||||||
|
f 40 38 50 16 28 52
|
||||||
|
f 16 50 44 4 8 12
|
||||||
|
f 12 8 32 48 42 2
|
||||||
|
f 48 32 22 34 46 55
|
||||||
|
f 55 46 45 54 17 18
|
||||||
|
f 54 45 33 21 31 47
|
||||||
|
f 47 31 6 10 1 41
|
||||||
|
f 10 6 3 43 49 15
|
||||||
|
f 15 49 37 39 51 27
|
||||||
|
f 39 37 35 36 38 40
|
@ -0,0 +1,42 @@
|
|||||||
|
#Name:Truncated Octahedron
|
||||||
|
#Type:face_specified
|
||||||
|
|
||||||
|
v -1.5 -0.5 0
|
||||||
|
v -1.5 0.5 0
|
||||||
|
v -1. -1. -0.70710678
|
||||||
|
v -1. -1. 0.70710678
|
||||||
|
v -1. 1. -0.70710678
|
||||||
|
v -1. 1. 0.70710678
|
||||||
|
v -0.5 -1.5 0
|
||||||
|
v -0.5 -0.5 -1.4142136
|
||||||
|
v -0.5 -0.5 1.4142136
|
||||||
|
v -0.5 0.5 -1.4142136
|
||||||
|
v -0.5 0.5 1.4142136
|
||||||
|
v -0.5 1.5 0
|
||||||
|
v 0.5 -1.5 0
|
||||||
|
v 0.5 -0.5 -1.4142136
|
||||||
|
v 0.5 -0.5 1.4142136
|
||||||
|
v 0.5 0.5 -1.4142136
|
||||||
|
v 0.5 0.5 1.4142136
|
||||||
|
v 0.5 1.5 0
|
||||||
|
v 1. -1. -0.70710678
|
||||||
|
v 1. -1. 0.70710678
|
||||||
|
v 1. 1. -0.70710678
|
||||||
|
v 1. 1. 0.70710678
|
||||||
|
v 1.5 -0.5 0
|
||||||
|
v 1.5 0.5 0
|
||||||
|
|
||||||
|
f 17 11 9 15
|
||||||
|
f 14 8 10 16
|
||||||
|
f 22 24 21 18
|
||||||
|
f 12 5 2 6
|
||||||
|
f 13 19 23 20
|
||||||
|
f 4 1 3 7
|
||||||
|
f 19 13 7 3 8 14
|
||||||
|
f 15 9 4 7 13 20
|
||||||
|
f 16 10 5 12 18 21
|
||||||
|
f 22 18 12 6 11 17
|
||||||
|
f 20 23 24 22 17 15
|
||||||
|
f 14 16 21 24 23 19
|
||||||
|
f 9 11 6 2 1 4
|
||||||
|
f 3 1 2 5 10 8
|
@ -0,0 +1,24 @@
|
|||||||
|
#Name:Truncated Tetrahedron
|
||||||
|
#Type:face_specified
|
||||||
|
|
||||||
|
v 0 -1. -0.61237244
|
||||||
|
v 0 1. -0.61237244
|
||||||
|
v -0.57735027 -1. 0.20412415
|
||||||
|
v -0.57735027 1. 0.20412415
|
||||||
|
v -0.28867513 -0.5 1.0206207
|
||||||
|
v -0.28867513 0.5 1.0206207
|
||||||
|
v 0.57735027 0 1.0206207
|
||||||
|
v 1.1547005 0 0.20412415
|
||||||
|
v -0.86602540 -0.5 -0.61237244
|
||||||
|
v -0.86602540 0.5 -0.61237244
|
||||||
|
v 0.86602540 -0.5 -0.61237244
|
||||||
|
v 0.86602540 0.5 -0.61237244
|
||||||
|
|
||||||
|
f 11 12 8
|
||||||
|
f 3 9 1
|
||||||
|
f 2 10 4
|
||||||
|
f 6 5 7
|
||||||
|
f 11 8 7 5 3 1
|
||||||
|
f 2 4 6 7 8 12
|
||||||
|
f 9 3 5 6 4 10
|
||||||
|
f 2 12 11 1 9 10
|
110
extensions/fablabchemnitz/import_3d_mesh/import_3d_mesh.inx
Normal file
110
extensions/fablabchemnitz/import_3d_mesh/import_3d_mesh.inx
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||||
|
<name>Import 3D Mesh</name>
|
||||||
|
<id>fablabchemnitz.de.import_3d_mesh</id>
|
||||||
|
<param name="tab" type="notebook">
|
||||||
|
<page name="common" gui-text="Model file">
|
||||||
|
<param name="input_choice" type="optiongroup" appearance="combo" gui-text="Input choice">
|
||||||
|
<option value="default">Available default object</option>
|
||||||
|
<option value="custom">Custom input file</option>
|
||||||
|
</param>
|
||||||
|
<param name="obj" type="optiongroup" appearance="combo" gui-text="Available default objects">
|
||||||
|
<option value="cube">Cube</option>
|
||||||
|
<option value="trunc_cube">Truncated Cube</option>
|
||||||
|
<option value="snub_cube">Snub Cube</option>
|
||||||
|
<option value="cuboct">Cuboctahedron</option>
|
||||||
|
<option value="tet">Tetrahedron</option>
|
||||||
|
<option value="trunc_tet">Truncated Tetrahedron</option>
|
||||||
|
<option value="oct">Octahedron</option>
|
||||||
|
<option value="trunc_oct">Truncated Octahedron</option>
|
||||||
|
<option value="icos">Icosahedron</option>
|
||||||
|
<option value="trunc_icos">Truncated Icosahedron</option>
|
||||||
|
<option value="small_triam_icos">Small Triambic Icosahedron</option>
|
||||||
|
<option value="dodec">Dodecahedron</option>
|
||||||
|
<option value="trunc_dodec">Truncated Dodecahedron</option>
|
||||||
|
<option value="snub_dodec">Snub Dodecahedron</option>
|
||||||
|
<option value="great_dodec">Great Dodecahedron</option>
|
||||||
|
<option value="great_stel_dodec">Great Stellated Dodecahedron</option>
|
||||||
|
</param>
|
||||||
|
<param name="spec_file" type="path" gui-text="Custom input file" filetypes="obj,off,ply,stl" mode="file">/your/object/file.stl</param>
|
||||||
|
<param name="cw_wound" type="bool" gui-text="Clockwise wound object">false</param>
|
||||||
|
<param name="scl" type="float" min="0" max="10000" gui-text="Scaling factor:">100</param>
|
||||||
|
</page>
|
||||||
|
<page name="view" gui-text="View">
|
||||||
|
<param name="r1_ax" type="optiongroup" appearance="combo" gui-text="Rotate around:">
|
||||||
|
<option value="x">X-Axis</option>
|
||||||
|
<option value="y">Y-Axis</option>
|
||||||
|
<option value="z">Z-Axis</option>
|
||||||
|
</param>
|
||||||
|
<param name="r1_ang" type="float" min="-360" max="360" appearance="full" gui-text="Rotation (deg):">0</param>
|
||||||
|
<param name="r2_ax" type="optiongroup" appearance="combo" gui-text="Then rotate around:">
|
||||||
|
<option value="x">X-Axis</option>
|
||||||
|
<option value="y">Y-Axis</option>
|
||||||
|
<option value="z">Z-Axis</option>
|
||||||
|
</param>
|
||||||
|
<param name="r2_ang" type="float" min="-360" max="360" appearance="full" gui-text="Rotation (deg):">0</param>
|
||||||
|
<param name="r3_ax" type="optiongroup" appearance="combo" gui-text="Then rotate around:">
|
||||||
|
<option value="x">X-Axis</option>
|
||||||
|
<option value="y">Y-Axis</option>
|
||||||
|
<option value="z">Z-Axis</option>
|
||||||
|
</param>
|
||||||
|
<param name="r3_ang" type="float" min="-360" max="360" appearance="full" gui-text="Rotation (deg):">0</param>
|
||||||
|
<param name="r4_ax" type="optiongroup" appearance="combo" gui-text="Then rotate around:">
|
||||||
|
<option value="x">X-Axis</option>
|
||||||
|
<option value="y">Y-Axis</option>
|
||||||
|
<option value="z">Z-Axis</option>
|
||||||
|
</param>
|
||||||
|
<param name="r4_ang" type="float" min="-360" max="360" appearance="full" gui-text="Rotation (deg):">0</param>
|
||||||
|
<param name="r5_ax" type="optiongroup" appearance="combo" gui-text="Then rotate around:">
|
||||||
|
<option value="x">X-Axis</option>
|
||||||
|
<option value="y">Y-Axis</option>
|
||||||
|
<option value="z">Z-Axis</option>
|
||||||
|
</param>
|
||||||
|
<param name="r5_ang" type="float" min="-360" max="360" appearance="full" gui-text="Rotation (deg):">0</param>
|
||||||
|
<param name="r6_ax" type="optiongroup" appearance="combo" gui-text="Then rotate around:">
|
||||||
|
<option value="x">X-Axis</option>
|
||||||
|
<option value="y">Y-Axis</option>
|
||||||
|
<option value="z">Z-Axis</option>
|
||||||
|
</param>
|
||||||
|
<param name="r6_ang" type="float" min="-360" max="360" appearance="full" gui-text="Rotation (deg):">0</param>
|
||||||
|
</page>
|
||||||
|
<page name="style" gui-text="Style">
|
||||||
|
<hbox>
|
||||||
|
<vbox>
|
||||||
|
<param name="fill_color" type="color" gui-text="Fill color">1943148287</param>
|
||||||
|
</vbox>
|
||||||
|
<separator/>
|
||||||
|
<vbox>
|
||||||
|
<param name="s_opac" type="int" min="0" max="100" appearance="full" gui-text="Stroke opacity (%):">100</param>
|
||||||
|
<param name="th" type="float" min="0" max="100" gui-text="Stroke width (px):">2</param>
|
||||||
|
<param name="shade" type="bool" gui-text="Shading" gui-description="Only works for 'Faces' in 'Show' option">true</param>
|
||||||
|
<param name="lv_x" type="float" min="-100" max="100" appearance="full" gui-text="Light X:">1</param>
|
||||||
|
<param name="lv_y" type="float" min="-100" max="100" appearance="full" gui-text="Light Y:">1</param>
|
||||||
|
<param name="lv_z" type="float" min="-100" max="100" appearance="full" gui-text="Light Z:">-2</param>
|
||||||
|
<param name="show" type="optiongroup" appearance="combo" gui-text="Show:">
|
||||||
|
<option value="fce">Faces</option>
|
||||||
|
<option value="edg">Edges</option>
|
||||||
|
<option value="vtx">Vertices</option>
|
||||||
|
</param>
|
||||||
|
<param name="back" type="bool" gui-text="Draw back-facing polygons" gui-description="Only works for 'Faces' in 'Show' option and enabled 'Shading' option">false</param>
|
||||||
|
<param name="z_sort" type="optiongroup" appearance="combo" gui-text="Z-sort faces by:">
|
||||||
|
<option value="max">Maximum</option>
|
||||||
|
<option value="min">Minimum</option>
|
||||||
|
<option value="cent">Centroid</option>
|
||||||
|
</param>
|
||||||
|
</vbox>
|
||||||
|
</hbox>
|
||||||
|
</page>
|
||||||
|
</param>
|
||||||
|
<effect>
|
||||||
|
<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">import_3d_mesh.py</command>
|
||||||
|
</script>
|
||||||
|
</inkscape-extension>
|
392
extensions/fablabchemnitz/import_3d_mesh/import_3d_mesh.py
Normal file
392
extensions/fablabchemnitz/import_3d_mesh/import_3d_mesh.py
Normal file
@ -0,0 +1,392 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
#
|
||||||
|
# Copyright (C) 2007 John Beard john.j.beard@gmail.com
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
#
|
||||||
|
"""
|
||||||
|
This extension draws 3d objects from a Wavefront .obj 3D file stored in a local folder
|
||||||
|
Many settings for appearance, lighting, rotation, etc are available.
|
||||||
|
|
||||||
|
^y
|
||||||
|
|
|
||||||
|
__--``| |_--``| __--
|
||||||
|
__--`` | __--``| |_--``
|
||||||
|
| z | | |_--``|
|
||||||
|
| <----|--------|-----_0-----|----------------
|
||||||
|
| | |_--`` | |
|
||||||
|
| __--`` <-``| |_--``
|
||||||
|
|__--`` x |__--``|
|
||||||
|
IMAGE PLANE SCENE|
|
||||||
|
|
|
||||||
|
|
||||||
|
Vertices are given as "v" followed by three numbers (x,y,z).
|
||||||
|
All files need a vertex list
|
||||||
|
v x.xxx y.yyy z.zzz
|
||||||
|
|
||||||
|
Faces are given by a list of vertices
|
||||||
|
(vertex 1 is the first in the list above, 2 the second, etc):
|
||||||
|
f 1 2 3
|
||||||
|
|
||||||
|
Edges are given by a list of vertices. These will be broken down
|
||||||
|
into adjacent pairs automatically.
|
||||||
|
l 1 2 3
|
||||||
|
|
||||||
|
Faces are rendered according to the painter's algorithm and perhaps
|
||||||
|
back-face culling, if selected. The parameter to sort the faces by
|
||||||
|
is user-selectable between max, min and average z-value of the vertices
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
from math import acos, cos, floor, pi, sin, sqrt
|
||||||
|
import numpy
|
||||||
|
import tempfile
|
||||||
|
import openmesh as om
|
||||||
|
|
||||||
|
import inkex
|
||||||
|
from inkex import Group, Circle, Color
|
||||||
|
from inkex.utils import pairwise
|
||||||
|
from inkex.paths import Move, Line
|
||||||
|
|
||||||
|
|
||||||
|
def draw_circle(r, cx, cy, width, fill, name, parent):
|
||||||
|
"""Draw an SVG circle"""
|
||||||
|
circle = parent.add(Circle(cx=str(cx), cy=str(cy), r=str(r)))
|
||||||
|
circle.style = {'stroke': '#000000', 'stroke-width': str(width), 'fill': fill}
|
||||||
|
circle.label = name
|
||||||
|
|
||||||
|
|
||||||
|
def draw_line(x1, y1, x2, y2, width, name, parent):
|
||||||
|
elem = parent.add(inkex.PathElement())
|
||||||
|
elem.style = {'stroke': '#000000', 'stroke-width': str(width), 'fill': 'none',
|
||||||
|
'stroke-linecap': 'round'}
|
||||||
|
elem.set('inkscape:label', name)
|
||||||
|
elem.path = [Move(x1, y1), Line(x2, y2)]
|
||||||
|
|
||||||
|
def draw_poly(pts, face, st, name, parent):
|
||||||
|
"""Draw polygone"""
|
||||||
|
style = {'stroke': '#000000', 'stroke-width': str(st.th), 'stroke-linejoin': st.linejoin,
|
||||||
|
'stroke-opacity': st.s_opac, 'fill': st.fill, 'fill-opacity': st.fill_opacity}
|
||||||
|
path = inkex.Path()
|
||||||
|
for facet in face:
|
||||||
|
if not path: # for first point
|
||||||
|
path.append(Move(pts[facet - 1][0], -pts[facet - 1][1]))
|
||||||
|
else:
|
||||||
|
path.append(Line(pts[facet - 1][0], -pts[facet - 1][1]))
|
||||||
|
path.close()
|
||||||
|
|
||||||
|
poly = parent.add(inkex.PathElement())
|
||||||
|
poly.label = name
|
||||||
|
poly.style = style
|
||||||
|
poly.path = path
|
||||||
|
|
||||||
|
|
||||||
|
def draw_edges(edge_list, pts, st, parent):
|
||||||
|
for edge in edge_list: # for every edge
|
||||||
|
pt_1 = pts[edge[0] - 1][0:2] # the point at the start
|
||||||
|
pt_2 = pts[edge[1] - 1][0:2] # the point at the end
|
||||||
|
name = 'Edge' + str(edge[0]) + '-' + str(edge[1])
|
||||||
|
draw_line(pt_1[0], -pt_1[1], pt_2[0], -pt_2[1], st.th, name, parent)
|
||||||
|
|
||||||
|
|
||||||
|
def draw_faces(faces_data, pts, obj, shading, fill_col, st, parent):
|
||||||
|
for face in faces_data: # for every polygon that has been sorted
|
||||||
|
if shading:
|
||||||
|
st.fill = get_darkened_colour(fill_col, face[1] / pi) # darken proportionally to angle to lighting vector
|
||||||
|
else:
|
||||||
|
st.fill = get_darkened_colour(fill_col, 1) # do not darken colour
|
||||||
|
|
||||||
|
face_no = face[3] # the number of the face to draw
|
||||||
|
draw_poly(pts, obj.fce[face_no], st, 'Face:' + str(face_no), parent)
|
||||||
|
|
||||||
|
|
||||||
|
def get_darkened_colour(rgb, factor):
|
||||||
|
"""return a hex triplet of colour, reduced in lightness 0.0-1.0"""
|
||||||
|
return '#' + "%02X" % floor(factor * rgb[0]) \
|
||||||
|
+ "%02X" % floor(factor * rgb[1]) \
|
||||||
|
+ "%02X" % floor(factor * rgb[2]) # make the colour string
|
||||||
|
|
||||||
|
|
||||||
|
def make_rotation_log(options):
|
||||||
|
"""makes a string recording the axes and angles of each rotation, so an object can be repeated"""
|
||||||
|
return options.r1_ax + str('%.2f' % options.r1_ang) + ':' + \
|
||||||
|
options.r2_ax + str('%.2f' % options.r2_ang) + ':' + \
|
||||||
|
options.r3_ax + str('%.2f' % options.r3_ang) + ':' + \
|
||||||
|
options.r1_ax + str('%.2f' % options.r4_ang) + ':' + \
|
||||||
|
options.r2_ax + str('%.2f' % options.r5_ang) + ':' + \
|
||||||
|
options.r3_ax + str('%.2f' % options.r6_ang)
|
||||||
|
|
||||||
|
def normalise(vector):
|
||||||
|
"""return the unit vector pointing in the same direction as the argument"""
|
||||||
|
length = sqrt(numpy.dot(vector, vector))
|
||||||
|
return numpy.array(vector) / length
|
||||||
|
|
||||||
|
def get_normal(pts, face):
|
||||||
|
"""normal vector for the plane passing though the first three elements of face of pts"""
|
||||||
|
return numpy.cross(
|
||||||
|
(numpy.array(pts[face[0] - 1]) - numpy.array(pts[face[1] - 1])),
|
||||||
|
(numpy.array(pts[face[0] - 1]) - numpy.array(pts[face[2] - 1])),
|
||||||
|
).flatten()
|
||||||
|
|
||||||
|
def get_unit_normal(pts, face, cw_wound):
|
||||||
|
"""
|
||||||
|
Returns the unit normal for the plane passing through the
|
||||||
|
first three points of face, taking account of winding
|
||||||
|
"""
|
||||||
|
# if it is clockwise wound, reverse the vector direction
|
||||||
|
winding = -1 if cw_wound else 1
|
||||||
|
return winding * normalise(get_normal(pts, face))
|
||||||
|
|
||||||
|
def rotate(matrix, rads, axis):
|
||||||
|
"""choose the correct rotation matrix to use"""
|
||||||
|
if axis == 'x':
|
||||||
|
trans_mat = numpy.array([
|
||||||
|
[1, 0, 0], [0, cos(rads), -sin(rads)], [0, sin(rads), cos(rads)]])
|
||||||
|
elif axis == 'y':
|
||||||
|
trans_mat = numpy.array([
|
||||||
|
[cos(rads), 0, sin(rads)], [0, 1, 0], [-sin(rads), 0, cos(rads)]])
|
||||||
|
elif axis == 'z':
|
||||||
|
trans_mat = numpy.array([
|
||||||
|
[cos(rads), -sin(rads), 0], [sin(rads), cos(rads), 0], [0, 0, 1]])
|
||||||
|
return numpy.matmul(trans_mat, matrix)
|
||||||
|
|
||||||
|
class Style(object): # container for style information
|
||||||
|
def __init__(self, options):
|
||||||
|
self.th = options.th
|
||||||
|
self.fill = '#ff0000'
|
||||||
|
self.col = '#000000'
|
||||||
|
self.r = 2
|
||||||
|
self.s_opac = str(options.s_opac / 100.0)
|
||||||
|
self.fill_opacity = options.fill_color.alpha
|
||||||
|
self.linecap = 'round'
|
||||||
|
self.linejoin = 'round'
|
||||||
|
|
||||||
|
|
||||||
|
class WavefrontObj(object):
|
||||||
|
"""Wavefront based 3d object defined by the vertices and the faces (eg a polyhedron)"""
|
||||||
|
name = property(lambda self: self.meta.get('name', None))
|
||||||
|
|
||||||
|
def __init__(self, filename):
|
||||||
|
self.meta = {
|
||||||
|
'name': os.path.basename(filename).rsplit('.', 1)[0]
|
||||||
|
}
|
||||||
|
self.vtx = []
|
||||||
|
self.edg = []
|
||||||
|
self.fce = []
|
||||||
|
self._parse_file(filename)
|
||||||
|
|
||||||
|
def _parse_file(self, filename):
|
||||||
|
if not os.path.isfile(filename):
|
||||||
|
raise IOError("Can't find wavefront object file {}".format(filename))
|
||||||
|
with open(filename, 'r') as fhl:
|
||||||
|
for line in fhl:
|
||||||
|
self._parse_line(line.strip())
|
||||||
|
|
||||||
|
def _parse_line(self, line):
|
||||||
|
if line.startswith('#'):
|
||||||
|
if ':' in line:
|
||||||
|
name, value = line.split(':', 1)
|
||||||
|
self.meta[name.lower()] = value
|
||||||
|
elif line:
|
||||||
|
(kind, line) = line.split(None, 1)
|
||||||
|
kind_name = 'add_' + kind
|
||||||
|
if hasattr(self, kind_name):
|
||||||
|
getattr(self, kind_name)(line)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _parse_numbers(line, typ=str):
|
||||||
|
# Ignore any slash options and always pick the first one
|
||||||
|
return [typ(v.split('/')[0]) for v in line.split()]
|
||||||
|
|
||||||
|
def add_v(self, line):
|
||||||
|
"""Add vertex from parsed line"""
|
||||||
|
vertex = self._parse_numbers(line, float)
|
||||||
|
if len(vertex) == 3:
|
||||||
|
self.vtx.append(vertex)
|
||||||
|
|
||||||
|
def add_l(self, line):
|
||||||
|
"""Add line from parsed line"""
|
||||||
|
vtxlist = self._parse_numbers(line, int)
|
||||||
|
# we need at least 2 vertices to make an edge
|
||||||
|
if len(vtxlist) > 1:
|
||||||
|
# we can have more than one vertex per line - get adjacent pairs
|
||||||
|
self.edg.append(pairwise(vtxlist))
|
||||||
|
|
||||||
|
def add_f(self, line):
|
||||||
|
"""Add face from parsed line"""
|
||||||
|
vtxlist = self._parse_numbers(line, int)
|
||||||
|
# we need at least 3 vertices to make an edge
|
||||||
|
if len(vtxlist) > 2:
|
||||||
|
self.fce.append(vtxlist)
|
||||||
|
|
||||||
|
def get_transformed_pts(self, trans_mat):
|
||||||
|
"""translate vertex points according to the matrix"""
|
||||||
|
transformed_pts = []
|
||||||
|
for vtx in self.vtx:
|
||||||
|
transformed_pts.append((numpy.matmul(trans_mat, numpy.array(vtx).T)).T.tolist())
|
||||||
|
return transformed_pts
|
||||||
|
|
||||||
|
def get_edge_list(self):
|
||||||
|
"""make an edge vertex list from an existing face vertex list"""
|
||||||
|
edge_list = []
|
||||||
|
for face in self.fce:
|
||||||
|
for j, edge in enumerate(face):
|
||||||
|
# Ascending order of vertices (for duplicate detection)
|
||||||
|
edge_list.append(sorted([edge, face[(j + 1) % len(face)]]))
|
||||||
|
return [list(x) for x in sorted(set(tuple(x) for x in edge_list))]
|
||||||
|
|
||||||
|
class Import3DMesh(inkex.GenerateExtension):
|
||||||
|
|
||||||
|
"""Generate a polyhedron from a wavefront 3d model file"""
|
||||||
|
def add_arguments(self, pars):
|
||||||
|
pars.add_argument("--tab", default="object")
|
||||||
|
|
||||||
|
# MODEL FILE SETTINGS
|
||||||
|
pars.add_argument("--obj", default='cube')
|
||||||
|
pars.add_argument("--input_choice", default='default')
|
||||||
|
pars.add_argument("--spec_file", default='great_rhombicuboct.obj')
|
||||||
|
pars.add_argument("--cw_wound", type=inkex.Boolean, default=True)
|
||||||
|
# VEIW SETTINGS
|
||||||
|
pars.add_argument("--r1_ax", default="x")
|
||||||
|
pars.add_argument("--r2_ax", default="x")
|
||||||
|
pars.add_argument("--r3_ax", default="x")
|
||||||
|
pars.add_argument("--r4_ax", default="x")
|
||||||
|
pars.add_argument("--r5_ax", default="x")
|
||||||
|
pars.add_argument("--r6_ax", default="x")
|
||||||
|
pars.add_argument("--r1_ang", type=float, default=0.0)
|
||||||
|
pars.add_argument("--r2_ang", type=float, default=0.0)
|
||||||
|
pars.add_argument("--r3_ang", type=float, default=0.0)
|
||||||
|
pars.add_argument("--r4_ang", type=float, default=0.0)
|
||||||
|
pars.add_argument("--r5_ang", type=float, default=0.0)
|
||||||
|
pars.add_argument("--r6_ang", type=float, default=0.0)
|
||||||
|
pars.add_argument("--scl", type=float, default=100.0)
|
||||||
|
# STYLE SETTINGS
|
||||||
|
pars.add_argument("--show", type=self.arg_method('gen'))
|
||||||
|
pars.add_argument("--shade", type=inkex.Boolean, default=True)
|
||||||
|
pars.add_argument("--fill_color", type=Color, default='1943148287', help="Fill color")
|
||||||
|
pars.add_argument("--s_opac", type=int, default=100)
|
||||||
|
pars.add_argument("--th", type=float, default=2)
|
||||||
|
pars.add_argument("--lv_x", type=float, default=1)
|
||||||
|
pars.add_argument("--lv_y", type=float, default=1)
|
||||||
|
pars.add_argument("--lv_z", type=float, default=-2)
|
||||||
|
pars.add_argument("--back", type=inkex.Boolean, default=False)
|
||||||
|
pars.add_argument("--z_sort", type=self.arg_method('z_sort'), default=self.z_sort_min)
|
||||||
|
|
||||||
|
def get_filename(self):
|
||||||
|
"""Get the filename for the spec file"""
|
||||||
|
if self.options.input_choice == 'custom':
|
||||||
|
return self.options.spec_file
|
||||||
|
if self.options.input_choice == 'default':
|
||||||
|
moddir = self.ext_path()
|
||||||
|
return os.path.join(moddir, 'Poly3DObjects', self.options.obj + '.obj')
|
||||||
|
|
||||||
|
def generate(self):
|
||||||
|
so = self.options
|
||||||
|
|
||||||
|
if not os.path.exists(self.get_filename()):
|
||||||
|
inkex.utils.debug("The input file does not exist.")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
input_mesh = om.read_polymesh(self.get_filename()) #read input file
|
||||||
|
output_obj = os.path.join(tempfile.gettempdir(), "input_mesh.obj")
|
||||||
|
om.write_mesh(output_obj, input_mesh)
|
||||||
|
#write to obj file
|
||||||
|
|
||||||
|
obj = WavefrontObj(output_obj)
|
||||||
|
|
||||||
|
scale = self.svg.unittouu('1px') # convert to document units
|
||||||
|
st = Style(so) # initialise style
|
||||||
|
|
||||||
|
# we will put all the rotations in the object name, so it can be repeated in
|
||||||
|
poly = Group.new(obj.name + ':' + make_rotation_log(so))
|
||||||
|
(pos_x, pos_y) = self.svg.namedview.center
|
||||||
|
#poly.transform.add_translate(pos_x, pos_y)
|
||||||
|
poly.transform.add_scale(scale)
|
||||||
|
|
||||||
|
# TRANSFORMATION OF THE OBJECT (ROTATION, SCALE, ETC)
|
||||||
|
trans_mat = numpy.identity(3, float) # init. trans matrix as identity matrix
|
||||||
|
for i in range(1, 7): # for each rotation
|
||||||
|
axis = getattr(so, 'r{}_ax'.format(i))
|
||||||
|
angle = getattr(so, 'r{}_ang'.format(i)) * pi / 180
|
||||||
|
trans_mat = rotate(trans_mat, angle, axis)
|
||||||
|
# scale by linear factor (do this only after the transforms to reduce round-off)
|
||||||
|
trans_mat = trans_mat * so.scl
|
||||||
|
|
||||||
|
# the points as projected in the z-axis onto the viewplane
|
||||||
|
transformed_pts = obj.get_transformed_pts(trans_mat)
|
||||||
|
so.show(obj, st, poly, transformed_pts)
|
||||||
|
return poly
|
||||||
|
|
||||||
|
def gen_vtx(self, obj, st, poly, transformed_pts):
|
||||||
|
"""Generate Vertex"""
|
||||||
|
for i, pts in enumerate(transformed_pts):
|
||||||
|
draw_circle(st.r, pts[0], pts[1], st.th, '#000000', 'Point' + str(i), poly)
|
||||||
|
|
||||||
|
def gen_edg(self, obj, st, poly, transformed_pts):
|
||||||
|
"""Generate edges"""
|
||||||
|
# we already have an edge list
|
||||||
|
edge_list = obj.edg
|
||||||
|
if obj.fce:
|
||||||
|
# we must generate the edge list from the faces
|
||||||
|
edge_list = obj.get_edge_list()
|
||||||
|
|
||||||
|
draw_edges(edge_list, transformed_pts, st, poly)
|
||||||
|
|
||||||
|
def gen_fce(self, obj, st, poly, transformed_pts):
|
||||||
|
"""Generate face"""
|
||||||
|
so = self.options
|
||||||
|
# colour tuple for the face fill
|
||||||
|
# unit light vector
|
||||||
|
lighting = normalise((so.lv_x, -so.lv_y, so.lv_z))
|
||||||
|
# we have a face list
|
||||||
|
if obj.fce:
|
||||||
|
z_list = []
|
||||||
|
|
||||||
|
for i, face in enumerate(obj.fce):
|
||||||
|
# get the normal vector to the face
|
||||||
|
norm = get_unit_normal(transformed_pts, face, so.cw_wound)
|
||||||
|
# get the angle between the normal and the lighting vector
|
||||||
|
angle = acos(numpy.dot(norm, lighting))
|
||||||
|
z_sort_param = so.z_sort(transformed_pts, face)
|
||||||
|
|
||||||
|
# include all polygons or just the front-facing ones as needed
|
||||||
|
if so.back or norm[2] > 0:
|
||||||
|
# record the maximum z-value of the face and angle to
|
||||||
|
# light, along with the face ID and normal
|
||||||
|
z_list.append((z_sort_param, angle, norm, i))
|
||||||
|
|
||||||
|
z_list.sort(key=lambda x: x[0]) # sort by ascending sort parameter of the face
|
||||||
|
draw_faces(z_list, transformed_pts, obj, so.shade, self.options.fill_color, st, poly)
|
||||||
|
|
||||||
|
else: # we cannot generate a list of faces from the edges without a lot of computation
|
||||||
|
raise inkex.AbortExtension("Face data not found.")
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def z_sort_max(pts, face):
|
||||||
|
"""returns the largest z_value of any point in the face"""
|
||||||
|
return max([pts[facet - 1][2] for facet in face])
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def z_sort_min(pts, face):
|
||||||
|
"""returns the smallest z_value of any point in the face"""
|
||||||
|
return min([pts[facet - 1][2] for facet in face])
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def z_sort_cent(pts, face):
|
||||||
|
"""returns the centroid z_value of any point in the face"""
|
||||||
|
return sum([pts[facet - 1][2] for facet in face]) / len(face)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
Import3DMesh().run()
|
21
extensions/fablabchemnitz/import_3d_mesh/meta.json
Normal file
21
extensions/fablabchemnitz/import_3d_mesh/meta.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "Import 3D Mesh",
|
||||||
|
"id": "fablabchemnitz.de.import_3d_mesh",
|
||||||
|
"path": "import_3d_mesh",
|
||||||
|
"dependent_extensions": null,
|
||||||
|
"original_name": "3D Polyhedron",
|
||||||
|
"original_id": "org.inkscape.render.poly_3d",
|
||||||
|
"license": "GNU GPL v2",
|
||||||
|
"license_url": "https://gitlab.com/inkscape/extensions/-/blob/master/LICENSE.txt",
|
||||||
|
"comment": "modified version of 3D Polyhedron extension",
|
||||||
|
"source_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.X/src/branch/master/extensions/fablabchemnitz/import_3d_mesh",
|
||||||
|
"fork_url": "https://gitlab.com/inkscape/extensions",
|
||||||
|
"documentation_url": "https://stadtfabrikanten.org/display/IFM/Import+3D+Mesh",
|
||||||
|
"inkscape_gallery_url": null,
|
||||||
|
"main_authors": [
|
||||||
|
"John Beard:john.j.beard@gmail.com",
|
||||||
|
"github.com/vmario89"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
17
extensions/fablabchemnitz/incadiff/incadiff.inx
Normal file
17
extensions/fablabchemnitz/incadiff/incadiff.inx
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||||
|
<name>Incadiff</name>
|
||||||
|
<id>fablabchemnitz.de.incadiff</id>
|
||||||
|
<effect needs-document="true" needs-live-preview="false">
|
||||||
|
<object-type>all</object-type>
|
||||||
|
<effects-menu>
|
||||||
|
<submenu name="FabLab Chemnitz">
|
||||||
|
<submenu name="Paths - Cut/Intersect/Purge" />
|
||||||
|
</submenu>
|
||||||
|
</effects-menu>
|
||||||
|
<menu-tip>Apply successive difference operations on superimposed paths. Useful for plotter addicts.</menu-tip>
|
||||||
|
</effect>
|
||||||
|
<script>
|
||||||
|
<command location="inx" interpreter="python">incadiff.py</command>
|
||||||
|
</script>
|
||||||
|
</inkscape-extension>
|
323
extensions/fablabchemnitz/incadiff/incadiff.py
Normal file
323
extensions/fablabchemnitz/incadiff/incadiff.py
Normal file
@ -0,0 +1,323 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# coding=utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Copyright (C) 2021 Thomas Maziere <thomas.maziere@incaya.fr>
|
||||||
|
|
||||||
|
Largely and mostly inspired by inx-pathops (https://gitlab.com/moini_ink/inx-pathops/)
|
||||||
|
Copyright (C) 2014 Ryan Lerch (multiple difference)
|
||||||
|
2016 Maren Hachmann <marenhachmannATyahoo.com>
|
||||||
|
(refactoring, extend to multibool)
|
||||||
|
2017 su_v <suv-sf@users.sf.net>
|
||||||
|
Rewrite to support large selections (process in chunks), to
|
||||||
|
improve performance (support groups, z-sort ids with python
|
||||||
|
instead of external query), and to extend GUI options.
|
||||||
|
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
"""
|
||||||
|
|
||||||
|
"""
|
||||||
|
incadiff
|
||||||
|
Apply successive difference operations on superimposed paths. Useful for plotter addicts.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
from shutil import copy2
|
||||||
|
import time
|
||||||
|
from lxml import etree
|
||||||
|
import inkex
|
||||||
|
import inkex.command
|
||||||
|
|
||||||
|
def timed(f):
|
||||||
|
"""Minimalistic timer for functions."""
|
||||||
|
# pylint: disable=invalid-name
|
||||||
|
start = time.time()
|
||||||
|
ret = f()
|
||||||
|
elapsed = time.time() - start
|
||||||
|
return ret, elapsed
|
||||||
|
|
||||||
|
|
||||||
|
def get_defs(node):
|
||||||
|
"""Find <defs> in children of *node*, return first one found."""
|
||||||
|
path = '/svg:svg//svg:defs'
|
||||||
|
try:
|
||||||
|
return node.xpath(path, namespaces=inkex.NSS)[0]
|
||||||
|
except IndexError:
|
||||||
|
return etree.SubElement(node, inkex.addNS('defs', 'svg'))
|
||||||
|
|
||||||
|
|
||||||
|
def is_group(node):
|
||||||
|
"""Check node for group tag."""
|
||||||
|
return node.tag == inkex.addNS('g', 'svg')
|
||||||
|
|
||||||
|
|
||||||
|
def is_path(node):
|
||||||
|
"""Check node for path tag."""
|
||||||
|
return node.tag == inkex.addNS('path', 'svg')
|
||||||
|
|
||||||
|
|
||||||
|
def is_basic_shape(node):
|
||||||
|
"""Check node for SVG basic shape tag."""
|
||||||
|
return node.tag in (inkex.addNS(tag, 'svg') for tag in ('rect', 'circle', 'ellipse', 'line', 'polyline', 'polygon'))
|
||||||
|
|
||||||
|
|
||||||
|
def is_custom_shape(node):
|
||||||
|
"""Check node for Inkscape custom shape type."""
|
||||||
|
return inkex.addNS('type', 'sodipodi') in node.attrib
|
||||||
|
|
||||||
|
|
||||||
|
def is_shape(node):
|
||||||
|
"""Check node for SVG basic shape tag or Inkscape custom shape type."""
|
||||||
|
return is_basic_shape(node) or is_custom_shape(node)
|
||||||
|
|
||||||
|
|
||||||
|
def has_path_effect(node):
|
||||||
|
"""Check node for Inkscape path-effect attribute."""
|
||||||
|
return inkex.addNS('path-effect', 'inkscape') in node.attrib
|
||||||
|
|
||||||
|
|
||||||
|
def is_modifiable_path(node):
|
||||||
|
"""Check node for editable path data."""
|
||||||
|
return is_path(node) and not (has_path_effect(node) or
|
||||||
|
is_custom_shape(node))
|
||||||
|
|
||||||
|
|
||||||
|
def is_image(node):
|
||||||
|
"""Check node for image tag."""
|
||||||
|
return node.tag == inkex.addNS('image', 'svg')
|
||||||
|
|
||||||
|
|
||||||
|
def is_text(node):
|
||||||
|
"""Check node for text tag."""
|
||||||
|
return node.tag == inkex.addNS('text', 'svg')
|
||||||
|
|
||||||
|
|
||||||
|
def does_pathops(node):
|
||||||
|
"""Check whether node is supported by Inkscape path operations."""
|
||||||
|
return (is_path(node) or
|
||||||
|
is_shape(node) or
|
||||||
|
is_text(node))
|
||||||
|
|
||||||
|
|
||||||
|
# ----- list processing helper functions
|
||||||
|
|
||||||
|
def recurse_selection(node, id_list, level=0, current=0):
|
||||||
|
"""Recursively process selection, add checked elements to id list."""
|
||||||
|
current += 1
|
||||||
|
if not level or current <= level:
|
||||||
|
if is_group(node):
|
||||||
|
for child in node:
|
||||||
|
id_list = recurse_selection(child, id_list, level, current)
|
||||||
|
if does_pathops(node):
|
||||||
|
id_list.append(node.get('id'))
|
||||||
|
return id_list
|
||||||
|
|
||||||
|
|
||||||
|
def z_sort(node, alist):
|
||||||
|
"""Return new list sorted in document order (depth-first traversal)."""
|
||||||
|
ordered = []
|
||||||
|
id_list = list(alist)
|
||||||
|
count = len(id_list)
|
||||||
|
for element in node.iter():
|
||||||
|
element_id = element.get('id')
|
||||||
|
if element_id is not None and element_id in id_list:
|
||||||
|
id_list.remove(element_id)
|
||||||
|
ordered.append(element_id)
|
||||||
|
count -= 1
|
||||||
|
if not count:
|
||||||
|
break
|
||||||
|
return ordered
|
||||||
|
|
||||||
|
|
||||||
|
def z_iter(node, alist):
|
||||||
|
"""Return iterator over ids in document order (depth-first traversal)."""
|
||||||
|
id_list = list(alist)
|
||||||
|
for element in node.iter():
|
||||||
|
element_id = element.get('id')
|
||||||
|
if element_id is not None and element_id in id_list:
|
||||||
|
id_list.remove(element_id)
|
||||||
|
yield element_id
|
||||||
|
|
||||||
|
|
||||||
|
def chunks(alist, max_len):
|
||||||
|
"""Chunk a list into sublists of max_len length."""
|
||||||
|
for i in range(0, len(alist), max_len):
|
||||||
|
yield alist[i:i+max_len]
|
||||||
|
|
||||||
|
|
||||||
|
class Incadiff(inkex.EffectExtension):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
inkex.Effect.__init__(self)
|
||||||
|
self.actions_list = []
|
||||||
|
|
||||||
|
def get_selected_ids(self):
|
||||||
|
"""Return a list of valid ids for inkscape path operations."""
|
||||||
|
id_list = []
|
||||||
|
if len(self.svg.selected) == 0:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
level = 0
|
||||||
|
for node in self.svg.selected.values():
|
||||||
|
recurse_selection(node, id_list, level)
|
||||||
|
if len(id_list) < 2:
|
||||||
|
inkex.errormsg("This extension requires at least 2 elements " +
|
||||||
|
"of type path, shape or text. " +
|
||||||
|
"The elements can be part of selected groups, " +
|
||||||
|
"or directly selected.")
|
||||||
|
return None
|
||||||
|
if len(id_list) > 64:
|
||||||
|
inkex.errormsg("You should not select more than 64 shapes/paths, " +
|
||||||
|
"and ideally you should apply this extension to small groups of objects.")
|
||||||
|
return None
|
||||||
|
|
||||||
|
else:
|
||||||
|
return id_list
|
||||||
|
|
||||||
|
def get_sorted_ids(self):
|
||||||
|
"""Return a list with z-sorted ids."""
|
||||||
|
sorted_ids = None
|
||||||
|
id_list = self.get_selected_ids()
|
||||||
|
if id_list is not None:
|
||||||
|
sorted_ids = list(z_iter(self.document.getroot(), id_list))
|
||||||
|
return (sorted_ids)
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def run_cmd(self, tempfile):
|
||||||
|
actions = ";".join(self.actions_list)
|
||||||
|
cli_output = inkex.command.inkscape(tempfile, "--export-overwrite", actions=actions)
|
||||||
|
if len(cli_output) > 0:
|
||||||
|
self.msg("Inkscape returned the following output when trying to run the file export; the file export may still have worked:")
|
||||||
|
self.msg(cli_output)
|
||||||
|
|
||||||
|
def duplicate_and_diff(self, id_list, tempfile):
|
||||||
|
# for each selected path, duplicate and diff for each path below
|
||||||
|
nb_shapes = len(id_list)
|
||||||
|
for i in range(0, nb_shapes):
|
||||||
|
top_path = id_list[i]
|
||||||
|
j = i
|
||||||
|
while j > 0:
|
||||||
|
j -= 1
|
||||||
|
self.actions_list.append("select-by-id:"+top_path)
|
||||||
|
self.actions_list.append("duplicate")
|
||||||
|
self.actions_list.append("select-by-id:" + id_list[j])
|
||||||
|
self.actions_list.append("path-difference")
|
||||||
|
self.actions_list.append("unselect-by-id:"+top_path)
|
||||||
|
if nb_shapes > 20:
|
||||||
|
self.run_cmd(tempfile)
|
||||||
|
self.actions_list = []
|
||||||
|
if len(self.actions_list) > 0:
|
||||||
|
self.run_cmd(tempfile)
|
||||||
|
self.actions_list = []
|
||||||
|
|
||||||
|
def loop_diff(self):
|
||||||
|
"""Loop through selected items and run external command(s)."""
|
||||||
|
|
||||||
|
tempfile = self.options.input_file + "-incadiff.svg"
|
||||||
|
# prepare
|
||||||
|
# we need to do this because command line Inkscape with gui
|
||||||
|
# gives lots of info dialogs when the file extension isn't 'svg'
|
||||||
|
# so the inkscape() call cannot open the file without user
|
||||||
|
# interaction, and fails in the end when trying to save
|
||||||
|
copy2(self.options.input_file, tempfile)
|
||||||
|
|
||||||
|
# loop through selected paths
|
||||||
|
id_list = self.get_sorted_ids()
|
||||||
|
if id_list is not None:
|
||||||
|
self.duplicate_and_diff(id_list, tempfile)
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
# replace current document with content of temp copy file
|
||||||
|
self.document = inkex.load_svg(tempfile)
|
||||||
|
# update self.svg
|
||||||
|
self.svg = self.document.getroot()
|
||||||
|
|
||||||
|
# purge missing tagrefs (see below)
|
||||||
|
self.update_tagrefs()
|
||||||
|
# clean up
|
||||||
|
self.cleanup(tempfile)
|
||||||
|
|
||||||
|
def cleanup(self, tempfile):
|
||||||
|
try:
|
||||||
|
os.remove(tempfile)
|
||||||
|
except Exception: # pylint: disable=broad-except
|
||||||
|
pass
|
||||||
|
|
||||||
|
def effect(self):
|
||||||
|
if self.has_tagrefs():
|
||||||
|
# unsafe to use with extensions ...
|
||||||
|
inkex.utils.errormsg("This document uses Inkscape selection sets. " +
|
||||||
|
"Modifying the content with this extension " +
|
||||||
|
"may cause Inkscape to crash on reload or close. " +
|
||||||
|
"Please delete the selection sets, " +
|
||||||
|
"save the document under a new name and " +
|
||||||
|
"try again in a new Inkscape session.")
|
||||||
|
else:
|
||||||
|
self.loop_diff()
|
||||||
|
|
||||||
|
def has_tagrefs(self):
|
||||||
|
"""Check whether document has selection sets with tagrefs."""
|
||||||
|
defs = get_defs(self.document.getroot())
|
||||||
|
inkscape_tagrefs = defs.findall(
|
||||||
|
"inkscape:tag/inkscape:tagref", namespaces=inkex.NSS)
|
||||||
|
return len(inkscape_tagrefs) > 0
|
||||||
|
|
||||||
|
def update_tagrefs(self, mode='purge'):
|
||||||
|
"""Check tagrefs for deleted objects."""
|
||||||
|
defs = get_defs(self.document.getroot())
|
||||||
|
inkscape_tagrefs = defs.findall(
|
||||||
|
"inkscape:tag/inkscape:tagref", namespaces=inkex.NSS)
|
||||||
|
if len(inkscape_tagrefs) > 0:
|
||||||
|
for tagref in inkscape_tagrefs:
|
||||||
|
href = tagref.get(inkex.addNS('href', 'xlink'))[1:]
|
||||||
|
if self.svg.getElementById(href) is None:
|
||||||
|
if mode == 'purge':
|
||||||
|
tagref.getparent().remove(tagref)
|
||||||
|
elif mode == 'placeholder':
|
||||||
|
temp = etree.Element(inkex.addNS('path', 'svg'))
|
||||||
|
temp.set('id', href)
|
||||||
|
temp.set('d', 'M 0,0 Z')
|
||||||
|
self.document.getroot().append(temp)
|
||||||
|
|
||||||
|
# ----- workaround to fix Effect() performance with large selections
|
||||||
|
|
||||||
|
def collect_ids(self, doc=None):
|
||||||
|
"""Iterate all elements, build id dicts (doc_ids, selected)."""
|
||||||
|
doc = self.document if doc is None else doc
|
||||||
|
id_list = list(self.options.ids)
|
||||||
|
for node in doc.getroot().iter(tag=etree.Element):
|
||||||
|
if 'id' in node.attrib:
|
||||||
|
node_id = node.get('id')
|
||||||
|
self.doc_ids[node_id] = 1
|
||||||
|
if node_id in id_list:
|
||||||
|
self.svg.selected[node_id] = node
|
||||||
|
id_list.remove(node_id)
|
||||||
|
|
||||||
|
def getselected(self):
|
||||||
|
"""Overload Effect() method."""
|
||||||
|
self.collect_ids()
|
||||||
|
|
||||||
|
def getdocids(self):
|
||||||
|
"""Overload Effect() method."""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
Incadiff().run()
|
21
extensions/fablabchemnitz/incadiff/meta.json
Normal file
21
extensions/fablabchemnitz/incadiff/meta.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "Incadiff",
|
||||||
|
"id": "fablabchemnitz.de.incadiff",
|
||||||
|
"path": "incadiff",
|
||||||
|
"dependent_extensions": null,
|
||||||
|
"original_name": "Incadiff",
|
||||||
|
"original_id": "org.incaya.incadiff",
|
||||||
|
"license": "GNU GPL v2",
|
||||||
|
"license_url": "https://github.com/incaya/incadiff/blob/main/LICENSE",
|
||||||
|
"comment": "",
|
||||||
|
"source_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.X/src/branch/master/extensions/fablabchemnitz/incadiff",
|
||||||
|
"fork_url": "https://github.com/incaya/incadiff",
|
||||||
|
"documentation_url": "https://stadtfabrikanten.org/display/IFM/Incadiff",
|
||||||
|
"inkscape_gallery_url": null,
|
||||||
|
"main_authors": [
|
||||||
|
"github.com/incaya",
|
||||||
|
"github.com/vmario89"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
@ -29,6 +29,8 @@ from lxml import etree
|
|||||||
from subprocess import Popen, PIPE
|
from subprocess import Popen, PIPE
|
||||||
import shutil
|
import shutil
|
||||||
from shutil import copy2
|
from shutil import copy2
|
||||||
|
import inkex.command
|
||||||
|
|
||||||
|
|
||||||
def contains_text(nodes):
|
def contains_text(nodes):
|
||||||
for node in nodes:
|
for node in nodes:
|
||||||
@ -39,22 +41,16 @@ def contains_text(nodes):
|
|||||||
|
|
||||||
def convert_objects_to_paths(file, document):
|
def convert_objects_to_paths(file, document):
|
||||||
tempfile = os.path.splitext(file)[0] + "-prepare.svg"
|
tempfile = os.path.splitext(file)[0] + "-prepare.svg"
|
||||||
# tempfile is needed here only because we want to force the extension to be .svg
|
|
||||||
# so that we can open and close it silently
|
|
||||||
copy2(file, tempfile)
|
copy2(file, tempfile)
|
||||||
|
actions_list = []
|
||||||
command = "inkscape " + tempfile + ' --actions="EditSelectAllInAllLayers;EditUnlinkClone;ObjectToPath;FileSave;FileQuit"'
|
actions_list.append("select-all")
|
||||||
|
actions_list.append("clone-unlink-recursive")
|
||||||
if shutil.which('xvfb-run'):
|
actions_list.append("object-to-path")
|
||||||
command = 'xvfb-run -a ' + command
|
actions = ";".join(actions_list)
|
||||||
|
cli_output = inkex.command.inkscape(tempfile, "--export-overwrite", actions=actions)
|
||||||
p = Popen(command, shell=True, stdout=PIPE, stderr=PIPE)
|
if len(cli_output) > 0:
|
||||||
(out, err) = p.communicate()
|
self.msg("Inkscape returned the following output when trying to run the file export; the file export may still have worked:")
|
||||||
|
self.msg(cli_output)
|
||||||
if p.returncode != 0:
|
|
||||||
inkex.errormsg("Failed to convert objects to paths. Continued without converting.")
|
|
||||||
inkex.errormsg(out)
|
|
||||||
inkex.errormsg(err)
|
|
||||||
return document.getroot()
|
return document.getroot()
|
||||||
else:
|
else:
|
||||||
return etree.parse(tempfile).getroot()
|
return etree.parse(tempfile).getroot()
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
|
||||||
<svg xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:cc="http://creativecommons.org/ns#" xmlns:ccOLD="http://web.resource.org/cc/" xmlns:svg="http://www.w3.org/2000/svg" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
||||||
<defs>
|
|
||||||
<linearGradient id="test">
|
|
||||||
<stop id="stop00" offset="0.0" style="stop-color:#cc20c1;stop-opacity:1.0"/>
|
|
||||||
<stop id="stop01" offset="1.0" style="stop-color:#cc20c1;stop-opacity:0.0"/>
|
|
||||||
</linearGradient>
|
|
||||||
<linearGradient id="test">
|
|
||||||
<stop id="stop10" offset="0.0" style="stop-color:#cc20c1;stop-opacity:1.0"/>
|
|
||||||
<stop id="stop11" offset="1.0" style="stop-color:#cc20c1;stop-opacity:0.0"/>
|
|
||||||
</linearGradient>
|
|
||||||
<linearGradient id="test">
|
|
||||||
<stop id="stop20" offset="0.0" style="stop-color:#cc20c1;stop-opacity:1.0"/>
|
|
||||||
<stop id="stop21" offset="1.0" style="stop-color:#cc20c1;stop-opacity:0.0"/>
|
|
||||||
</linearGradient>
|
|
||||||
</defs>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 1.1 KiB |
@ -67,7 +67,7 @@
|
|||||||
<page name="tab_about" gui-text="About">
|
<page name="tab_about" gui-text="About">
|
||||||
<label appearance="header">Paperfold for Inkscape</label>
|
<label appearance="header">Paperfold for Inkscape</label>
|
||||||
<label>Paperfold is another flattener for triangle mesh files, heavily based on paperfoldmodels by Felix Scholz aka felixfeliz. Possible input files are STL, Wavefront OBJ, PLY and OFF.</label>
|
<label>Paperfold is another flattener for triangle mesh files, heavily based on paperfoldmodels by Felix Scholz aka felixfeliz. Possible input files are STL, Wavefront OBJ, PLY and OFF.</label>
|
||||||
<label>2020 - 2021 / written by Mario Voigt (Stadtfabrikanten e.V. / FabLab Chemnitz)</label>
|
<label>2020 - 2022 / written by Mario Voigt (Stadtfabrikanten e.V. / FabLab Chemnitz)</label>
|
||||||
<spacer/>
|
<spacer/>
|
||||||
<label appearance="header">Online Documentation</label>
|
<label appearance="header">Online Documentation</label>
|
||||||
<label appearance="url">https://y.stadtfabrikanten.org/paperfold</label>
|
<label appearance="url">https://y.stadtfabrikanten.org/paperfold</label>
|
||||||
|
21
extensions/fablabchemnitz/slic3r_stl_input/meta.json
Normal file
21
extensions/fablabchemnitz/slic3r_stl_input/meta.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "Slic3r STL Input",
|
||||||
|
"id": "fablabchemnitz.de.slic3r_stl_input",
|
||||||
|
"path": "slic3r_stl_input",
|
||||||
|
"dependent_extensions": null,
|
||||||
|
"original_name": "STL Input",
|
||||||
|
"original_id": "com.github.jnweiger.inkscape.input.stl",
|
||||||
|
"license": "GNU GPL v2",
|
||||||
|
"license_url": "https://github.com/jnweiger/inkscape-input-stl/blob/master/LICENSE",
|
||||||
|
"comment": "",
|
||||||
|
"source_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.X/src/branch/master/extensions/fablabchemnitz/slic3r_stl_input",
|
||||||
|
"fork_url": "https://github.com/jnweiger/inkscape-input-stl",
|
||||||
|
"documentation_url": "https://stadtfabrikanten.org/display/IFM/Slic3r+STL+Input",
|
||||||
|
"inkscape_gallery_url": "https://inkscape.org/de/~MarioVoigt/%E2%98%85slic3r-stl-input",
|
||||||
|
"main_authors": [
|
||||||
|
"github.com/jnweiger",
|
||||||
|
"github.com/vmario89"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
132
extensions/fablabchemnitz/slic3r_stl_input/slic3r_stl_input.inx
Normal file
132
extensions/fablabchemnitz/slic3r_stl_input/slic3r_stl_input.inx
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||||
|
<name>Slic3r STL Input</name>
|
||||||
|
<id>fablabchemnitz.de.slic3r_stl_input</id>
|
||||||
|
<param name="tab" type="notebook">
|
||||||
|
<page name="tab_options" gui-text="Options">
|
||||||
|
<label appearance="header">Processor</label>
|
||||||
|
<param name="slic3r_cmd" type="path" mode="file" gui-text="Slic3r-1.3.1-dev command">/path/to/slic3r/v1.3.1-dev</param>
|
||||||
|
<label appearance="header">Input</label>
|
||||||
|
<param name="inputfile" type="path" gui-text="Input file (OBJ/OFF/PLY/STL)" filetypes="obj,off,ply,stl" mode="file">/your/object/file.stl</param>
|
||||||
|
<param name="max_num_faces" type="int" min="1" max="99999" gui-text="Maximum allowed faces" gui-description="If the STL file has too much detail it contains a large number of faces. This will make processing extremely slow. So we can limit it.">200</param>
|
||||||
|
<param name="layer_height" type="float" min="0.001" max="99999.000" precision="3" gui-text="Layer height [mm]">1.000</param>
|
||||||
|
<param name="layer_number" type="int" min="-99999" max="99999" gui-text="Specific layer number" gui-description="Set to 0 to import all numbers or set a number + or - to import a specific layer. Negative values will invert (count backwards)">0</param>
|
||||||
|
<hbox>
|
||||||
|
<vbox>
|
||||||
|
<label appearance="header">Transforms</label>
|
||||||
|
<param name="scalefactor" type="float" precision="3" min="0.0001" max="10000.0" gui-text="Manual scale factor" gui-description="default is 1.0">1.0</param>
|
||||||
|
<param name="rx" type="float" precision="1" min="-360.0" max="360.0" gui-text="3D-Rotate X-Axis [deg]">0.0</param>
|
||||||
|
<param name="ry" type="float" precision="1" min="-360.0" max="360.0" gui-text="3D-Rotate Y-Axis [deg]">0.0</param>
|
||||||
|
<param name="rz" type="float" precision="1" min="-360.0" max="360.0" gui-text="3D-Rotate Z-Axis [deg]">0.0</param>
|
||||||
|
<param name="mirrorx" type="bool" gui-text="Mirror X">false</param>
|
||||||
|
<param name="mirrory" type="bool" gui-text="Mirror Y">false</param>
|
||||||
|
</vbox>
|
||||||
|
<separator />
|
||||||
|
<vbox>
|
||||||
|
<label appearance="header">Output</label>
|
||||||
|
<param name="resizetoimport" type="bool" gui-text="Resize canvas" gui-description="Resize the canvas to the imported drawing's bounding box">true</param>
|
||||||
|
<param name="extraborder" type="float" precision="3" gui-text="Extra border" gui-description="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="numbers" type="bool" gui-text="Add layer numbers">false</param>
|
||||||
|
<param name="center" type="bool" gui-text="Add center marks">false</param>
|
||||||
|
</vbox>
|
||||||
|
</hbox>
|
||||||
|
</page>
|
||||||
|
<page name="tab_style" gui-text="Style">
|
||||||
|
<hbox>
|
||||||
|
<vbox>
|
||||||
|
<label appearance="header">Fill Style</label>
|
||||||
|
<param name="use_fill_color" type="bool" gui-text="Use fill color">false</param>
|
||||||
|
<param name="fill_color" type="color" appearance="colorbutton" gui-text="Fill color">1943148287</param>
|
||||||
|
<param name="min_fill_opacity" type="float" precision="3" min="0.000" max="1.000" gui-text="Min fill opacity">0.0</param>
|
||||||
|
<param name="max_fill_opacity" type="float" precision="3" min="0.000" max="1.000" gui-text="Max fill opacity">1.0</param>
|
||||||
|
<label>Per Layer Settings</label>
|
||||||
|
<param name="diffuse_fill_opacity" type="optiongroup" appearance="combo" gui-text="Diffuse fill opacity">
|
||||||
|
<option value="no_diffuse">no diffuse (use max. opacity)</option>
|
||||||
|
<option value="front_to_back">front to back</option>
|
||||||
|
<option value="back_to_front">back to front</option>
|
||||||
|
</param>
|
||||||
|
<separator/>
|
||||||
|
<label appearance="header">Stroke Color</label>
|
||||||
|
<param name="use_stroke_color" type="bool" gui-text="Use stroke color">true</param>
|
||||||
|
<param name="stroke_color" type="color" appearance="colorbutton" gui-text="Stroke color">879076607</param>
|
||||||
|
</vbox>
|
||||||
|
<separator/>
|
||||||
|
<vbox>
|
||||||
|
<label appearance="header">Stroke Width</label>
|
||||||
|
<param name="stroke_units" type="optiongroup" appearance="combo" gui-text="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>
|
||||||
|
<option value="hairline">hairline</option>
|
||||||
|
</param>
|
||||||
|
<param name="min_stroke_width" type="float" precision="3" min="0.000" max="1000.000" gui-text="Min stroke width">1.0</param>
|
||||||
|
<param name="max_stroke_width" type="float" precision="3" min="0.000" max="1000.000" gui-text="Max stroke width">1.0</param>
|
||||||
|
<label>Per Layer Settings</label>
|
||||||
|
<param name="diffuse_stroke_width" type="optiongroup" appearance="combo" gui-text="Diffuse stroke width">
|
||||||
|
<option value="no_diffuse">no diffuse (use max. width)</option>
|
||||||
|
<option value="front_to_back">front to back</option>
|
||||||
|
<option value="back_to_front">back to front</option>
|
||||||
|
</param>
|
||||||
|
<label appearance="header">Stroke Opacity</label>
|
||||||
|
<param name="min_stroke_opacity" type="float" precision="3" min="0.000" max="1.000" gui-text="Min stroke opacity">0.0</param>
|
||||||
|
<param name="max_stroke_opacity" type="float" precision="3" min="0.000" max="1.000" gui-text="Max stroke opacity">1.0</param>
|
||||||
|
<label>Per Layer Settings</label>
|
||||||
|
<param name="diffuse_stroke_opacity" type="optiongroup" appearance="combo" gui-text="Diffuse stroke opacity">
|
||||||
|
<option value="no_diffuse">no diffuse (use max. opacity)</option>
|
||||||
|
<option value="front_to_back">front to back</option>
|
||||||
|
<option value="back_to_front">back to front</option>
|
||||||
|
</param>
|
||||||
|
</vbox>
|
||||||
|
</hbox>
|
||||||
|
</page>
|
||||||
|
<page name="tab_about" gui-text="About">
|
||||||
|
<label appearance="header">Slic3r STL Input</label>
|
||||||
|
<label>This extension is highly based on the work of Jürgen Weigert. It projects an STL file on the X-Y plane by cutting the objects into "slices". Each "slice" is a group of polygons, with a label indicating it's z position. The polygons are converted to paths for better editing in inkscape. Use Object -> Rows & Columns to distribute the slices in a grid. Possible input files are STL, Wavefront OBJ, PLY and OFF.</label>
|
||||||
|
<label>2021 / written by Mario Voigt (Stadtfabrikanten e.V. / FabLab Chemnitz)</label>
|
||||||
|
<spacer />
|
||||||
|
<label appearance="header">Online Documentation</label>
|
||||||
|
<label appearance="url">https://y.stadtfabrikanten.org/slic3rstlinput</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://slic3r.org/download</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>
|
||||||
|
<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">slic3r_stl_input.py</command>
|
||||||
|
</script>
|
||||||
|
</inkscape-extension>
|
390
extensions/fablabchemnitz/slic3r_stl_input/slic3r_stl_input.py
Normal file
390
extensions/fablabchemnitz/slic3r_stl_input/slic3r_stl_input.py
Normal file
@ -0,0 +1,390 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
'''
|
||||||
|
(C) 2018 Juergen Weigert <juergen@fabmail.org>, distribute under GPLv2 or ask
|
||||||
|
|
||||||
|
This is an input extension for inkscape to read STL files.
|
||||||
|
|
||||||
|
Requires: (python-lxml | python3-lxml), slic3r
|
||||||
|
For optional(!) rotation support:
|
||||||
|
Requires: (python-numpy-stl | python3-numpy-stl)
|
||||||
|
If you get ImportError: cannot import name 'mesh'
|
||||||
|
although an stl module is installed, then you have the wrong stl module.
|
||||||
|
Try 'pip3 uninstall stl; pip3 install numpy-stl'
|
||||||
|
|
||||||
|
2018-12-22 jw, v0.1 Initial draught
|
||||||
|
v0.1 First working standalone tool.
|
||||||
|
2018-12-26 jw, v0.3 Mesh rotation support via numpy-stl. Fully optional.
|
||||||
|
v0.4 Works fine as an inkscape input extension under Linux.
|
||||||
|
2019-03-01 jw, v0.5 numbers and center option added.
|
||||||
|
2019-07-17 jw, v0.6 fixed ry rotation.
|
||||||
|
|
||||||
|
2021-05-14 - Mario Voigt:
|
||||||
|
- changed extension to support ply,off,obj,stl by using OpenMesh
|
||||||
|
- moved extension to sub menu structure (allows preview)
|
||||||
|
- added different options
|
||||||
|
|
||||||
|
#Notes
|
||||||
|
* requires exactly Slic3r-1.3.1-dev
|
||||||
|
-> https://dl.slic3r.org/dev/linux/
|
||||||
|
-> https://dl.slic3r.org/dev/win/
|
||||||
|
* Notes to other Slic3r forks
|
||||||
|
* does not work with Slic3r PE (Prusa Edition) (no export-svg option)
|
||||||
|
* does not work with PrusaSlicer (no export-svg option)
|
||||||
|
* does not work with IceSL slicer (https://icesl.loria.fr; no command line options)
|
||||||
|
|
||||||
|
#ToDos
|
||||||
|
* add some algorithm to handle fill for alternating paths. Issue at the moment: Imagine a char "A" in 3D.
|
||||||
|
It conatains an outline and a line path. Because those two paths are not combined both get filled but they do not render the char A correctly
|
||||||
|
|
||||||
|
'''
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import subprocess
|
||||||
|
from lxml import etree
|
||||||
|
from subprocess import Popen, PIPE
|
||||||
|
import inkex
|
||||||
|
from inkex import Color, Transform
|
||||||
|
import tempfile
|
||||||
|
import openmesh as om
|
||||||
|
|
||||||
|
|
||||||
|
sys_platform = sys.platform.lower()
|
||||||
|
if sys_platform.startswith('win'):
|
||||||
|
slic3r = 'slic3r-console.exe'
|
||||||
|
elif sys_platform.startswith('darwin'):
|
||||||
|
slic3r = 'slic3r'
|
||||||
|
else: # Linux
|
||||||
|
slic3r = os.environ['HOME']+ '/Downloads/Slic3r-1.3.1-dev-x86_64.AppImage'
|
||||||
|
if not os.path.exists(slic3r):
|
||||||
|
slic3r = 'slic3r'
|
||||||
|
|
||||||
|
class SlicerSTLInput(inkex.EffectExtension):
|
||||||
|
|
||||||
|
def add_arguments(self, pars):
|
||||||
|
pars.add_argument('--tab')
|
||||||
|
|
||||||
|
#Processor
|
||||||
|
pars.add_argument('--slic3r_cmd', default="slic3r", help="Command to invoke slic3r.")
|
||||||
|
|
||||||
|
#Input
|
||||||
|
pars.add_argument('--inputfile', help='Input file (OBJ/OFF/PLY/STL)')
|
||||||
|
pars.add_argument('--scalefactor', type=float, default=1.0, help='Scale the model to custom size')
|
||||||
|
pars.add_argument("--max_num_faces", type=int, default=200, help="If the STL file has too much detail it contains a large number of faces. This will make processing extremely slow. So we can limit it.")
|
||||||
|
pars.add_argument('--layer_height', type=float, default=1.000, help='slic3r layer height, probably in mm. Default: per slic3r config')
|
||||||
|
pars.add_argument('--layer_number', type=int, default=0, help='Specific layer number')
|
||||||
|
|
||||||
|
#Transforms
|
||||||
|
pars.add_argument('--rx', type=float, default=None, help='Rotate STL object around X-Axis before importing.')
|
||||||
|
pars.add_argument('--ry', type=float, default=None, help='Rotate STL object around Y-Axis before importing.')
|
||||||
|
pars.add_argument('--rz', type=float, default=None, help='Rotate STL object around Z-Axis before importing.')
|
||||||
|
pars.add_argument('--mirrorx', type=inkex.Boolean, default=False, help='Mirror X')
|
||||||
|
pars.add_argument('--mirrory', type=inkex.Boolean, default=False, help='Mirror Y')
|
||||||
|
|
||||||
|
#Output
|
||||||
|
pars.add_argument('--numbers', type=inkex.Boolean, default=False, help='Add layer numbers.')
|
||||||
|
pars.add_argument('--center', type=inkex.Boolean, default=False, help='Add center marks.')
|
||||||
|
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")
|
||||||
|
|
||||||
|
#Style
|
||||||
|
pars.add_argument("--use_fill_color", type=inkex.Boolean, default=False, help="Use fill color")
|
||||||
|
pars.add_argument("--fill_color", type=Color, default='1943148287', help="Fill color")
|
||||||
|
pars.add_argument("--min_fill_opacity", type=float, default=0.0, help="Min fill opacity")
|
||||||
|
pars.add_argument("--max_fill_opacity", type=float, default=1.0, help="Max fill opacity")
|
||||||
|
pars.add_argument("--diffuse_fill_opacity", default="regular", help="Diffuse fill opacity per layer")
|
||||||
|
|
||||||
|
pars.add_argument("--use_stroke_color", type=inkex.Boolean, default=True, help="Use stroke color")
|
||||||
|
pars.add_argument('--stroke_color', type=Color, default='879076607', help="Stroke color")
|
||||||
|
|
||||||
|
pars.add_argument("--stroke_units", default="mm", help="Stroke width units")
|
||||||
|
pars.add_argument("--min_stroke_width", type=float, default=1.0, help="Min stroke width")
|
||||||
|
pars.add_argument("--max_stroke_width", type=float, default=1.0, help="Max stroke width")
|
||||||
|
pars.add_argument("--diffuse_stroke_width", default="regular", help="Diffuse stroke width per layer")
|
||||||
|
|
||||||
|
pars.add_argument("--min_stroke_opacity", type=float, default=0.0, help="Min stroke opacity")
|
||||||
|
pars.add_argument("--max_stroke_opacity", type=float, default=1.0, help="Max stroke opacity")
|
||||||
|
pars.add_argument("--diffuse_stroke_opacity", default="regular", help="Diffuse stroke opacity per layer")
|
||||||
|
|
||||||
|
def effect(self):
|
||||||
|
args = self.options
|
||||||
|
|
||||||
|
if not os.path.exists(args.slic3r_cmd):
|
||||||
|
inkex.utils.debug("Slic3r not found. Please define a correct location.")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
if args.min_fill_opacity > args.max_fill_opacity:
|
||||||
|
inkex.utils.debug("Min fill opacity may not be larger than max fill opacity. Adjust and try again!")
|
||||||
|
exit(1)
|
||||||
|
if args.min_stroke_width > args.max_stroke_width:
|
||||||
|
inkex.utils.debug("Min stroke width may not be larger than max stroke width. Adjust and try again!")
|
||||||
|
exit(1)
|
||||||
|
if args.min_stroke_opacity > args.max_stroke_opacity:
|
||||||
|
inkex.utils.debug("Min stroke opacity may not be larger than max stroke opacity. Adjust and try again!")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
#############################################
|
||||||
|
# test slic3r command
|
||||||
|
#############################################
|
||||||
|
if sys_platform.startswith('win'):
|
||||||
|
# assert we run the commandline version of slic3r
|
||||||
|
args.slic3r_cmd = re.sub('slic3r(\.exe)?$', 'slic3r-console.exe', args.slic3r_cmd, flags=re.I)
|
||||||
|
cmd = [args.slic3r_cmd, '--version']
|
||||||
|
try:
|
||||||
|
proc = subprocess.Popen(cmd, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
except OSError as e:
|
||||||
|
hint="Maybe use --slic3r-cmd option?"
|
||||||
|
inkex.utils.debug("{0}\nCommand failed: errno={1} {2}\n\n{3}".format(' '.join(cmd), e.errno, e.strerror, hint), file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
stdout, stderr = proc.communicate()
|
||||||
|
|
||||||
|
#############################################
|
||||||
|
# prepare STL input (also accept and convert obj, stl, ply, off)
|
||||||
|
#############################################
|
||||||
|
outputfilebase = os.path.splitext(os.path.basename(args.inputfile))[0]
|
||||||
|
converted_inputfile = os.path.join(tempfile.gettempdir(), outputfilebase + ".stl")
|
||||||
|
if not os.path.exists(args.inputfile):
|
||||||
|
inkex.utils.debug("The input file does not exist.")
|
||||||
|
exit(1)
|
||||||
|
input_mesh = om.read_trimesh(args.inputfile)
|
||||||
|
if input_mesh.n_faces() > args.max_num_faces:
|
||||||
|
inkex.utils.debug("Aborted. Target STL file has " + str(input_mesh.n_faces()) + " faces, but only " + str(args.max_num_faces) + " are allowed.")
|
||||||
|
exit(1)
|
||||||
|
om.write_mesh(converted_inputfile, input_mesh) #read + convert, might throw errors; warning. output is ASCII but cannot controlled to be set to binary because om.Options() is not available in python binding yet
|
||||||
|
if not os.path.exists(converted_inputfile):
|
||||||
|
inkex.utils.debug("The converted input file does not exist.")
|
||||||
|
exit(1)
|
||||||
|
args.inputfile = converted_inputfile #overwrite
|
||||||
|
|
||||||
|
#############################################
|
||||||
|
# create the layer slices
|
||||||
|
#############################################
|
||||||
|
svgfile = re.sub('\.stl', '.svg', args.inputfile, flags=re.IGNORECASE)
|
||||||
|
# option --layer-height does not work. We use --scale instead...
|
||||||
|
scale = 1.0 / args.layer_height
|
||||||
|
cmd = [
|
||||||
|
args.slic3r_cmd,
|
||||||
|
'--no-gui',
|
||||||
|
'--scale', str(scale),
|
||||||
|
'--rotate-x', str(args.rx),
|
||||||
|
'--rotate-y', str(180+args.ry), #we import the style like PrusaSlicer would import on the plate
|
||||||
|
'--rotate', str(args.rz),
|
||||||
|
'--first-layer-height', '0.1mm',
|
||||||
|
'--export-svg', '-o', svgfile, args.inputfile]
|
||||||
|
|
||||||
|
def scale_points(pts, scale):
|
||||||
|
""" str='276.422496,309.4 260.209984,309.4 260.209984,209.03 276.422496,209.03' """
|
||||||
|
return re.sub('\d*\.\d*', lambda x: str(float(x.group(0))*scale), pts)
|
||||||
|
|
||||||
|
def bbox_info(slic3r, file):
|
||||||
|
cmd = [ slic3r, '--no-gui', '--info', file ]
|
||||||
|
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
|
||||||
|
out, err = p.communicate()
|
||||||
|
if len(err) > 0:
|
||||||
|
raise ValueError(err)
|
||||||
|
|
||||||
|
bb = {}
|
||||||
|
for l in out.decode().split("\n"):
|
||||||
|
m = re.match('((min|max)_[xyz])\s*=\s*(.*)', l)
|
||||||
|
if m: bb[m.group(1)] = float(m.group(3))
|
||||||
|
if (len(bb) != 6):
|
||||||
|
raise ValueError("slic3r --info did not return 6 elements for bbox")
|
||||||
|
return bb
|
||||||
|
|
||||||
|
if args.center is True:
|
||||||
|
bb = bbox_info(args.slic3r_cmd, args.inputfile)
|
||||||
|
# Ouch: bbox info gives us stl coordinates. slic3r translates them into svg px using 75dpi.
|
||||||
|
cx = (-bb['min_x'] + bb['max_x']) * 0.5 * 1/scale * 25.4 / 75
|
||||||
|
cy = (-bb['min_y'] + bb['max_y']) * 0.5 * 1/scale * 25.4 / 75
|
||||||
|
|
||||||
|
try:
|
||||||
|
proc = subprocess.Popen(cmd, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
except OSError as e:
|
||||||
|
raise OSError("{0}\nCommand failed: errno={1} {2}".format(' '.join(cmd), e.errno, e.strerror))
|
||||||
|
stdout, stderr = proc.communicate()
|
||||||
|
|
||||||
|
if not b'Done.' in stdout:
|
||||||
|
inkex.utils.debug("Command failed: {0}".format(' '.join(cmd)))
|
||||||
|
inkex.utils.debug("OUT: " + str(stdout))
|
||||||
|
inkex.utils.debug("ERR: " + str(stderr))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# slic3r produces correct svg files, but with polygons instead of paths, and with undefined strokes.
|
||||||
|
# When opened with inkscape, most lines are invisible and polygons cannot be edited.
|
||||||
|
# To fix these issues, we postprocess the svg file:
|
||||||
|
# * replace polygon nodes with corresponding path nodes.
|
||||||
|
# * replace style attribute in polygon nodes with one that has a black stroke
|
||||||
|
|
||||||
|
stream = open(svgfile, 'r')
|
||||||
|
p = etree.XMLParser(huge_tree=True)
|
||||||
|
doc = etree.parse(stream, parser=p)
|
||||||
|
stream.close()
|
||||||
|
|
||||||
|
## To change the document units to mm, insert directly after the root node:
|
||||||
|
# e.tag = '{http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd}namedview'
|
||||||
|
# e.attrib['id'] = "base"
|
||||||
|
# e.attrib['{http://www.inkscape.org/namespaces/inkscape}document-units'] = "mm"
|
||||||
|
|
||||||
|
totalPolygoncount = 0
|
||||||
|
for e in doc.iterfind('//{*}polygon'):
|
||||||
|
totalPolygoncount += 1
|
||||||
|
|
||||||
|
polygoncount = 0
|
||||||
|
|
||||||
|
if args.use_fill_color is False:
|
||||||
|
fill = "none"
|
||||||
|
else:
|
||||||
|
fill = args.fill_color
|
||||||
|
|
||||||
|
for e in doc.iterfind('//{*}polygon'):
|
||||||
|
polygoncount += 1
|
||||||
|
if args.diffuse_fill_opacity == "front_to_back":
|
||||||
|
fill_opacity = (args.max_fill_opacity - (polygoncount / totalPolygoncount) * (args.max_fill_opacity - args.min_fill_opacity)) + args.min_fill_opacity
|
||||||
|
elif args.diffuse_fill_opacity == "back_to_front":
|
||||||
|
fill_opacity = ((polygoncount / totalPolygoncount) * (args.max_fill_opacity - args.min_fill_opacity)) + args.min_fill_opacity
|
||||||
|
elif args.diffuse_fill_opacity == "no_diffuse":
|
||||||
|
fill_opacity = args.max_fill_opacity
|
||||||
|
else:
|
||||||
|
inkex.utils.debug("Error: unkown diffuse fill opacity option")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
if args.diffuse_stroke_width == "front_to_back":
|
||||||
|
stroke_width = (args.max_stroke_width - (polygoncount / totalPolygoncount) * (args.max_stroke_width - args.min_stroke_width)) + args.min_stroke_width
|
||||||
|
elif args.diffuse_stroke_width == "back_to_front":
|
||||||
|
stroke_width = ((polygoncount / totalPolygoncount) * (args.max_stroke_width - args.min_stroke_width)) + args.min_stroke_width
|
||||||
|
elif args.diffuse_stroke_width == "no_diffuse":
|
||||||
|
stroke_width = args.max_stroke_width
|
||||||
|
else:
|
||||||
|
inkex.utils.debug("Error: unkown diffuse stroke width option")
|
||||||
|
exit(1)
|
||||||
|
if self.options.stroke_units != "hairline":
|
||||||
|
stroke_width = self.svg.unittouu(str(stroke_width) + self.options.stroke_units)
|
||||||
|
|
||||||
|
if args.diffuse_stroke_opacity == "front_to_back":
|
||||||
|
stroke_opacity = (args.max_stroke_opacity - (polygoncount / totalPolygoncount) * (args.max_stroke_opacity - args.min_stroke_opacity)) + args.min_stroke_opacity
|
||||||
|
elif args.diffuse_stroke_opacity == "back_to_front":
|
||||||
|
stroke_opacity = ((polygoncount / totalPolygoncount) * (args.max_stroke_opacity - args.min_stroke_opacity)) + args.min_stroke_opacity
|
||||||
|
elif args.diffuse_stroke_opacity == "no_diffuse":
|
||||||
|
stroke_opacity = args.max_stroke_opacity
|
||||||
|
else:
|
||||||
|
inkex.utils.debug("Error: unkown diffuse stroke opacity option")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
if args.use_stroke_color is False:
|
||||||
|
stroke = ""
|
||||||
|
else:
|
||||||
|
stroke = "stroke:{}".format(args.stroke_color)
|
||||||
|
# e.tag = '{http://www.w3.org/2000/svg}polygon'
|
||||||
|
# e.attrib = {'{http://slic3r.org/namespaces/slic3r}type': 'contour', 'points': '276.422496,309.4 260.209984,309.4 260.209984,209.03 276.422496,209.03', 'style': 'fill: white'}
|
||||||
|
e.tag = re.sub('polygon$', 'path', e.tag)
|
||||||
|
e.attrib['id'] = 'polygon%d' % polygoncount
|
||||||
|
e.attrib['{http://www.inkscape.org/namespaces/inkscape}connector-curvature'] = '0'
|
||||||
|
e.attrib['style'] = 'fill:{};fill-opacity:{};{};stroke-opacity:{};stroke-width:{}'.format(fill, fill_opacity, stroke, stroke_opacity, stroke_width)
|
||||||
|
if self.options.stroke_units == "hairline":
|
||||||
|
e.attrib['style'] = e.attrib.get('style') + ";vector-effect:non-scaling-stroke;-inkscape-stroke:hairline;"
|
||||||
|
e.attrib['d'] = 'M ' + re.sub(' ', ' L ', scale_points(e.attrib['points'], 1/scale)) + ' Z'
|
||||||
|
|
||||||
|
if args.mirrorx is True:
|
||||||
|
mx = -1
|
||||||
|
else:
|
||||||
|
mx = +1
|
||||||
|
if args.mirrory is True:
|
||||||
|
my = -1
|
||||||
|
else:
|
||||||
|
my = +1
|
||||||
|
|
||||||
|
if args.mirrorx is True or args.mirrory is True:
|
||||||
|
e.attrib['transform'] = 'scale({},{})'.format(mx, my)
|
||||||
|
del e.attrib['points']
|
||||||
|
if e.attrib.get('{http://slic3r.org/namespaces/slic3r}type') == 'contour':
|
||||||
|
# remove contour, but keep all slic3r:type='hole', whatever it is worth later.
|
||||||
|
del e.attrib['{http://slic3r.org/namespaces/slic3r}type']
|
||||||
|
|
||||||
|
layercount = 0
|
||||||
|
for e in doc.iterfind('//{*}g'):
|
||||||
|
if e.attrib['{http://slic3r.org/namespaces/slic3r}z'] and e.attrib['id']:
|
||||||
|
layercount+=1
|
||||||
|
e.attrib['{http://www.inkscape.org/namespaces/inkscape}label'] = \
|
||||||
|
e.attrib['id'] \
|
||||||
|
+ " slic3r:z={}mm".format(round(float(e.attrib['{http://slic3r.org/namespaces/slic3r}z']),3))
|
||||||
|
del e.attrib['{http://slic3r.org/namespaces/slic3r}z']
|
||||||
|
e.attrib['id'] = "stl-layer{}".format(layercount)
|
||||||
|
# for some fun with our inkscape-paths2openscad extension, add sibling to e:
|
||||||
|
# <svg:desc id="descpoly60">Depth: 1mm\nOffset: 31mm</svg:desc>
|
||||||
|
desc = etree.Element('{http://www.w3.org/2000/svg}desc')
|
||||||
|
desc.attrib['id'] = 'descl'+str(layercount)
|
||||||
|
desc.text = "Depth: %.2fmm\nRaise: %.2fmm\n" % (1/scale, layercount/scale)
|
||||||
|
e.append(desc)
|
||||||
|
if args.numbers is True:
|
||||||
|
num = etree.Element('{http://www.w3.org/2000/svg}text')
|
||||||
|
num.attrib['id'] = 'textnum'+str(layercount)
|
||||||
|
num.attrib['x'] = str(layercount*2)
|
||||||
|
num.attrib['y'] = str(layercount*4+10)
|
||||||
|
num.attrib['style'] = 'fill:#00FF00;fill-opacity:1;stroke:#00FF00;font-family:FreeSans;font-size:10pt;stroke-opacity:1;stroke-width:0.1'
|
||||||
|
num.text = "%d" % layercount
|
||||||
|
e.append(num)
|
||||||
|
if args.center is True:
|
||||||
|
cc = etree.Element('{http://www.w3.org/2000/svg}path')
|
||||||
|
cc.attrib['id'] = 'ccross'+str(layercount)
|
||||||
|
cc.attrib['style'] = 'fill:none;fill-opacity:1;stroke:#0000FF;font-family:FreeSans;font-size:10pt;stroke-opacity:1;stroke-width:0.1'
|
||||||
|
cc.attrib['d'] = 'M %s,%s v 10 M %s,%s h 10 M %s,%s h 4' % (cx, cy-5, cx-5, cy, cx-2, cy+5)
|
||||||
|
e.append(cc)
|
||||||
|
|
||||||
|
etree.cleanup_namespaces(doc.getroot(), top_nsmap={
|
||||||
|
'inkscape': 'http://www.inkscape.org/namespaces/inkscape',
|
||||||
|
'sodipodi': 'http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'})
|
||||||
|
|
||||||
|
#inkex.utils.debug("{0}: {1} polygons in {2} layers converted to paths.".format(svgfile, polygoncount, layercount))
|
||||||
|
|
||||||
|
if self.options.layer_number != 0:
|
||||||
|
groups = doc.xpath("//svg:g", namespaces=inkex.NSS)
|
||||||
|
for element in groups:
|
||||||
|
#for element in doc.getroot().iter("{http://www.w3.org/2000/svg}g"):
|
||||||
|
if self.options.layer_number > 0:
|
||||||
|
if element.get('id').split('stl-layer')[1] != str(self.options.layer_number):
|
||||||
|
element.getparent().remove(element) #element.delete() does not work. why?
|
||||||
|
else:
|
||||||
|
if element.get('id').split('stl-layer')[1] != str(len(groups) + self.options.layer_number):
|
||||||
|
element.getparent().remove(element) #element.delete() does not work. why?
|
||||||
|
if layercount == 0:
|
||||||
|
inkex.utils.debug("No layers imported. Try to lower your layer height")
|
||||||
|
exit(1)
|
||||||
|
#inkex.utils.debug(totalPolygoncount)
|
||||||
|
if totalPolygoncount == 0:
|
||||||
|
inkex.utils.debug("No polygons imported (empty groups). Try to lower your layer height")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
stl_group = inkex.Group(id=self.svg.get_unique_id("slic3r-stl-input-")) #make a new group at root level
|
||||||
|
stl_group.insert(0, inkex.Desc("Imported file: {}".format(self.options.inputfile)))
|
||||||
|
self.svg.get_current_layer().append(stl_group)
|
||||||
|
|
||||||
|
for element in doc.getroot().iter("{http://www.w3.org/2000/svg}g"):
|
||||||
|
stl_group.append(element)
|
||||||
|
|
||||||
|
#apply scale factor
|
||||||
|
translation_matrix = [[args.scalefactor, 0.0, 0.0], [0.0, args.scalefactor, 0.0]]
|
||||||
|
stl_group.transform = Transform(translation_matrix) @ stl_group.transform
|
||||||
|
|
||||||
|
#adjust canvas to the inserted unfolding
|
||||||
|
if args.resizetoimport:
|
||||||
|
#push some calculation of all bounding boxes. seems to refresh something in the background which makes the bbox calculation working at the bottom
|
||||||
|
for element in self.document.getroot().iter("*"):
|
||||||
|
try:
|
||||||
|
element.bounding_box()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
bbox = stl_group.bounding_box() #only works because we process bounding boxes previously. see top
|
||||||
|
if bbox is not None:
|
||||||
|
namedView = self.document.getroot().find(inkex.addNS('namedview', 'sodipodi'))
|
||||||
|
root = self.svg.getElement('//svg:svg');
|
||||||
|
offset = self.svg.unittouu(str(args.extraborder) + args.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', "{:0.6f}{}".format(bbox.width + 2 * offset, self.svg.unit))
|
||||||
|
root.set('height', "{:0.6f}{}".format(bbox.height + 2 * offset, self.svg.unit))
|
||||||
|
else:
|
||||||
|
inkex.utils.debug("Error resizing to canvas.")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
SlicerSTLInput().run()
|
@ -29,7 +29,7 @@
|
|||||||
<page name="tab_about" gui-text="About">
|
<page name="tab_about" gui-text="About">
|
||||||
<label appearance="header">Styles To Layers</label>
|
<label appearance="header">Styles To Layers</label>
|
||||||
<label>This extension will re-layer your selected items or the whole document according to their style values (stroke or fill). The filtering applies only to style attribute of the elements. It does not filter for stroke or fill if they are set separately (dedicated attributes). It will also NOT apply to svg:style classes. You can use the separate 'Cleanup Styles' extension to migrate these separated attributes into style attribute.</label>
|
<label>This extension will re-layer your selected items or the whole document according to their style values (stroke or fill). The filtering applies only to style attribute of the elements. It does not filter for stroke or fill if they are set separately (dedicated attributes). It will also NOT apply to svg:style classes. You can use the separate 'Cleanup Styles' extension to migrate these separated attributes into style attribute.</label>
|
||||||
<label>2020 - 2021 / written by Mario Voigt (Stadtfabrikanten e.V. / FabLab Chemnitz)</label>
|
<label>2020 - 2022 / written by Mario Voigt (Stadtfabrikanten e.V. / FabLab Chemnitz)</label>
|
||||||
<spacer/>
|
<spacer/>
|
||||||
<label appearance="header">Online Documentation</label>
|
<label appearance="header">Online Documentation</label>
|
||||||
<label appearance="url">https://y.stadtfabrikanten.org/stylestolayers</label>
|
<label appearance="url">https://y.stadtfabrikanten.org/stylestolayers</label>
|
||||||
|
@ -128,25 +128,7 @@ def which(program, extraPaths=[]):
|
|||||||
.format(repr(program), repr(pathlist), os.path.realpath(__file__)))
|
.format(repr(program), repr(pathlist), os.path.realpath(__file__)))
|
||||||
|
|
||||||
|
|
||||||
def inkscape_version():
|
|
||||||
"""Return Inkscape version number as float, e.g. version "0.92.4" --> return: float 0.92"""
|
|
||||||
version = subprocess.check_output([INKSCAPEBIN, "--version"], stderr=subprocess.DEVNULL).decode('ASCII', 'ignore')
|
|
||||||
assert version.startswith("Inkscape ")
|
|
||||||
match = re.match("Inkscape ([0-9]+\.[0-9]+).*", version)
|
|
||||||
assert match is not None
|
|
||||||
version_float = float(match.group(1))
|
|
||||||
return version_float
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Strip SVG to only contain selected elements, convert objects to paths, unlink clones
|
|
||||||
# Inkscape version: takes care of special cases where the selected objects depend on non-selected ones.
|
|
||||||
# Examples are linked clones, flowtext limited to a shape and linked flowtext boxes (overflow into the next box).
|
|
||||||
#
|
|
||||||
# Inkscape is called with certain "verbs" (gui actions) to do the required cleanup
|
|
||||||
# The idea is similar to http://bazaar.launchpad.net/~nikitakit/inkscape/svg2sif/view/head:/share/extensions/synfig_prepare.py#L181 , but more primitive - there is no need for more complicated preprocessing here
|
|
||||||
def stripSVG_inkscape(src, dest, elements):
|
def stripSVG_inkscape(src, dest, elements):
|
||||||
version = inkscape_version()
|
|
||||||
|
|
||||||
# create temporary file for opening with inkscape.
|
# create temporary file for opening with inkscape.
|
||||||
# delete this file later so that it will disappear from the "recently opened" list.
|
# delete this file later so that it will disappear from the "recently opened" list.
|
||||||
@ -156,89 +138,46 @@ def stripSVG_inkscape(src, dest, elements):
|
|||||||
import shutil
|
import shutil
|
||||||
shutil.copyfile(src, tmpfile)
|
shutil.copyfile(src, tmpfile)
|
||||||
|
|
||||||
|
# Inkscape 1.2 (released 2022)
|
||||||
|
# inkscape --export-overwrite --actions=action1;action2...
|
||||||
|
# (see inkscape --help, inkscape --action-list)
|
||||||
|
# (for debugging, you can look at the intermediate state by running inkscape --with-gui --actions=... my_filename.svg)
|
||||||
|
# Note that it is (almost?) impossible to find a sequence that works in all cases.
|
||||||
|
# Cases to consider:
|
||||||
|
# - selecting whole groups
|
||||||
|
# - selecting objects within a group
|
||||||
|
# - selecting across groups/layers (e.g., enter group, select something, then Shift-click to select things from other layers)
|
||||||
|
# Difficulties with Inkscape:
|
||||||
|
# - "invert selection" does not behave as expected in all these cases,
|
||||||
|
# for example if a group is selected then inverting can select the elements within.
|
||||||
|
# - Inkscape has a wonderful --export-id commandline switch, but it only works correctly with one ID
|
||||||
|
|
||||||
if version < 1:
|
# Solution:
|
||||||
# inkscape 0.92 long-term-support release. Will be in Linux distributions until 2025 or so
|
actions = ["unlock-all"]
|
||||||
# Selection commands: select items, invert selection, delete
|
if elements:
|
||||||
selection = []
|
# something was selected when calling the plugin.
|
||||||
for el in elements:
|
# -> Recreate that selection
|
||||||
selection += ["--select=" + el]
|
# - select objects
|
||||||
|
actions += ["select-by-id:" + ",".join(elements)]
|
||||||
if len(elements) > 0:
|
|
||||||
# selection += ["--verb=FitCanvasToSelection"] # TODO add a user configuration option whether to keep the page size (and by this the position relative to the page)
|
|
||||||
selection += ["--verb=EditInvertInAllLayers", "--verb=EditDelete"]
|
|
||||||
|
|
||||||
|
|
||||||
hidegui = ["--without-gui"]
|
|
||||||
|
|
||||||
# currently this only works with gui because of a bug in inkscape: https://bugs.launchpad.net/inkscape/+bug/843260
|
|
||||||
hidegui = []
|
|
||||||
|
|
||||||
command = [INKSCAPEBIN] + hidegui + [tmpfile, "--verb=UnlockAllInAllLayers", "--verb=UnhideAllInAllLayers"] + selection + ["--verb=EditSelectAllInAllLayers", "--verb=EditUnlinkClone", "--verb=ObjectToPath", "--verb=FileSave", "--verb=FileQuit"]
|
|
||||||
elif version < 1.2:
|
|
||||||
# Inkscape 1.0 (released ca 2020) or 1.1
|
|
||||||
# inkscape --select=... --verbs=...
|
|
||||||
# (see inkscape --help, inkscape --verb-list)
|
|
||||||
command = [INKSCAPEBIN, tmpfile, "--batch-process"]
|
|
||||||
verbs = ["ObjectToPath", "UnlockAllInAllLayers"]
|
|
||||||
if elements: # something is selected
|
|
||||||
# --select=object1,object2,object3,...
|
|
||||||
command += ["--select=" + ",".join(elements)]
|
|
||||||
else:
|
|
||||||
verbs += ["EditSelectAllInAllLayers"]
|
|
||||||
verbs += ["UnhideAllInAllLayers", "EditInvertInAllLayers", "EditDelete", "EditSelectAllInAllLayers", "EditUnlinkClone", "ObjectToPath", "FileSave"]
|
|
||||||
# --verb=action1;action2;...
|
|
||||||
command += ["--verb=" + ";".join(verbs)]
|
|
||||||
|
|
||||||
|
|
||||||
DEBUG = False
|
|
||||||
if DEBUG:
|
|
||||||
# Inkscape sometimes silently ignores wrong verbs, so we need to double-check that everything's right
|
|
||||||
for verb in verbs:
|
|
||||||
verb_list = [line.split(":")[0] for line in subprocess.check_output([INKSCAPEBIN, "--verb-list"], stderr=subprocess.DEVNULL).split("\n")]
|
|
||||||
if verb not in verb_list:
|
|
||||||
inkex.utils.debug("Inkscape does not have the verb '{}'. Please report this as a VisiCut bug.".format(verb))
|
|
||||||
else:
|
else:
|
||||||
# Inkscape 1.2 (released 2022)
|
# - select all
|
||||||
# inkscape --export-overwrite --actions=action1;action2...
|
actions += ["select-all:all"]
|
||||||
# (see inkscape --help, inkscape --action-list)
|
# - convert to path
|
||||||
# (for debugging, you can look at the intermediate state by running inkscape --with-gui --actions=... my_filename.svg)
|
actions += ["clone-unlink", "object-to-path"]
|
||||||
# Note that it is (almost?) impossible to find a sequence that works in all cases.
|
if elements:
|
||||||
# Cases to consider:
|
# ensure that only the selection is exported:
|
||||||
# - selecting whole groups
|
# - create group of selection
|
||||||
# - selecting objects within a group
|
actions += ["selection-group"]
|
||||||
# - selecting across groups/layers (e.g., enter group, select something, then Shift-click to select things from other layers)
|
# - set group ID to a known value. Use a pseudo-random value to avoid collisions
|
||||||
# Difficulties with Inkscape:
|
target_group_id = "TARGET-GROUP-" + "".join(random.sample(string.ascii_lowercase, 20))
|
||||||
# - "invert selection" does not behave as expected in all these cases,
|
actions += ["object-set-attribute:id," + target_group_id]
|
||||||
# for example if a group is selected then inverting can select the elements within.
|
# - set export options: use only the target group ID, nothing else
|
||||||
# - Inkscape has a wonderful --export-id commandline switch, but it only works correctly with one ID
|
actions += ["export-id-only:true", "export-id:" + target_group_id]
|
||||||
|
# - do export (keep position on page)
|
||||||
|
actions += ["export-area-page"]
|
||||||
|
|
||||||
# Solution:
|
command = [INKSCAPEBIN, tmpfile, "--export-overwrite", "--actions=" + ";".join(actions)]
|
||||||
actions = ["unlock-all"]
|
|
||||||
if elements:
|
|
||||||
# something was selected when calling the plugin.
|
|
||||||
# -> Recreate that selection
|
|
||||||
# - select objects
|
|
||||||
actions += ["select-by-id:" + ",".join(elements)]
|
|
||||||
else:
|
|
||||||
# - select all
|
|
||||||
actions += ["select-all:all"]
|
|
||||||
# - convert to path
|
|
||||||
actions += ["clone-unlink", "object-to-path"]
|
|
||||||
if elements:
|
|
||||||
# ensure that only the selection is exported:
|
|
||||||
# - create group of selection
|
|
||||||
actions += ["selection-group"]
|
|
||||||
# - set group ID to a known value. Use a pseudo-random value to avoid collisions
|
|
||||||
target_group_id = "TARGET-GROUP-" + "".join(random.sample(string.ascii_lowercase, 20))
|
|
||||||
actions += ["object-set-attribute:id," + target_group_id]
|
|
||||||
# - set export options: use only the target group ID, nothing else
|
|
||||||
actions += ["export-id-only:true", "export-id:" + target_group_id]
|
|
||||||
# - do export (keep position on page)
|
|
||||||
actions += ["export-area-page"]
|
|
||||||
|
|
||||||
command = [INKSCAPEBIN, tmpfile, "--export-overwrite", "--actions=" + ";".join(actions)]
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
#sys.stderr.write(" ".join(command))
|
#sys.stderr.write(" ".join(command))
|
||||||
# run inkscape, buffer output
|
# run inkscape, buffer output
|
||||||
|
Loading…
Reference in New Issue
Block a user