When we set the relative to true, then move this object along x axis one unit, the object coordinate will be (3, 0, 0). For example, if we have a sphere located in (2, 0, 0). This parameter controls whether the transform values are relative to object current location. You can see, that in this move function, we have a parameter names relative.
MAYA PYTHON SETATTR OF MULTIPLE OBJECTS HOW TO
(I will explain how to use official manual at the end of this article) You can see there are a bunch of optional parameters in this move function, and most of them are boolean type. This is how official manual explain about move() command:
MAYA PYTHON SETATTR OF MULTIPLE OBJECTS CODE
Even if you do not have a selected object, this code will not issue an error, it just does nothing. Basically, if you already selected an object, this code will apply transformation to the selected object. If you notice there are square brackets in this function, which mean these attributes are optional (You do not need to specify this parameter, it has a default value). object names represent objects which will be transformed. The xyz offset represents the offset distance. Mc.move(X offset, y offset, z offset,, ) We can use Python script to transform geometry objects (transform includes translate, rotation and scale). If you want to get access to the element “apple”, you should write like this “Basket.apple”. Now, you can refer to this container by calling its name, “Basket”. Let’s say you name this box as “Basket”, and you put three elements in this box, which respectively named as “apple”, “banana” and “grape”. A great metaphor for this is that you can consider class or structure as a container, may be like a box. ‘ between class name and specific element. Basically, in object oriented language, if you have a class or structure and you want to get access to the elements in this class or structure, you can use ‘. Tips: In case you are not so familiar with Object oriented programming language, I want to give more explanations about polySphere1.radius. You could use similar syntax to create other base geometry: Make sure the name in your code matches the name from the name from input window. Be careful about the name here, when we set the attribute value, we are in fact changing the attributes from the input node. Here I change the existing sphere radius value to 2 from 1.
SetAttr command can be used to modify the attributes of existing objects. Remember, the default segments for sphere in maya should be 20, if you do not change the default settings. Using the above command, we can create a sphere geometry with 8 segments along each axis. You can also change the default attribute of the sphere when creating it. Mc.polySphere() can be used to create a default sphere geometry, I did not assign any attributes so that the attributes for this sphere will be default, the radius should be 1, it will locate at (0, 0, 0). Mc.baseGeometry() #I have already discussed mc in my previous article The first thing I want to discuss is how to create basic geometry in maya using python script. This is the official manual, for more details, please refer: I discuss more about this because some of you guys may not be so experienced with programming language, hope more examples will give a better idea about how to convert maya command. Here, I will talk about some common commands, for more commands, you could convert yourself using the methodology I discussed in previous article. I will also talk about Python list, python functions, and branches and loops. In this article, I will introduce some common maya commands for scripting. In the last article, I introduced some basic work flow related maya python.