how to get shape type on an object with no construction history?

20 views
Skip to first unread message

jettam

unread,
Oct 11, 2017, 10:43:47 PM10/11/17
to Python Programming for Autodesk Maya
If I have deleted the construction history of a primitive object. Is there any way to find out the object type? (sphere, cube, cylinder)

For example I have cylinders, spheres, cubes that make up an object. I want to recreate that object with code but I will need to know they primitive type so I can rebuild it.  Any suggestions how I can do that? 

Marcus Ottosson

unread,
Oct 12, 2017, 5:03:21 AM10/12/17
to python_in...@googlegroups.com

No.

When you make an object, what happens is this.

  1. A generic node of type mesh is created
  2. Another node is created capable of generating the desired object, e.g. polyCube
  3. The mesh node, referred to as a “shape” is parented under another node of type transform and finally..
  4. The generator is connected to the mesh.

When you clear history, you are embedding the generated mesh into the mesh node and deleting the generator. From there, there is no relation anymore between the generator and the mesh. It’s just a bunch of points, edges and polygons.

If you need to keep track of what they once where, you could create a custom string attribute and put e.g. "polyCube" into it, or perhaps the command you used to create it. From there, you could programatically figure out how to recreate it.


On 12 October 2017 at 03:43, jettam <justin...@gmail.com> wrote:
If I have deleted the construction history of a primitive object. Is there any way to find out the object type? (sphere, cube, cylinder)

For example I have cylinders, spheres, cubes that make up an object. I want to recreate that object with code but I will need to know they primitive type so I can rebuild it.  Any suggestions how I can do that? 

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/2d2ac8a8-1f7c-4936-bcf2-f850bb4479c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages