Forum: Poser Python Scripting


Subject: Script help

Uncanny_Film opened this issue on Aug 21, 2023 ยท 4 posts


Uncanny_Film posted Mon, 21 August 2023 at 10:54 AM

Hi, I'm trying to learn code. And I wanted to create a poser script. I tried to make a simple zero transition script. But I got this error message:

Traceback (most recent call last):

  File "C:\Users\spart\Documents\1.py", line 18, in <module>

    set_rotation_axes_to_zero()

  File "C:\Users\spart\Documents\1.py", line 9, in set_rotation_axes_to_zero

    current_selection.SetXRotation(0)

AttributeError: 'poser.ActorType' object has no attribute 'SetXRotation'




What am I doing wrong? Thanks

Here's my code:




import poser


def set_rotation_axes_to_zero():

    # Get the currently selected object in Poser

    current_selection = poser.Scene().CurrentActor() or poser.Scene().CurrentProp()


    if current_selection is not None:

        # Set X, Y, and Z rotations to zero

        current_selection.SetXRotation(0)

        current_selection.SetYRotation(0)

        current_selection.SetZRotation(0)


        print("Rotation axes set to zero for the selected object.")

    else:

        print("No object selected.")


# Call the function to set rotation axes to zero

set_rotation_axes_to_zero()







Win10 - AMD 2nd Gen Ryzen Threadripper 2950X, 16-Core, 32 Thread 4.4 GHz - 128GB Ram - X2 GeForce RTX 3060 Ti - 3D-connexion  

Poser 12 | Octane Render |  Real-Flow | 3DCoat | Speed Tree | Adobe Premiere  |  Adobe After Effects |  Adobe Audition |  Adobe Photoshop