Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)
One problem is sort of subtle: in line 3 you use a try/except for a condition that won't really generate an error. If the actor is not a magnet-base, IsBase will simply give 0, which is not an error. So this just needs a plain old If, not a try/except. (I committed this error OFTEN when I first started Pythoning, so I know it well!) The second problem is that you use "actor" for the list-of-actors obtained from scene.Actors(), and also use "actor" for a member of that list. Third problem is that you didn't actually select the actor before deleting it. Below is a version that works: #------------------------------ scene = poser.Scene() for actor in scene.Actors(): # Go through all actors ~if actor.IsBase(): # is it a magnet base? ~~scene.SelectActor(actor) # if so, select it, ~~scene.DeleteCurrentProp() # and then delete it.
My python page
My ShareCG freebies
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
I know you cannot delete elements of a mesh figure, such as an arm or finger, But what about magnets? If you delete the base, the magnets heirarchy is also deleted. How can I delete the base?
I think the code below should work by looking at all the actors and deleting any magnet base it finds, however the closest function for deleting it I could find is "DeleteCurrentProp()". Needless to say, it dosen't work!
############################
scene = poser.Scene()
actor = scene.Actors()
~for actor in actors:
~~try: