delete all annotations in maya scene

76 views
Skip to first unread message

e955...@gmail.com

unread,
Oct 1, 2014, 7:22:40 AM10/1/14
to python_in...@googlegroups.com
Hello all,

im trying to write some python to delete all annotations i have in my maya scene. The problem is i don't know what flag to put as 'type' so i can select all to delete.

i did cmds.objectType and found it was a 'transform' type. but this keyword doesn't work as a flag. so a bit confused

here is my current code:

#######################################
import maya.cmds as cmds

selection=cmds.select(cmds.listRelatives(cmds.ls(type='transform'), p=True, path=True), r=True)

cmds.delete()
######################################

if anyone could tell me the correct flag to delete the annotations i have created it would be awesome,

thanks,
Sam

Marcus Ottosson

unread,
Oct 1, 2014, 7:31:52 AM10/1/14
to python_in...@googlegroups.com

You can lookup the available types here:
http://help.autodesk.com/cloudhelp/2015/ENU/Maya-Tech-Docs/Nodes/index.html

In this case, you’re looking for “camera”. You can also see it in the attribute editor, next to it’s name.

Pro tip: for fancy code-formatting via the list or gmail, like this:

import maya.cmds as cmds
selection=cmds.select(cmds.listRelatives(cmds.ls(type='transform'), p=True, path=True), r=True)
cmds.delete()

Try Markdown Here

Best,
Marcus



--
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/c3e4b964-2c39-42cb-9a98-2c4cbbad2c8d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Marcus Ottosson

unread,
Oct 1, 2014, 7:32:09 AM10/1/14
to python_in...@googlegroups.com

Sorry, not sure why I thought you were looking for cameras. :) Have a look at the type of annotation in the Attribute editor and put that in the type field.

--
Marcus Ottosson
konstr...@gmail.com

kevco...@gmail.com

unread,
Oct 1, 2014, 5:09:33 PM10/1/14
to python_in...@googlegroups.com
I think the type your looking for is "annotationShape"

#========
import pymel.core as pm

pm.delete( pm.ls( type="annotationShape" ) )
#========

e955...@gmail.com

unread,
Oct 3, 2014, 6:10:25 AM10/3/14
to python_in...@googlegroups.com, e955...@gmail.com
perfect, thanks alot guys!!
Reply all
Reply to author
Forward
0 new messages