textCurves command not working in 2022

textCurves command not working in 2022

dominic.9
Observer Observer
574 Views
4 Replies
Message 1 of 5

textCurves command not working in 2022

dominic.9
Observer
Observer

I am having issues with the textCurves command in maya 2022. 

 

It gives me this error: 

 

"Failed to create the text with the specified font"

 

By not specifying the font I want it to use, the command should use a default font, but it just gives me the error I specified above.

 

I am at a loss to what it could be. 

 

Here is an example of the code; 

 

Import maya.cmds as cmds cmds.textCurves(text = "curve", name = "curvetext")

 

I have also asked a few friends to run this code on their machines, one has maya 2020 and the other has maya 2023 and it works for them. 

0 Likes
575 Views
4 Replies
Replies (4)
Message 2 of 5

FirespriteNate
Advocate
Advocate

I'm running on Maya 2022.5 and it works fine for me here.

 

Does it work if you call the Run Time Command? (cmds.CreateText(), or just plain CreateText; in MEL)

 

Does it work if you create the text using the Options Dialog - i.e. not using code (I don't know where this is on the menus, but the command is: cmds.CreateTextOptions() or CreateTextOptions; in MEL)?

 

I noticed that the default font it wanted to use for me changed once I opened the options dialog, so maybe your current default is corrupt, maybe opening the options and changing (or resetting) the settings could fix it?

 

If none of that works, is it your Maya prefs? (back up your prefs and launch Maya with clean prefs, see if the problem persists. If it's still broken, just restore your old prefs folder, but if it's fixed, then your old prefs were corrupt).

 

Unless there is something wrong with your OS font cache (not related to Maya) I'm not sure what else to suggest.

Message 3 of 5

Kahylan
Advisor
Advisor

Hi!

 

Up until Maya 2016, this used to be a UI command with an Optionsbox. So when you don't specify a font, it acutally doesn't use a default font, but it will get all the settings it is missing from the option variables that indicate how the optionsbox settings for that command are. Same as with every other command that has an options box.

 

The optionVar for this specific setting can be querried using this command:

setFont = cmds.optionVar(q= 'textCurvesFont')

 

if it is set to some weird value, I would try to reset it, using this command:

setFont = cmds.optionVar(sv= ['textCurvesFont',"Times|wt:50|sz:28|sl:n|st:100"])

 

Now as @FirespriteNate already mentioned, if you open the options box via command (there is no UI equivalent anymore since 2017), the font will automatically change from "Times" to "Times New Roman" for some reason. If you don't have that font installed, you'll get the Error you mentioned.

I would try to provide the font in the command to see if it works then.

 

import maya.cmds as cmds 


cmds.textCurves(text = "curve", name = "curvetext", f = "Times")

 

 

 

import maya.cmds as cmds 


cmds.textCurves(text = "curve", name = "curvetext", f = "Times New Roman")

 

 

 

import maya.cmds as cmds 


cmds.textCurves(text = "curve", name = "curvetext", f = "Arial")

 

 

But tbh, I would probably stay away from legacy commands like this, it hasn't been updated in 7 years, changing fonts after creation doesn't even work properly anymore. There are more reliable ways to get curve text using the type tool.

I hope it helps!

 

 

Message 4 of 5

dominic.9
Observer
Observer

Hey guys, 

 

Thank you both for responding! 

 

So what I did was update 2022 to the latest version (2022.5) based on what firespritenate said.

 

Although it is working now I will be testing out kahylans scripts today when i am free. 

 

Using the polygon type tool works as it should. But the createTextOptions command does not work correctly.

 

I just wanted something in my script that didn't involve me deep diving into maya api to make this work, or, to fight with the createtextoptions command lol 

 

I can always add a confirmdialog that will pop up of the textCurves commands error to say to update their maya 2022 

 

I will reach back soon! Thanks again! 

0 Likes
Message 5 of 5

juntao_chenDJ245
Community Visitor
Community Visitor

Not sure if this helps anyone, but I had the same issue as OP, though I'm using Maya 2020.4, I got the same exact error just by running the MEL command textCurves. I narrowed the cause down to preferences causing some sorta conflict, since it works fine after I backed them up then nuked my preferences. So, I incrementally restored my preferences and tested each time, and pin-pointed the issue down to a few lines of MEL code within the userPrefs.mel. All I ended up doing to fix it was to delete any line of code that starts with "textCurves*", saved the edit and restarted Maya.

0 Likes