Hi, I’m trying to use the layer.connectAllOpenPaths() and nothing is actually happening, nor is there an error message in the Macro Panel.
Selecting by hand my paths and right clicking Close Open Paths in the context menu does work.
What am I missing?
Thanks!
code snippet: (just last line doesn’t do anything)
addToLayer = NSMutableArray.array()
for path in thisLayer.paths:
newPath = GSPath()
newPath = path.copy()
addToLayer.append(newPath)
for node in newPath.nodes:
node.x += shiftX
node.y += shiftY
for path in addToLayer:
thisLayer.addPath_(path)
for path in thisLayer.paths:
path.selected = True
thisLayer.connectAllOpenPaths()
Is there a way to access via script the ‘Close Open Paths’?
thisLayer.connectAllOpenPaths() still does nothing in my code, for instance on these nodes:
Is there another import I should include or am I calling it wrong?
The open pieces seem to be double and overlap the normal outline. Can you double click next the the curve and Cmd+Arrow right move the selection? I suspect that it is a full outline and some unneeded pieces will be left.
Sadly- none found
Also- is seems to work as one unit, shifting all together nicely.
just not actually closing. (nor is thisLayer.correctPathDirection() doing anything- thought that might help…)
Is there somewhere (couldn’t find) I can see how it’s done in OffsetCurve filter? Although the filter itself doesn’t answer what I need exactly, maybe it’s close?
I think this might be due to adding a path manually and maybe doing it wrong?
connectingPaths = NSMutableArray.array()
for path in thisLayer.paths:
# create a two-point path with the first nodes:
connectingPath1 = GSPath()
n1 = newPath.nodes[0]
n2 = path.nodes[0]
connectingPath1.addNode_(n1)
connectingPath1.addNode_(n2)
# add the path to the layer
connectingPaths.append(connectingPath1)
for path in connectingPaths:
thisLayer.addPath_(path)
The main objective is to create a version of BoradNibber for Hebrew glyphs.
In Hebrew the contrast is in an opposite direction to the one found in Latin glyphs, and BroadNibber can’t seem to handle that (tried originally to tweak the open code for that).
After some rounds of coding, I decided to try and code it myself (mainly- not using the OffsetCurve Filter, which seems to be the main problem for the flipped contrast).
Attached are two screenshots:
prior to creating the path, connecting the first and last nodes (just duplicated and shifted the original)
after creating the path from the 2 nodes, prior to trying to draw the path (as in the snippet above). This has an effect on the lower nodes some how, they look a bit off.
It seems that the copying or the reversing of the paths was not done correctly. You see the strange direction of the end node indicators (the blue line and the arrow)?
Can you show the full code? Do you have it on GitHub already?
Yes, tried that as a starting point, and it still didn’t work properly- the output looked off in a Hebrew context.
Also tried to change the rotation matrix (worked better, not enough though)
This is the outcome of running the script of copying the path, without creating the connecting paths the first and last nodes (just duplicated and shifted the original)
The funny arrows you noted only appear after creating the connecting paths (even without adding them to the layer paths yet, just declaring and initializing them)