small enhancements

This commit is contained in:
Mario Voigt 2021-10-19 14:07:12 +02:00
parent 207ae044fe
commit 3ed7e2ae3a
4 changed files with 17 additions and 11 deletions

View File

@ -8,6 +8,7 @@
<vbox>
<label appearance="header">Join Paths</label>
<param name="optimized" type="bool" gui-text="Optimized joining">true</param>
<param name="reverse" type="bool" gui-text="Reverse">true</param>
<param name="margin" type="float" min="0.0001" max="99999.0000" precision="4" gui-text="Merge margin">0.0100</param>
<label appearance="header">Tabs And Dimples</label>
<label>Enable to insert dimples (pressfit noses) into</label>

View File

@ -126,6 +126,7 @@ class JoinPaths(inkex.EffectExtension):
def add_arguments(self, pars):
pars.add_argument("--optimized", type=inkex.Boolean, default=True)
pars.add_argument("--reverse", type=inkex.Boolean, default=False)
pars.add_argument("--margin", type=float, default=0.0100)
pars.add_argument("--add_dimples", type=inkex.Boolean, default=False)
pars.add_argument("--draw_dimple_centers", type=inkex.Boolean, default=False)
@ -146,11 +147,13 @@ class JoinPaths(inkex.EffectExtension):
pars.add_argument("--tab", default="sampling", help="Tab")
def effect(self):
selections = self.svg.selected
if len(self.svg.selected) == 0:
self.msg('Please select some paths first.')
return
pathNodes = self.document.xpath('//svg:path',namespaces=inkex.NSS)
if self.options.reverse is True: #helps debugging some strange Z orders (try out)
pathNodes = pathNodes[::-1]
#pathNodes[0].path = pathNodes[0].path.reverse()
#pathNodes[0].path = pathNodes[-1].path.reverse()
paths = {p.get('id'): getPartsFromCubicSuper(CubicSuperPath(p.get('d'))) for p in pathNodes }
#paths.keys() Order disturbed
pathIds = [p.get('id') for p in pathNodes]
@ -162,7 +165,6 @@ class JoinPaths(inkex.EffectExtension):
if(self.options.optimized):
startPathId = pathIds[0]
pathIds = getArrangedIds(paths, startPathId)
newParts = []
firstElem = None
for key in pathIds:
@ -373,6 +375,9 @@ class JoinPaths(inkex.EffectExtension):
except:
pass #elem might come from group item - in this case we need to ignore it
if firstElem is None:
self.msg('Please select some paths first. Check if you selected a group or an object instead.')
exit()
newElem = copy.copy(firstElem)
oldId = firstElem.get('id')
newElem.set('d', CubicSuperPath(getCubicSuperFromParts(newParts)))

View File

@ -11,7 +11,7 @@
"source_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.X/src/branch/master/extensions/fablabchemnitz/mirror",
"fork_url": "https://inkscape.org/~jeko/%E2%98%85mirror",
"documentation_url": "https://stadtfabrikanten.org/display/IFM/Mirror",
"inkscape_gallery_url": "https://inkscape.org/~MarioVoigt/%E2%98%85move-path-node",
"inkscape_gallery_url": null,
"main_authors": [
"inkscape.org/jeko",
"github.com/vmario89"

View File

@ -11,7 +11,7 @@
"source_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.X/src/branch/master/extensions/fablabchemnitz/move_path_node",
"fork_url": null,
"documentation_url": "https://stadtfabrikanten.org/display/IFM/Move+Path+Node",
"inkscape_gallery_url": null,
"inkscape_gallery_url": "https://inkscape.org/~MarioVoigt/%E2%98%85move-path-node",
"main_authors": [
"github.com/vmario89"
]