adjustments in join paths
This commit is contained in:
parent
19d56db343
commit
62b1968f36
@ -4,50 +4,92 @@
|
|||||||
<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">
|
||||||
<label appearance="header">Join Paths</label>
|
<hbox>
|
||||||
<param name="optimized" type="bool" gui-text="Optimized joining">true</param>
|
<vbox>
|
||||||
<param name="margin" type="float" min="0.0001" max="99999.0000" precision="4" gui-text="Merge margin">0.0100</param>
|
<label appearance="header">Join Paths</label>
|
||||||
<label appearance="header">Create Tabs And Dimples</label>
|
<param name="optimized" type="bool" gui-text="Optimized joining">true</param>
|
||||||
<label>Enable to insert dimples (pressfit noses) into the gaps (instead regular straight lines)</label>
|
<param name="margin" type="float" min="0.0001" max="99999.0000" precision="4" gui-text="Merge margin">0.0100</param>
|
||||||
<param name="add_dimples" type="bool" gui-text="Create dimples">false</param>
|
<label appearance="header">Tabs And Dimples</label>
|
||||||
<param name="dimples_to_group" type="bool" gui-text="Unify into single group">false</param>
|
<label>Enable to insert dimples (pressfit noses) into</label>
|
||||||
<param name="dimple_type" type="optiongroup" appearance="combo" gui-text="Dimple type">
|
<label>the gaps (instead regular straight lines)</label>
|
||||||
<option value="peaks">peaks</option>
|
<param name="add_dimples" type="bool" gui-text="Create dimples">false</param>
|
||||||
<option value="arcs">arcs</option>
|
<param name="dimples_to_group" type="bool" gui-text="Unify into single group">false</param>
|
||||||
<option value="tabs">tabs</option>
|
<param name="dimple_type" type="optiongroup" appearance="combo" gui-text="Dimple type">
|
||||||
</param>
|
<option value="lines">lines</option>
|
||||||
<param name="draw_dimple_centers" type="bool" gui-text="Draw dimple centers">false</param>
|
<option value="peaks">peaks</option>
|
||||||
<param name="dimple_invert" type="bool" gui-text="Invert dimple sides">false</param>
|
<option value="arcs">arcs</option>
|
||||||
<param name="draw_both_sides" type="bool" gui-text="Draw both sides">false</param>
|
<option value="tabs">tabs</option>
|
||||||
<param name="dimple_height_mode" type="optiongroup" appearance="combo" gui-text="Height by ...">
|
</param>
|
||||||
<option value="by_height">by height</option>
|
<param name="draw_dimple_centers" type="bool" gui-text="Draw dimple centers">false</param>
|
||||||
<option value="by_angle">by angle</option>
|
<param name="dimple_invert" type="bool" gui-text="Invert dimple sides">false</param>
|
||||||
</param>
|
<param name="draw_both_sides" type="bool" gui-text="Draw both sides">false</param>
|
||||||
<param name="dimple_angle" type="float" min="0.000" max="360.000" precision="3" gui-text="... angle">45.000</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>
|
||||||
<param name="dimple_height" type="float" min="0.001" max="99999.000" precision="3" gui-text="... height">4.000</param>
|
</vbox>
|
||||||
<param name="dimple_tab_angle" type="float" min="0.000" max="360.000" precision="3" gui-text="tab angle">45.000</param>
|
<separator/>
|
||||||
<param name="dimple_height_units" gui-text="Height units" type="optiongroup" appearance="combo">
|
<vbox>
|
||||||
<option value="mm">mm</option>
|
<label appearance="header">Tab Dimensions</label>
|
||||||
<option value="cm">cm</option>
|
<param name="dimple_height_mode" type="optiongroup" appearance="combo" gui-text="Height by ...">
|
||||||
<option value="in">in</option>
|
<option value="by_height">by height</option>
|
||||||
<option value="pt">pt</option>
|
<option value="by_angle">by angle</option>
|
||||||
<option value="px">px</option>
|
</param>
|
||||||
</param>
|
<param name="dimple_angle" type="float" min="0.000" max="360.000" precision="3" gui-text="... angle">45.000</param>
|
||||||
<label appearance="header">Dimple gap filter</label>
|
<param name="dimple_height" type="float" min="0.001" max="99999.000" precision="3" gui-text="... height">4.000</param>
|
||||||
<param name="dimple_gap_filter" type="bool" gui-text="Apply min/max filter">false</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_min_gap" type="float" min="0.000" max="99999.000" precision="3" gui-text="Min">1</param>
|
<param name="dimple_height_units" gui-text="Height units" type="optiongroup" appearance="combo">
|
||||||
<param name="dimple_max_gap" type="float" min="0.000" max="99999.000" precision="3" gui-text="Max">40</param>
|
<option value="mm">mm</option>
|
||||||
<param name="dimple_gap_filter_units" gui-text="Filter units" type="optiongroup" appearance="combo">
|
<option value="cm">cm</option>
|
||||||
<option value="mm">mm</option>
|
<option value="in">in</option>
|
||||||
<option value="cm">cm</option>
|
<option value="pt">pt</option>
|
||||||
<option value="in">in</option>
|
<option value="px">px</option>
|
||||||
<option value="pt">pt</option>
|
</param>
|
||||||
<option value="px">px</option>
|
<label appearance="header">Gap filter</label>
|
||||||
</param>
|
<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_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_gap_filter_units" gui-text="Filter units" type="optiongroup" appearance="combo">
|
||||||
|
<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>
|
||||||
|
</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)
|
||||||
@ -234,6 +235,11 @@ class JoinPaths(inkex.EffectExtension):
|
|||||||
line = dimpleGroup.add(inkex.PathElement(id=self.svg.get_unique_id('dimple_center_join1')))
|
line = dimpleGroup.add(inkex.PathElement(id=self.svg.get_unique_id('dimple_center_join1')))
|
||||||
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:
|
||||||
@ -252,25 +258,10 @@ class JoinPaths(inkex.EffectExtension):
|
|||||||
#add a new opposite dimple center
|
#add a new opposite dimple center
|
||||||
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":
|
||||||
ellipse = dimpleGroup.add(inkex.Ellipse(id=self.svg.get_unique_id('dimple_arc')))
|
if self.options.draw_arcs_as_paths is False:
|
||||||
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:type', "arc")
|
|
||||||
ellipse.set('sodipodi:cx', "{:0.6f}".format(midPoint[0]))
|
|
||||||
ellipse.set('sodipodi:cy', "{:0.6f}".format(midPoint[1]))
|
|
||||||
ellipse.set('sodipodi:rx', "{:0.6f}".format(dimple_height))
|
|
||||||
ellipse.set('sodipodi:ry', "{:0.6f}".format(dist2 / 2))
|
|
||||||
if self.options.dimple_invert is True:
|
|
||||||
ellipse.set('sodipodi:start', "{:0.6f}".format(math.radians(90.0)))
|
|
||||||
ellipse.set('sodipodi:end', "{:0.6f}".format(math.radians(270.0)))
|
|
||||||
else:
|
|
||||||
ellipse.set('sodipodi:start', "{:0.6f}".format(math.radians(270.0)))
|
|
||||||
ellipse.set('sodipodi:end', "{:0.6f}".format(math.radians(90.0)))
|
|
||||||
ellipse.style = dimple_style
|
|
||||||
|
|
||||||
if self.options.draw_both_sides is True:
|
|
||||||
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")
|
||||||
@ -279,13 +270,53 @@ class JoinPaths(inkex.EffectExtension):
|
|||||||
ellipse.set('sodipodi:cy', "{:0.6f}".format(midPoint[1]))
|
ellipse.set('sodipodi:cy', "{:0.6f}".format(midPoint[1]))
|
||||||
ellipse.set('sodipodi:rx', "{:0.6f}".format(dimple_height))
|
ellipse.set('sodipodi:rx', "{:0.6f}".format(dimple_height))
|
||||||
ellipse.set('sodipodi:ry', "{:0.6f}".format(dist2 / 2))
|
ellipse.set('sodipodi:ry', "{:0.6f}".format(dist2 / 2))
|
||||||
if self.options.dimple_invert is True:
|
if self.options.dimple_invert is True:
|
||||||
ellipse.set('sodipodi:start', "{:0.6f}".format(math.radians(270.0)))
|
ellipse.set('sodipodi:start', "{:0.6f}".format(math.radians(90.0)))
|
||||||
ellipse.set('sodipodi:end', "{:0.6f}".format(math.radians(90.0)))
|
ellipse.set('sodipodi:end', "{:0.6f}".format(math.radians(270.0)))
|
||||||
else:
|
else:
|
||||||
ellipse.set('sodipodi:start', "{:0.6f}".format(math.radians(90.0)))
|
ellipse.set('sodipodi:start', "{:0.6f}".format(math.radians(270.0)))
|
||||||
ellipse.set('sodipodi:end', "{:0.6f}".format(math.radians(270.0)))
|
ellipse.set('sodipodi:end', "{:0.6f}".format(math.radians(90.0)))
|
||||||
ellipse.style = dimple_style
|
ellipse.style = dimple_style
|
||||||
|
|
||||||
|
if self.options.draw_both_sides is True:
|
||||||
|
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('sodipodi:arc-type', "arc")
|
||||||
|
ellipse.set('sodipodi:type', "arc")
|
||||||
|
ellipse.set('sodipodi:cx', "{:0.6f}".format(midPoint[0]))
|
||||||
|
ellipse.set('sodipodi:cy', "{:0.6f}".format(midPoint[1]))
|
||||||
|
ellipse.set('sodipodi:rx', "{:0.6f}".format(dimple_height))
|
||||||
|
ellipse.set('sodipodi:ry', "{:0.6f}".format(dist2 / 2))
|
||||||
|
if self.options.dimple_invert is True:
|
||||||
|
ellipse.set('sodipodi:start', "{:0.6f}".format(math.radians(270.0)))
|
||||||
|
ellipse.set('sodipodi:end', "{:0.6f}".format(math.radians(90.0)))
|
||||||
|
else:
|
||||||
|
ellipse.set('sodipodi:start', "{:0.6f}".format(math.radians(90.0)))
|
||||||
|
ellipse.set('sodipodi:end', "{:0.6f}".format(math.radians(270.0)))
|
||||||
|
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