Tue, Nov 19, 9:23 AM CST

Renderosity Forums / Poser Python Scripting



Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2024 Sep 18 2:50 am)

We now have a ProPack Section in the Poser FreeStuff.
Check out the new Poser Python Wish List thread. If you have an idea for a script, jot it down and maybe someone can write it. If you're looking to write a script, check out this thread for useful suggestions.

Also, check out the official Python site for interpreters, sample code, applications, cool links and debuggers. This is THE central site for Python.

You can now attach text files to your posts to pass around scripts. Just attach the script as a txt file like you would a jpg or gif. Since the forum will use a random name for the file in the link, you should give instructions on what the file name should be and where to install it. Its a good idea to usually put that info right in the script file as well.

Checkout the Renderosity MarketPlace - Your source for digital art content!



Subject: How to duplicate an actor and add to scene?


OberonRex ( ) posted Sun, 15 October 2023 at 9:29 AM · edited Tue, 19 November 2024 at 7:24 AM

Sorry for the newbie question, but I only recently started playing with Python under Poser and I get stuck a lot.

I have an actor, a greek-like column called pillar3. I can find it in script just fine. I want to duplicate it in script and add the duplicate to the current scene. Part of trying to create and lay out a matrix of columns.  All I've been able to find are suggestions to use copy, as in newActor = copy("pillar3") or a variant using copy.deepcopy, but copy isn't recognized so I'm doing it all wrong.

Could someone tell me how to do this?


Bastep ( ) posted Sun, 15 October 2023 at 10:24 AM · edited Sun, 15 October 2023 at 10:33 AM

import poser

poser.Scene().SelectActor(pillar3) #-- Selects an Actor, then ...
poser.ProcessCommand(1568) #-- 1568 is the menu code for duplicating an object. ProcessCommand, this function executes a menu command

For a figure use poser.Scene().SelectFigure(...)

Whereby the use of menucodes is such a thing. There is always the possibility that these can be changed. I have not experienced it yet, but the possibility exists.
You can find the codes in "Poser Software\Poser 13\Runtime\ui\Poseer.xrc"

Have a nice Sunday



OberonRex ( ) posted Sun, 15 October 2023 at 10:58 AM

Hmm. Trying to select the actor fails with:

Traceback (most recent call last):

  File "C:\Program Files\Poser Software\Poser 13\Runtime\Python\poserScripts\My Light Scripts\LayoutColumns.py", line 5, in <module>

    actor = poser.Scene().SelectActor("pillar3")

poser.error: Error parsing SetCurrentActor()

Usage: <NoneType> SetCurrentActor(<ActorType> actor)


Could it be that I've built my prop badly? It consists of multiple pipe sections and a couple of toruses.


Bastep ( ) posted Sun, 15 October 2023 at 11:28 AM · edited Sun, 15 October 2023 at 11:35 AM

You must not use the name "Pillar3", you must use the real object.

import poser

realpillar3object = poser.Scene().ActorByInternalName("Pillar3internname")
#-- the string Pillar3internname is only an example, you have to replace #-- it with the real internalname.
#-- The method ActorByInternalName returns #-- the real object.
poser.Scene().SelectActor(realpillar3object)
poser.ProcessCommand(1568)

You can find the internal name in the propertie panel:

SpS1R25KNsS4CiRqvj0vCr5NzJETYmnJh1QXpiSc.png



OberonRex ( ) posted Sun, 15 October 2023 at 11:39 AM

AWESOME! Thank you for the fine details. God, I hate feeling like such a newbie. I'm actually a years-and-years-and-years software techie, so it's a bit embarrassing to be so lost.

Thank you so much. You've made my weekend!


FVerbaas ( ) posted Mon, 16 October 2023 at 8:39 AM
Forum Coordinator

@Johnsta2oo: Welcome to the wonder world of PoserPython.


Privacy Notice

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.