Added back several extensions

This commit is contained in:
2022-10-03 02:49:07 +02:00
parent ed65606b93
commit a1f6bea8de
570 changed files with 15115 additions and 2 deletions

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<name>Living Hinge (Size Input)</name>
<id>fablabchemnitz.de.living_hinge_size_input</id>
<param name="width" type="float" min="1" max="10000" gui-text="Width (mm)">10</param>
<param name="height" type="float" min="10" max="10000" gui-text="Height (mm)">100</param>
<param name="horizontalLineSeparation" type="float" min="0.1" max="100" gui-text="Horizontal Line Separation (mm)">1.0</param>
<param name="verticalLineSeparation" type="float" min="0.1" max="100" gui-text="Vertical Line Separation (mm)">3.0</param>
<param name="maxLineLength" type="float" min="1.0" max="10000" gui-text="Maximum Line Length (mm)">30</param>
<param name="line_width" type="float" min="0.01" max="1000" precision="2" gui-text="Line Width:">1.0</param>
<param name="units" type="optiongroup" appearance="combo" gui-text=" ">
<option value="px">px</option>
<option value="pt">pt</option>
<option value="pc">pc</option>
<option value="in">in</option>
<option value="mm">mm</option>
</param>
<param name="addInitMarks" type="bool" gui-text="Add Init Marks">false</param>
<param name="groupLines" type="bool" gui-text="Group Lines">true</param>
<effect>
<object-type>all</object-type>
<effects-menu>
<submenu name="FabLab Chemnitz">
<submenu name="Shape/Pattern from Generator"/>
</submenu>
</effects-menu>
</effect>
<script>
<command location="inx" interpreter="python">living_hinge_size_input.py</command>
</script>
</inkscape-extension>

View File

@ -0,0 +1,79 @@
#!/usr/bin/env python3
"""
A Inkscape extension to generate a pattern that allows to bend wood or MDF one it is laser cut.
"""
import inkex
import math
from lxml import etree
class LivingHingeSizeInput(inkex.EffectExtension):
height = -1.0
def add_arguments(self, pars):
pars.add_argument('--width', type=float, default=10, help='Width (mm)')
pars.add_argument('--height', type=float, default=100, help='Height (mm)')
pars.add_argument('--horizontalLineSeparation', type=float, default=1, help='Horizontal Line Separation (mm)')
pars.add_argument('--verticalLineSeparation', type=float, default=3, help='Vertical Line Separation (mm)')
pars.add_argument('--maxLineLength', type=float, default=30, help='Max Line Length (mm)')
pars.add_argument("--line_width", type=float, help="Line width")
pars.add_argument("--units", help="Units for line thickness")
pars.add_argument('--addInitMarks', type=inkex.Boolean, default=False, help='Add Init Marks')
pars.add_argument('--groupLines', type=inkex.Boolean, default=True, help='Group Lines')
#draw an SVG line segment between the given (raw) points
def draw_SVG_line(self, x1, y1, x2, y2, parent):
if self.height < 0:
svg = self.document.getroot()
self.height = self.svg.unittouu(svg.attrib['height'])
line_style = { 'stroke-width':str(self.svg.unittouu(str(self.options.line_width) + self.options.units)), 'stroke':'#000000'}
line_attribs = {'style' : str(inkex.Style(line_style)),
'd' : 'M '+str(x1)+','+str(self.height - y1)+' L '+str(x2)+','+str(self.height - y2)}
line = etree.SubElement(parent, inkex.addNS('path','svg'), line_attribs )
def effect(self):
width = self.options.width
height = self.options.height
horizontalLineSeparation = self.options.horizontalLineSeparation
verticalLineSeparation = self.options.verticalLineSeparation
parent = self.svg.get_current_layer()
if self.options.groupLines is True:
parent = etree.SubElement(parent, 'g')
xLines = int(width / horizontalLineSeparation)
maxLineLength = self.options.maxLineLength
linesPerColumn = int(math.ceil(height / self.options.maxLineLength))
ll = height / linesPerColumn
for x in range(0, xLines):
if self.options.addInitMarks is True:
self.draw_SVG_line(x * horizontalLineSeparation, -3, x * horizontalLineSeparation, -2, parent)
if x % 2 == 0:
for y in range(0, linesPerColumn):
self.draw_SVG_line(x * horizontalLineSeparation, y * ll + verticalLineSeparation / 2, x * horizontalLineSeparation, (y + 1) * ll - verticalLineSeparation / 2, parent)
else:
for y in range(-1, linesPerColumn):
incy = ll / 2
y0 = y * ll + verticalLineSeparation / 2 + incy
if y0 < 0:
y0 = -1
y1 = (y + 1) * ll - verticalLineSeparation / 2 + incy
if y1 > height:
y1 = height + 1
self.draw_SVG_line(x * horizontalLineSeparation, y0, x * horizontalLineSeparation, y1, parent)
if __name__ == '__main__':
LivingHingeSizeInput().run()

View File

@ -0,0 +1,21 @@
[
{
"name": "Living Hinge (Size Input)",
"id": "fablabchemnitz.de.living_hinge_size_input",
"path": "living_hinge_size_input",
"dependent_extensions": null,
"original_name": "Bend Wood Cuts Pattern",
"original_id": "com.zerjio.inkscape.bwcp",
"license": "GNU GPL v3",
"license_url": "https://github.com/zerjillo/laserCutInkscapeExtensions/blob/master/LICENSE",
"comment": "ported to Inkscape v1 by Mario Voigt",
"source_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.2/src/branch/master/extensions/fablabchemnitz/living_hinge_size_input",
"fork_url": "https://github.com/zerjillo/laserCutInkscapeExtensions",
"documentation_url": "https://stadtfabrikanten.org/pages/viewpage.action?pageId=55019631",
"inkscape_gallery_url": null,
"main_authors": [
"github.com/zerjillo",
"github.com/eridur-de"
]
}
]