adjustments in join paths
This commit is contained in:
parent
19d56db343
commit
62b1968f36
@ -4,14 +4,18 @@
|
|||||||
<id>fablabchemnitz.de.join_paths</id>
|
<id>fablabchemnitz.de.join_paths</id>
|
||||||
<param name="tab" type="notebook">
|
<param name="tab" type="notebook">
|
||||||
<page name="subdividePath" gui-text="Join Paths / Create Tabs And Dimples">
|
<page name="subdividePath" gui-text="Join Paths / Create Tabs And Dimples">
|
||||||
|
<hbox>
|
||||||
|
<vbox>
|
||||||
<label appearance="header">Join Paths</label>
|
<label appearance="header">Join Paths</label>
|
||||||
<param name="optimized" type="bool" gui-text="Optimized joining">true</param>
|
<param name="optimized" type="bool" gui-text="Optimized joining">true</param>
|
||||||
<param name="margin" type="float" min="0.0001" max="99999.0000" precision="4" gui-text="Merge margin">0.0100</param>
|
<param name="margin" type="float" min="0.0001" max="99999.0000" precision="4" gui-text="Merge margin">0.0100</param>
|
||||||
<label appearance="header">Create Tabs And Dimples</label>
|
<label appearance="header">Tabs And Dimples</label>
|
||||||
<label>Enable to insert dimples (pressfit noses) into the gaps (instead regular straight lines)</label>
|
<label>Enable to insert dimples (pressfit noses) into</label>
|
||||||
|
<label>the gaps (instead regular straight lines)</label>
|
||||||
<param name="add_dimples" type="bool" gui-text="Create dimples">false</param>
|
<param name="add_dimples" type="bool" gui-text="Create dimples">false</param>
|
||||||
<param name="dimples_to_group" type="bool" gui-text="Unify into single group">false</param>
|
<param name="dimples_to_group" type="bool" gui-text="Unify into single group">false</param>
|
||||||
<param name="dimple_type" type="optiongroup" appearance="combo" gui-text="Dimple type">
|
<param name="dimple_type" type="optiongroup" appearance="combo" gui-text="Dimple type">
|
||||||
|
<option value="lines">lines</option>
|
||||||
<option value="peaks">peaks</option>
|
<option value="peaks">peaks</option>
|
||||||
<option value="arcs">arcs</option>
|
<option value="arcs">arcs</option>
|
||||||
<option value="tabs">tabs</option>
|
<option value="tabs">tabs</option>
|
||||||
@ -19,13 +23,18 @@
|
|||||||
<param name="draw_dimple_centers" type="bool" gui-text="Draw dimple centers">false</param>
|
<param name="draw_dimple_centers" type="bool" gui-text="Draw dimple centers">false</param>
|
||||||
<param name="dimple_invert" type="bool" gui-text="Invert dimple sides">false</param>
|
<param name="dimple_invert" type="bool" gui-text="Invert dimple sides">false</param>
|
||||||
<param name="draw_both_sides" type="bool" gui-text="Draw both sides">false</param>
|
<param name="draw_both_sides" type="bool" gui-text="Draw both sides">false</param>
|
||||||
|
<param name="draw_arcs_as_paths" type="bool" gui-text="Draw arcs as svg:path" gui-description="If disabled, we get svg:ellipse elements. Only applies for dimple type 'arcs'">true</param>
|
||||||
|
</vbox>
|
||||||
|
<separator/>
|
||||||
|
<vbox>
|
||||||
|
<label appearance="header">Tab Dimensions</label>
|
||||||
<param name="dimple_height_mode" type="optiongroup" appearance="combo" gui-text="Height by ...">
|
<param name="dimple_height_mode" type="optiongroup" appearance="combo" gui-text="Height by ...">
|
||||||
<option value="by_height">by height</option>
|
<option value="by_height">by height</option>
|
||||||
<option value="by_angle">by angle</option>
|
<option value="by_angle">by angle</option>
|
||||||
</param>
|
</param>
|
||||||
<param name="dimple_angle" type="float" min="0.000" max="360.000" precision="3" gui-text="... angle">45.000</param>
|
<param name="dimple_angle" type="float" min="0.000" max="360.000" precision="3" gui-text="... angle">45.000</param>
|
||||||
<param name="dimple_height" type="float" min="0.001" max="99999.000" precision="3" gui-text="... height">4.000</param>
|
<param name="dimple_height" type="float" min="0.001" max="99999.000" precision="3" gui-text="... height">4.000</param>
|
||||||
<param name="dimple_tab_angle" type="float" min="0.000" max="360.000" precision="3" gui-text="tab angle">45.000</param>
|
<param name="dimple_tab_angle" type="float" min="0.000" max="360.000" precision="3" gui-text="Tab angle" gui-description="Only applies for dimple type 'tabs'">45.000</param>
|
||||||
<param name="dimple_height_units" gui-text="Height units" type="optiongroup" appearance="combo">
|
<param name="dimple_height_units" gui-text="Height units" type="optiongroup" appearance="combo">
|
||||||
<option value="mm">mm</option>
|
<option value="mm">mm</option>
|
||||||
<option value="cm">cm</option>
|
<option value="cm">cm</option>
|
||||||
@ -33,7 +42,8 @@
|
|||||||
<option value="pt">pt</option>
|
<option value="pt">pt</option>
|
||||||
<option value="px">px</option>
|
<option value="px">px</option>
|
||||||
</param>
|
</param>
|
||||||
<label appearance="header">Dimple gap filter</label>
|
<label appearance="header">Gap filter</label>
|
||||||
|
<label>Prevents filling all gaps with tabs/dimples.</label>
|
||||||
<param name="dimple_gap_filter" type="bool" gui-text="Apply min/max filter">false</param>
|
<param name="dimple_gap_filter" type="bool" gui-text="Apply min/max filter">false</param>
|
||||||
<param name="dimple_min_gap" type="float" min="0.000" max="99999.000" precision="3" gui-text="Min">1</param>
|
<param name="dimple_min_gap" type="float" min="0.000" max="99999.000" precision="3" gui-text="Min">1</param>
|
||||||
<param name="dimple_max_gap" type="float" min="0.000" max="99999.000" precision="3" gui-text="Max">40</param>
|
<param name="dimple_max_gap" type="float" min="0.000" max="99999.000" precision="3" gui-text="Max">40</param>
|
||||||
@ -44,10 +54,42 @@
|
|||||||
<option value="pt">pt</option>
|
<option value="pt">pt</option>
|
||||||
<option value="px">px</option>
|
<option value="px">px</option>
|
||||||
</param>
|
</param>
|
||||||
|
</vbox>
|
||||||
|
</hbox>
|
||||||
</page>
|
</page>
|
||||||
<page name="desc" gui-text="Help">
|
<page name="tab_about" gui-text="About">
|
||||||
<label xml:space="preserve">This effect joins the Bezier curves, with straight line segments. If the end nodes are close enough, they are merged into a single one. With the optimized option selected, the new curve starts from the top most curve from the selection. The curves are then joined based on the distance of their closest end point to the previous curve.
|
<label appearance="header">Join Paths / Create Tabs And Dimples</label>
|
||||||
</label>
|
<label>This effect joins the Bezier curves with straight line segments.
|
||||||
|
If the end nodes are close enough, they are merged into a single one.
|
||||||
|
With the optimized option selected, the new curve starts from the top
|
||||||
|
most curve from the selection. The curves are then joined based on the
|
||||||
|
distance of their closest end point to the previous curve.
|
||||||
|
|
||||||
|
Additionally it allows to create different tabs / dimples for lasercutting.
|
||||||
|
|
||||||
|
This extension is originally based on 'Join Paths Optimized' by Shriinivas.</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/joinpaths</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>
|
</page>
|
||||||
</param>
|
</param>
|
||||||
<effect>
|
<effect>
|
||||||
|
@ -126,6 +126,7 @@ class JoinPaths(inkex.EffectExtension):
|
|||||||
pars.add_argument("--margin", type=float, default=0.0100)
|
pars.add_argument("--margin", type=float, default=0.0100)
|
||||||
pars.add_argument("--add_dimples", type=inkex.Boolean, default=False)
|
pars.add_argument("--add_dimples", type=inkex.Boolean, default=False)
|
||||||
pars.add_argument("--draw_dimple_centers", type=inkex.Boolean, default=False)
|
pars.add_argument("--draw_dimple_centers", type=inkex.Boolean, default=False)
|
||||||
|
pars.add_argument("--draw_arcs_as_paths", type=inkex.Boolean, default=False)
|
||||||
pars.add_argument("--dimple_invert", type=inkex.Boolean, default=False)
|
pars.add_argument("--dimple_invert", type=inkex.Boolean, default=False)
|
||||||
pars.add_argument("--dimple_type", default="lines")
|
pars.add_argument("--dimple_type", default="lines")
|
||||||
pars.add_argument("--dimples_to_group", type=inkex.Boolean, default=False)
|
pars.add_argument("--dimples_to_group", type=inkex.Boolean, default=False)
|
||||||
@ -235,6 +236,11 @@ class JoinPaths(inkex.EffectExtension):
|
|||||||
line.set('d', "M{:0.6f},{:0.6f} L{:0.6f},{:0.6f}".format(midPoint[0], midPoint[1], p2[0], p2[1]))
|
line.set('d', "M{:0.6f},{:0.6f} L{:0.6f},{:0.6f}".format(midPoint[0], midPoint[1], p2[0], p2[1]))
|
||||||
line.style = dimple_style
|
line.style = dimple_style
|
||||||
|
|
||||||
|
if self.options.dimple_type == "lines":
|
||||||
|
line = dimpleGroup.add(inkex.PathElement(id=self.svg.get_unique_id('dimple_line')))
|
||||||
|
line.set('d', "M{:0.6f},{:0.6f} L{:0.6f},{:0.6f}".format(p1[0], p1[1], p2[0], p2[1]))
|
||||||
|
line.style = dimple_style
|
||||||
|
|
||||||
if self.options.dimple_type == "peaks":
|
if self.options.dimple_type == "peaks":
|
||||||
if self.options.dimple_invert is True:
|
if self.options.dimple_invert is True:
|
||||||
x5 = x3
|
x5 = x3
|
||||||
@ -253,7 +259,9 @@ class JoinPaths(inkex.EffectExtension):
|
|||||||
line = dimpleGroup.add(inkex.PathElement(id=self.svg.get_unique_id('dimple_peak')))
|
line = dimpleGroup.add(inkex.PathElement(id=self.svg.get_unique_id('dimple_peak')))
|
||||||
line.set('d', "M{:0.6f},{:0.6f} L{:0.6f},{:0.6f} L{:0.6f},{:0.6f}".format(p1[0], p1[1], x4, y4, p2[0], p2[1]))
|
line.set('d', "M{:0.6f},{:0.6f} L{:0.6f},{:0.6f} L{:0.6f},{:0.6f}".format(p1[0], p1[1], x4, y4, p2[0], p2[1]))
|
||||||
line.style = dimple_style
|
line.style = dimple_style
|
||||||
|
|
||||||
elif self.options.dimple_type == "arcs":
|
elif self.options.dimple_type == "arcs":
|
||||||
|
if self.options.draw_arcs_as_paths is False:
|
||||||
ellipse = dimpleGroup.add(inkex.Ellipse(id=self.svg.get_unique_id('dimple_arc')))
|
ellipse = dimpleGroup.add(inkex.Ellipse(id=self.svg.get_unique_id('dimple_arc')))
|
||||||
ellipse.set('transform', "rotate({:0.6f} {:0.6f} {:0.6f})".format(slope_angle, midPoint[0], midPoint[1]))
|
ellipse.set('transform', "rotate({:0.6f} {:0.6f} {:0.6f})".format(slope_angle, midPoint[0], midPoint[1]))
|
||||||
ellipse.set('sodipodi:arc-type', "arc")
|
ellipse.set('sodipodi:arc-type', "arc")
|
||||||
@ -286,6 +294,29 @@ class JoinPaths(inkex.EffectExtension):
|
|||||||
ellipse.set('sodipodi:start', "{:0.6f}".format(math.radians(90.0)))
|
ellipse.set('sodipodi:start', "{:0.6f}".format(math.radians(90.0)))
|
||||||
ellipse.set('sodipodi:end', "{:0.6f}".format(math.radians(270.0)))
|
ellipse.set('sodipodi:end', "{:0.6f}".format(math.radians(270.0)))
|
||||||
ellipse.style = dimple_style
|
ellipse.style = dimple_style
|
||||||
|
else: #if draw_arcs_as_paths is True
|
||||||
|
# +--- x-end point
|
||||||
|
# |
|
||||||
|
# counterclockwise ---+ | +--- y-end point
|
||||||
|
# | | |
|
||||||
|
#<path d="M 85 350 A 150 180 0 0 0 280 79" stroke="red" fill="none"/>
|
||||||
|
# | | | |
|
||||||
|
# 1 Radius x-Axis ---+ | | +--- 4 short / long way
|
||||||
|
# | |
|
||||||
|
# 2 Radius y-Axis ---+ +--- 3 Rotation x
|
||||||
|
if self.options.dimple_invert is True:
|
||||||
|
b1 = 1
|
||||||
|
b2 = 0
|
||||||
|
else:
|
||||||
|
b1 = 0
|
||||||
|
b2 = 1
|
||||||
|
ellipse = dimpleGroup.add(inkex.PathElement(id=self.svg.get_unique_id('dimple_arc')))
|
||||||
|
ellipse.set('d', "M {:0.6f} {:0.6f} A {:0.6f} {:0.6f} {:0.6f} 0 {} {:0.6f} {:0.6f}".format(p1[0], p1[1], dimple_height, dist2 / 2, slope_angle, b1, p2[0], p2[1]))
|
||||||
|
ellipse.style = dimple_style
|
||||||
|
if self.options.draw_both_sides is True:
|
||||||
|
ellipse = dimpleGroup.add(inkex.PathElement(id=self.svg.get_unique_id('dimple_arc')))
|
||||||
|
ellipse.set('d', "M {:0.6f} {:0.6f} A {:0.6f} {:0.6f} {:0.6f} 0 {} {:0.6f} {:0.6f}".format(p1[0], p1[1], dimple_height, dist2 / 2, slope_angle, b2, p2[0], p2[1]))
|
||||||
|
ellipse.style = dimple_style
|
||||||
|
|
||||||
elif self.options.dimple_type == "tabs":
|
elif self.options.dimple_type == "tabs":
|
||||||
pbottom1 = [p1[0] + (dimple_height)*dy, p1[1] - (dimple_height)*dx]
|
pbottom1 = [p1[0] + (dimple_height)*dy, p1[1] - (dimple_height)*dx]
|
||||||
|
Reference in New Issue
Block a user