added sheetmetal option for join paths
This commit is contained in:
parent
e6f3afdab5
commit
8c7bcc3e95
@ -29,7 +29,7 @@
|
||||
<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" gui-text="Link offset (+/-)">0.000</param>
|
||||
<param name="link_offset" type="float" min="-9999.000" max="9999.000" precision="3" appearance="full" gui-text="Link offset (+/-)">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>
|
||||
<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>
|
||||
|
@ -20,6 +20,7 @@
|
||||
<option value="peaks">peaks</option>
|
||||
<option value="arcs">arcs</option>
|
||||
<option value="tabs">tabs</option>
|
||||
<option value="sheetmetal">sheetmetal</option>
|
||||
</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>
|
||||
@ -28,14 +29,15 @@
|
||||
</vbox>
|
||||
<separator/>
|
||||
<vbox>
|
||||
<label appearance="header">Tab Dimensions</label>
|
||||
<param name="dimple_height_mode" type="optiongroup" appearance="combo" gui-text="Height by ...">
|
||||
<label appearance="header">Dimple/Tab Dimensions</label>
|
||||
<param name="dimple_height_mode" type="optiongroup" appearance="combo" gui-text="Basic height by ...">
|
||||
<option value="by_height">by height</option>
|
||||
<option value="by_angle">by angle</option>
|
||||
</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_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_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_sheetmetal_depth" type="float" min="0.000" max="99999.000" precision="3" gui-text="Sheetmetal: depth" gui-description="Only applies for dimple type 'sheetmetal'">4.000</param>
|
||||
<param name="dimple_height_units" gui-text="Height units" type="optiongroup" appearance="combo">
|
||||
<option value="mm">mm</option>
|
||||
<option value="cm">cm</option>
|
||||
|
@ -139,6 +139,7 @@ class JoinPaths(inkex.EffectExtension):
|
||||
pars.add_argument("--dimple_height", type=float, default=4)
|
||||
pars.add_argument("--dimple_angle", type=float, default=45)
|
||||
pars.add_argument("--dimple_tab_angle", type=float, default=45)
|
||||
pars.add_argument("--dimple_sheetmetal_depth", type=float, default=4)
|
||||
pars.add_argument("--dimple_gap_filter", type=inkex.Boolean, default=False)
|
||||
pars.add_argument("--dimple_min_gap", type=float, default=1)
|
||||
pars.add_argument("--dimple_max_gap", type=float, default=40)
|
||||
@ -224,29 +225,36 @@ class JoinPaths(inkex.EffectExtension):
|
||||
x4 = midPoint[0] - (dimple_height)*dy
|
||||
y4 = midPoint[1] + (dimple_height)*dx
|
||||
|
||||
dimple_center_style = {'stroke': '#00FFFF', 'fill': 'none', 'stroke-width': str(self.svg.unittouu('1px'))}
|
||||
dimple_style = {'stroke': '#0000FF', 'fill': 'none', 'stroke-width': str(self.svg.unittouu('1px'))}
|
||||
|
||||
if self.options.draw_dimple_centers is True:
|
||||
#add a new dimple center cross (4 segments)
|
||||
line = dimpleGroup.add(inkex.PathElement(id=self.svg.get_unique_id('dimple_center_perp1')))
|
||||
line.set('d', "M{:0.6f},{:0.6f} L{:0.6f},{:0.6f}".format(midPoint[0], midPoint[1], x3, y3))
|
||||
line.style = dimple_style
|
||||
line.style = dimple_center_style
|
||||
line = dimpleGroup.add(inkex.PathElement(id=self.svg.get_unique_id('dimple_center_perp2')))
|
||||
line.set('d', "M{:0.6f},{:0.6f} L{:0.6f},{:0.6f}".format(midPoint[0], midPoint[1], x4, y4))
|
||||
line.style = dimple_style
|
||||
line.style = dimple_center_style
|
||||
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(p1[0], p1[1], midPoint[0], midPoint[1]))
|
||||
line.style = dimple_style
|
||||
line.style = dimple_center_style
|
||||
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.style = dimple_style
|
||||
line.style = dimple_center_style
|
||||
|
||||
##########
|
||||
### LINES
|
||||
##########
|
||||
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":
|
||||
|
||||
##########
|
||||
### PEAKS
|
||||
##########
|
||||
elif self.options.dimple_type == "peaks":
|
||||
if self.options.dimple_invert is True:
|
||||
x5 = x3
|
||||
y5 = y3
|
||||
@ -264,7 +272,9 @@ class JoinPaths(inkex.EffectExtension):
|
||||
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.style = dimple_style
|
||||
|
||||
##########
|
||||
### 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')))
|
||||
@ -323,12 +333,10 @@ class JoinPaths(inkex.EffectExtension):
|
||||
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
|
||||
|
||||
##########
|
||||
### TABS
|
||||
##########
|
||||
elif self.options.dimple_type == "tabs":
|
||||
pbottom1 = [p1[0] + (dimple_height)*dy, p1[1] - (dimple_height)*dx]
|
||||
pbottom2 = [p2[0] + (dimple_height)*dy, p2[1] - (dimple_height)*dx]
|
||||
ptop1 = [p1[0] - (dimple_height)*dy, p1[1] + (dimple_height)*dx]
|
||||
ptop2 = [p2[0] - (dimple_height)*dy, p2[1] + (dimple_height)*dx]
|
||||
|
||||
l_hypo = dimple_height / (math.cos(math.radians(90.0 - self.options.dimple_tab_angle)))
|
||||
pbottom1 = rotate(p1, [p1[0] + l_hypo * dx, p1[1] + l_hypo * dy], math.radians(-self.options.dimple_tab_angle))
|
||||
pbottom2 = rotate(p2, [p2[0] - l_hypo * dx, p2[1] - l_hypo * dy], math.radians(-360.0 + self.options.dimple_tab_angle))
|
||||
@ -354,7 +362,39 @@ class JoinPaths(inkex.EffectExtension):
|
||||
line.set('d', "M{:0.6f},{:0.6f} L{:0.6f},{:0.6f} L{:0.6f},{:0.6f} L{:0.6f},{:0.6f}".format(
|
||||
p1[0], p1[1], ptop1[0], ptop1[1], ptop2[0], ptop2[1], p2[0], p2[1]))
|
||||
line.style = dimple_style
|
||||
|
||||
|
||||
##########
|
||||
### sHEETMETAL
|
||||
##########
|
||||
elif self.options.dimple_type == "sheetmetal":
|
||||
|
||||
if self.options.dimple_invert is True:
|
||||
self.options.dimple_tab_angle = 360.0 - self.options.dimple_tab_angle
|
||||
|
||||
pbottom1 = rotate(p1, [p1[0] + dimple_height * dx, p1[1] + dimple_height * dy], math.radians(-self.options.dimple_tab_angle))
|
||||
pbottom2 = rotate(p2, [p2[0] - dimple_height * dx, p2[1] - dimple_height * dy], math.radians(-360.0 + self.options.dimple_tab_angle))
|
||||
|
||||
depth = self.svg.unittouu(str(self.options.dimple_sheetmetal_depth) + self.options.dimple_height_units)
|
||||
poff1 = [p1[0] + (depth)*dx, p1[1] + (depth)*dy]
|
||||
poff2 = [p2[0] - (depth)*dx, p2[1] - (depth)*dy]
|
||||
poff1_start = rotate(poff1, [poff1[0] + dimple_height * dx, poff1[1] + dimple_height * dy], math.radians(180.0 - self.options.dimple_tab_angle))
|
||||
poff2_end = rotate(poff2, [poff2[0] + dimple_height * dx, poff2[1] + dimple_height * dy], math.radians(self.options.dimple_tab_angle))
|
||||
|
||||
line = dimpleGroup.add(inkex.PathElement(id=self.svg.get_unique_id('dimple_sheetmetal_start')))
|
||||
line.set('d', "M{:0.6f},{:0.6f} L{:0.6f},{:0.6f}".format(
|
||||
p1[0], p1[1], pbottom1[0], pbottom1[1]))
|
||||
line.style = dimple_style
|
||||
|
||||
line = dimpleGroup.add(inkex.PathElement(id=self.svg.get_unique_id('dimple_sheetmetal_middle')))
|
||||
line.set('d', "M{:0.6f},{:0.6f} L{:0.6f},{:0.6f} L{:0.6f},{:0.6f} L{:0.6f},{:0.6f}".format(
|
||||
poff1_start[0], poff1_start[1], poff1[0], poff1[1], poff2[0], poff2[1], poff2_end[0], poff2_end[1]))
|
||||
line.style = dimple_style
|
||||
|
||||
line = dimpleGroup.add(inkex.PathElement(id=self.svg.get_unique_id('dimple_sheetmetal_end')))
|
||||
line.set('d', "M{:0.6f},{:0.6f} L{:0.6f},{:0.6f}".format(
|
||||
p2[0], p2[1], pbottom2[0], pbottom2[1]))
|
||||
line.style = dimple_style
|
||||
|
||||
#cleanup groups
|
||||
if len(dimpleGroup) == 1: ##move up child if group has only one child
|
||||
for child in dimpleGroup:
|
||||
|
Reference in New Issue
Block a user