OberonRex opened this issue on Oct 15, 2023 ยท 6 posts
OberonRex posted Sun, 15 October 2023 at 9:29 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
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
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:
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.