<?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[[python] SetFont not working]]></title><description><![CDATA[<p dir="auto">Hello<br />
C4D version: 20.059<br />
OS: Windows 10</p>
<p dir="auto">I select motext and try to change font(fontdata) for text by script</p>
<pre><code>import c4d
from c4d import plugins
def main() :
  bc = c4d.BaseContainer()
  bc.SetString(500, 'Arial')
  bc.SetString(501, '11')
  bc.SetInt32(502, 400)
  bc.SetInt32(503, 0)
  bc.SetString(509, 'Arial')
  bc.SetString(508, 'ArialMT')
  # select mograph text
  op[c4d.PRIM_TEXT_FONT].SetFont(bc)
  op.Message(c4d.MSG_CHANGE)
  c4d.EventAdd()
if __name__=='__main__':
  main()
</code></pre>
<p dir="auto">can not get it work <img src="http://developers.maxon.net/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/2639.png?v=0b8ddba251d" class="not-responsive emoji emoji-android emoji--white_frowning_face" style="height:23px;width:auto;vertical-align:middle" title=":white_frowning_face:" alt="☹" /></p>
]]></description><link>http://developers.maxon.net/forum/topic/11707/python-setfont-not-working</link><generator>RSS for Node</generator><lastBuildDate>Mon, 20 Apr 2026 21:15:19 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/11707.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 06 Aug 2019 10:36:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [python] SetFont not working on Wed, 07 Aug 2019 11:45:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/m_adam">@<bdi>m_adam</bdi></a> said in <a href="/post/58969" target="_blank" rel="noopener noreferrer nofollow ugc">[python] SetFont not working</a>:</p>
<blockquote>
<p dir="auto">In which version are you? The code I posted is working nicely in R20.059.</p>
</blockquote>
<p dir="auto">20.059. Before i tried any methods, that's my fail. Not work for me. From new start of c4d. - it works</p>
]]></description><link>http://developers.maxon.net/forum/post/58971</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/58971</guid><dc:creator><![CDATA[iluxa7k]]></dc:creator><pubDate>Wed, 07 Aug 2019 11:45:10 GMT</pubDate></item><item><title><![CDATA[Reply to [python] SetFont not working on Wed, 07 Aug 2019 09:41:04 GMT]]></title><description><![CDATA[<p dir="auto">In which version are you? The code I posted is working nicely in R20.059.</p>
]]></description><link>http://developers.maxon.net/forum/post/58969</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/58969</guid><dc:creator><![CDATA[m_adam]]></dc:creator><pubDate>Wed, 07 Aug 2019 09:41:04 GMT</pubDate></item><item><title><![CDATA[Reply to [python] SetFont not working on Wed, 07 Aug 2019 09:33:44 GMT]]></title><description><![CDATA[<p dir="auto">Hello Maxime<br />
Thank you.<br />
I tried such form and can not get it work. I think i'm "messing"(replace FontData to BaseContainer) data for GUI, so it does not work for me.</p>
]]></description><link>http://developers.maxon.net/forum/post/58968</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/58968</guid><dc:creator><![CDATA[iluxa7k]]></dc:creator><pubDate>Wed, 07 Aug 2019 09:33:44 GMT</pubDate></item><item><title><![CDATA[Reply to [python] SetFont not working on Wed, 07 Aug 2019 08:43:36 GMT]]></title><description><![CDATA[<p dir="auto">The issue you figured out is pretty common in python. So actually when you do op[c4d.PRIM_TEXT_FONT] (aka GetParameter) you retrieve a copy of this CustomDataType. That means if you want to modify something it will not be reflected in the UI.</p>
<p dir="auto">Finally, you don't need all the update code only a c4d.EventAdd is enough.</p>
<pre><code>import c4d

def main():
    # Retrieves a copy of the actual FontData
    fontData = op[c4d.PRIM_TEXT_FONT]
    
    # Defines parameters for this FontData
    bc = c4d.BaseContainer()
    bc.SetString(500, 'Arial')
    bc.SetString(501, '11')
    bc.SetInt32(502, 400)
    bc.SetInt32(503, 0)
    bc.SetString(509, 'Arial')
    bc.SetString(508, 'ArialMT')
    fontData.SetFont(bc)
    
    # Push back this FontData into the object
    op[c4d.PRIM_TEXT_FONT] = fontData
    
    # Pushes an update event to Cinema 4D
    c4d.EventAdd()

# Execute main()
if __name__=='__main__':
    main()
</code></pre>
<p dir="auto">Cheers,<br />
Maxime.</p>
]]></description><link>http://developers.maxon.net/forum/post/58967</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/58967</guid><dc:creator><![CDATA[m_adam]]></dc:creator><pubDate>Wed, 07 Aug 2019 08:43:36 GMT</pubDate></item><item><title><![CDATA[Reply to [python] SetFont not working on Tue, 06 Aug 2019 15:42:53 GMT]]></title><description><![CDATA[<p dir="auto">Found such solution:</p>
<pre><code>import c4d

def main():

    bc = c4d.BaseContainer()
    ids = c4d.PRIM_TEXT_FONT
    #ids = c4d.DescID(c4d.DescLevel(2117,1009372,5178))
    op.SetParameter(ids, bc, c4d.DESCFLAGS_SET_0)
    bc.SetString(500, 'Arial')
    bc.SetString(501, '11')
    bc.SetInt32(502, 400)
    bc.SetInt32(503, 0)
    bc.SetString(509, 'Arial')
    bc.SetString(508, 'ArialMT')
    new_fd = c4d.FontData()
    new_fd.SetFont(bc)
    op.SetParameter(ids, new_fd, c4d.DESCFLAGS_SET_0)    
    c4d.SendCoreMessage(c4d.COREMSG_CINEMA, c4d.BaseContainer(c4d.COREMSG_CINEMA_FORCE_AM_UPDATE))
    c4d.gui.GeUpdateUI()
    c4d.EventAdd()

# Execute main()
if __name__=='__main__':
    main()
</code></pre>
]]></description><link>http://developers.maxon.net/forum/post/58961</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/58961</guid><dc:creator><![CDATA[iluxa7k]]></dc:creator><pubDate>Tue, 06 Aug 2019 15:42:53 GMT</pubDate></item></channel></rss>