<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Add an anchor]]></title><description><![CDATA[<p dir="auto">Simple question, how the heck do I add an anchor? (in python)</p>
]]></description><link>https://forum.robofont.com/topic/288/add-an-anchor</link><generator>RSS for Node</generator><lastBuildDate>Thu, 14 May 2026 03:45:01 GMT</lastBuildDate><atom:link href="https://forum.robofont.com/topic/288.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 15 Nov 2013 21:22:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Add an anchor on Tue, 02 Jan 2018 22:19:51 GMT]]></title><description><![CDATA[<p dir="auto">Simple question, how the heck do I add an anchor? (in python)</p>
]]></description><link>https://forum.robofont.com/post/288</link><guid isPermaLink="true">https://forum.robofont.com/post/288</guid><dc:creator><![CDATA[qkeave]]></dc:creator><pubDate>Tue, 02 Jan 2018 22:19:51 GMT</pubDate></item><item><title><![CDATA[Reply to Add an anchor on Tue, 02 Jan 2018 22:13:45 GMT]]></title><description><![CDATA[<pre><code class="language-python">g = CurrentGlyph()
g.appendAnchor("name", (100, 100))
</code></pre>
<p dir="auto">see also <a href="http://www.robofab.org/objects/glyph.html" rel="nofollow">http://www.robofab.org/objects/glyph.html</a></p>
<p dir="auto">good luck</p>
]]></description><link>https://forum.robofont.com/post/1121</link><guid isPermaLink="true">https://forum.robofont.com/post/1121</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Tue, 02 Jan 2018 22:13:45 GMT</pubDate></item><item><title><![CDATA[Reply to Add an anchor on Tue, 26 Nov 2013 05:54:09 GMT]]></title><description><![CDATA[<p dir="auto">thank you!</p>
]]></description><link>https://forum.robofont.com/post/1122</link><guid isPermaLink="true">https://forum.robofont.com/post/1122</guid><dc:creator><![CDATA[qkeave]]></dc:creator><pubDate>Tue, 26 Nov 2013 05:54:09 GMT</pubDate></item><item><title><![CDATA[Reply to Add an anchor on Tue, 02 Jan 2018 22:19:02 GMT]]></title><description><![CDATA[<p dir="auto">Thanks and sorry! I'm probably not as good at searching as I thought I was.<br />
BUT, this of course leads to more questions.</p>
<ul>
<li>How do I set guides to measure</li>
<li>How do I ACTUALLY remove guides (because I can't get <code>removeGuide()</code> to work)</li>
</ul>
<p dir="auto">I've attached the little tool I'm making below for context.</p>
<pre><code class="language-python">g = CurrentGlyph()
ancs = []
gd = ['Radial 0deg','Radial 20deg','Radial 40deg','Radial 60deg','Radial 80deg','Radial 100deg','Radial 120deg','Radial 150deg','Radial 160deg']

for a in g.anchors:
    b = a.name
    ancs.append(b)
    
if 'Radial Guide' not in ancs:
    g.appendAnchor("Radial Guide", (500, 500))

for a in g.guides:
    if a.name in gd:
        #THIS IS WHERE I WANT TO REMOVE THE GUIDE
        #removeGuide(a)
    
print g.guides

for a in g.anchors:
    if a.name == 'Radial Guide':
        x = a.x
        y = a.y
        g.addGuide((x, y), 90, name="Radial 0deg")
        g.addGuide((x, y), 110, name="Radial 20deg")
        g.addGuide((x, y), 130, name="Radial 40deg")
        g.addGuide((x, y), 150, name="Radial 60deg")
        g.addGuide((x, y), 170, name="Radial 80deg")
        g.addGuide((x, y), 190, name="Radial 100deg")
        g.addGuide((x, y), 210, name="Radial 120deg")
        g.addGuide((x, y), 230, name="Radial 150deg")
        g.addGuide((x, y), 250, name="Radial 160deg")
        #I JUST NEED TO SET THESE TO MEASURE

print ''
print 'Digested by Python.'
</code></pre>
]]></description><link>https://forum.robofont.com/post/1123</link><guid isPermaLink="true">https://forum.robofont.com/post/1123</guid><dc:creator><![CDATA[qkeave]]></dc:creator><pubDate>Tue, 02 Jan 2018 22:19:02 GMT</pubDate></item><item><title><![CDATA[Reply to Add an anchor on Tue, 02 Jan 2018 22:15:45 GMT]]></title><description><![CDATA[<p dir="auto">try this:</p>
<pre><code class="language-python">g.removeGuide(a)
</code></pre>
]]></description><link>https://forum.robofont.com/post/1124</link><guid isPermaLink="true">https://forum.robofont.com/post/1124</guid><dc:creator><![CDATA[thom]]></dc:creator><pubDate>Tue, 02 Jan 2018 22:15:45 GMT</pubDate></item><item><title><![CDATA[Reply to Add an anchor on Tue, 26 Nov 2013 17:40:20 GMT]]></title><description><![CDATA[<p dir="auto">thanks Thom that works,</p>
<p dir="auto">now I just need to figure how to turn on measurements with python</p>
]]></description><link>https://forum.robofont.com/post/1125</link><guid isPermaLink="true">https://forum.robofont.com/post/1125</guid><dc:creator><![CDATA[qkeave]]></dc:creator><pubDate>Tue, 26 Nov 2013 17:40:20 GMT</pubDate></item><item><title><![CDATA[Reply to Add an anchor on Tue, 02 Jan 2018 22:16:22 GMT]]></title><description><![CDATA[<p dir="auto">As measurements are a UI related attribute, it is not added to the robofab-like guide object.</p>
<p dir="auto">However you can change the display of measurements of a guide with:</p>
<pre><code class="language-python">glyph = CurrentGlyph()

guide = glyph.addGuide((100, 100), 90, "my guide")
guide.naked().showMeasurements = True
</code></pre>
<p dir="auto">to remove all guides you can also use <code>glyph.clearGuides()</code></p>
<p dir="auto">good luck!</p>
]]></description><link>https://forum.robofont.com/post/1135</link><guid isPermaLink="true">https://forum.robofont.com/post/1135</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Tue, 02 Jan 2018 22:16:22 GMT</pubDate></item><item><title><![CDATA[Reply to Add an anchor on Tue, 02 Jan 2018 22:16:51 GMT]]></title><description><![CDATA[<p dir="auto">and from a programming point of view it is maybe better to use <code>range(start, end, steps)</code></p>
<pre><code class="language-python"># print out an angle between 0° and 360° in steps of 15
for angle in range(0, 360, 15):
    print angle
</code></pre>
]]></description><link>https://forum.robofont.com/post/1136</link><guid isPermaLink="true">https://forum.robofont.com/post/1136</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Tue, 02 Jan 2018 22:16:51 GMT</pubDate></item><item><title><![CDATA[Reply to Add an anchor on Tue, 03 Dec 2013 06:13:03 GMT]]></title><description><![CDATA[<p dir="auto">Sorry --&gt; double post</p>
]]></description><link>https://forum.robofont.com/post/1137</link><guid isPermaLink="true">https://forum.robofont.com/post/1137</guid><dc:creator><![CDATA[qkeave]]></dc:creator><pubDate>Tue, 03 Dec 2013 06:13:03 GMT</pubDate></item><item><title><![CDATA[Reply to Add an anchor on Tue, 02 Jan 2018 22:17:18 GMT]]></title><description><![CDATA[<p dir="auto">Frederik, you are the man! I really appreciate the programming point.</p>
<p dir="auto">That being said I want to report a bug. &gt;_&lt;<br />
When you set the measurements via the scripting window it isn't reflected in the WYSIWYG editor, even after <code>CurrentFont().update()</code>.</p>
]]></description><link>https://forum.robofont.com/post/1138</link><guid isPermaLink="true">https://forum.robofont.com/post/1138</guid><dc:creator><![CDATA[qkeave]]></dc:creator><pubDate>Tue, 02 Jan 2018 22:17:18 GMT</pubDate></item><item><title><![CDATA[Reply to Add an anchor on Tue, 02 Jan 2018 22:17:51 GMT]]></title><description><![CDATA[<p dir="auto">mm, I cannot reproduce this bug</p>
<p dir="auto">sample script:</p>
<pre><code class="language-python">glyph = CurrentGlyph()
glyph.clearGuides()

for a in glyph.anchors:
    for angle in range(0, 180, 15):
        guide = glyph.addGuide((a.x, a.y), angle)
        guide.naked().showMeasurements = True
</code></pre>
]]></description><link>https://forum.robofont.com/post/1139</link><guid isPermaLink="true">https://forum.robofont.com/post/1139</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Tue, 02 Jan 2018 22:17:51 GMT</pubDate></item><item><title><![CDATA[Reply to Add an anchor on Tue, 02 Jan 2018 22:18:38 GMT]]></title><description><![CDATA[<p dir="auto">Well this is what I used (<a href="https://github.com/qkeave/Robofab-tools/blob/master/Radial%20Guides.py" rel="nofollow">https://github.com/qkeave/Robofab-tools/blob/master/Radial Guides.py</a>)</p>
<p dir="auto">PS. How do I enable PrettyPrint on my code?</p>
<pre><code class="language-python"># Add Radial Guides - Quinn Keaveney

g = CurrentGlyph()
ancs = []
gd = []

for angle in range(0, 180, 15):
    gd.append("Radial {0}deg".format(angle))

for a in g.anchors:
    b = a.name
    ancs.append(b)
    
if 'Radial Guide' not in ancs:
    g.appendAnchor("Radial Guide", (500, 500))

for a in g.guides:
    if a.name in gd:
        g.removeGuide(a)

for a in g.anchors:
    if a.name == 'Radial Guide':
        x = a.x
        y = a.y
        for angle in range(0, 180, 15):
            g.addGuide((x, y), angle, name=("Radial {0}deg".format(angle)))
            guide = g.addGuide((x, y), angle, name=("Radial {0}deg".format(angle)))
            guide.naked().showMeasurements = True

CurrentFont().update() 

print ''
print 'Digested by Python.'
</code></pre>
]]></description><link>https://forum.robofont.com/post/1140</link><guid isPermaLink="true">https://forum.robofont.com/post/1140</guid><dc:creator><![CDATA[qkeave]]></dc:creator><pubDate>Tue, 02 Jan 2018 22:18:38 GMT</pubDate></item><item><title><![CDATA[Reply to Add an anchor on Tue, 02 Jan 2018 22:19:23 GMT]]></title><description><![CDATA[<p dir="auto">see <a href="http://docs.python.org/library/pprint.html" rel="nofollow">http://docs.python.org/library/pprint.html</a></p>
<pre><code class="language-python">import pprint

data = &lsqb;&lsqb;"nested Item1", "nested Item2", "nested Item3", "nested Item4"], "item1", "item2"]
pprint.pprint(data)
</code></pre>
<p dir="auto">good luck!</p>
]]></description><link>https://forum.robofont.com/post/1143</link><guid isPermaLink="true">https://forum.robofont.com/post/1143</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Tue, 02 Jan 2018 22:19:23 GMT</pubDate></item><item><title><![CDATA[Reply to Add an anchor on Tue, 14 Jan 2014 06:33:20 GMT]]></title><description><![CDATA[<p dir="auto">Thanks!</p>
]]></description><link>https://forum.robofont.com/post/1145</link><guid isPermaLink="true">https://forum.robofont.com/post/1145</guid><dc:creator><![CDATA[qkeave]]></dc:creator><pubDate>Tue, 14 Jan 2014 06:33:20 GMT</pubDate></item></channel></rss>