I'd like to do the same to make each number right aligned but unfortunately unlike changing the font the alignment gives the same command every time in the script editor window: import .textAlignmentChange("type1") string $fontCmd = "expression -s \"type"+($i+1)+".fontSize = locator_C.FontSize \" -o typeMesh1 -n \"fontsize"+($i+1)+"\" -ae 1 -uc all " I set the font size using setAttr "type1.fontSize" 10 Įxcept in my program I use an expression and it gets the font size from a locator control's attributes and allows for dynamic font changing via code.
MAYA PYTHON LS U HOW TO
If anyone knows a way to do this or understands more about how the type tool works please let me know.Ģ) My other question is how to set the alignment of text. I think that I'm changing the contents of the text objects before maya has finished doing its text creation process and so having the program wait until it is done, then change things like font size and text would work better.
MAYA PYTHON LS U CODE
Here you can see the number 120 is missing after running my chart code twice, the selection of 600 is from it going over each text object after they were created. The good news is the text doesn't seem to mess up when maya has been restarted, only after running the script multiple times. Only seems to pause maya entirely and the text errors happen and so does the missing text objects. I'm not sure if having the program wait would help but the command
![maya python ls u maya python ls u](https://i.ytimg.com/vi/UUceVKmKvdw/maxresdefault.jpg)
Delete all objects and run the script again and look at each object and there ought to be some text missing from one of them.
![maya python ls u maya python ls u](https://cdna.artstation.com/p/media_assets/images/images/000/375/666/large/Screenshot_4.jpg)
Run the code once and it should spawn 10 text objects with different numbers. To give an idea here is some example code to spawn 10 text objects and set their numbers. I'm not sure what maya is doing when it goes over each text object but it seems the timing of this can conflict with my setting the text values and if maya is not freshly restarted it can interfere and cause text objects to be missing in the final graph. However, the process seems to be CreatePolygonType >Creates Text Object>Errors occur while the program selects each text object again.
![maya python ls u maya python ls u](https://i.ytimg.com/vi/4WAqHCv9kmE/maxresdefault.jpg)
I'm not entirely sure how the font object creation works but I use the mel command CreatePolygonType to create the type and then a python command to edit the type of each type object. However, there are two questions I have:ġ) When creating these text objects they create multiple errors and I'm assuming it has something to do with python. It's convoluted but I was able to write procedures to convert the numbers to hex and then use them to alter the text objects. I'm writing a program that takes in data from a file and displays it as a graph in maya and I'm using the text to display the numbers for the hash marks along the side and bottom of the graph. Hello, I was also wondering how to go about setting dynamic text and this thread helped me get started.