Forum: Poser Python Scripting


Subject: Duplicate figure

ironsoul opened this issue on Jun 02, 2017 ยท 5 posts


ironsoul posted Fri, 02 June 2017 at 12:57 AM

Hi Is there a way to duplicate an existing figure + child objects in a scene using the Python API, I can only see delete figure in the documentation.



structure posted Fri, 02 June 2017 at 2:54 AM Forum Coordinator

try this

# -*- coding: utf-8 -*- 

import poser

scene = poser.Scene()
figure = scene.CurrentFigure()
scene.SelectFigure( scene.Figure( figure.Name() ) ) 
if figure:
    poser.ProcessCommand( 1568 )

Locked Out


bagginsbill posted Fri, 02 June 2017 at 5:58 AM

Heheh. You have a little bit of extra, unnecessary code there. The expression

scene.Figure( figure.Name() )

is just going to give you back what you already have in figure, which is the currently selected figure.

As well, doing

scene.SelectFigure( scene.Figure( figure.Name() ) )

is just selecting the figure that is already selected.

That whole line doesn't do anything at all.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


ironsoul posted Fri, 02 June 2017 at 11:51 AM

Structure posted at 5:51PM Fri, 02 June 2017 - #4306486

try this

# -*- coding: utf-8 -*- 

import poser

scene = poser.Scene()
figure = scene.CurrentFigure()
scene.SelectFigure( scene.Figure( figure.Name() ) ) 
if figure:
  poser.ProcessCommand( 1568 )

Perfect, thank you.



structure posted Sat, 03 June 2017 at 2:50 AM Forum Coordinator

bagginsbill posted at 8:49AM Sat, 03 June 2017 - #4306493

Heheh. You have a little bit of extra, unnecessary code there. The expression

scene.Figure( figure.Name() )

is just going to give you back what you already have in figure, which is the currently selected figure.

As well, doing

scene.SelectFigure( scene.Figure( figure.Name() ) )

is just selecting the figure that is already selected.

That whole line doesn't do anything at all.

Thanks Ted.

ironsoul posted at 8:49AM Sat, 03 June 2017 - #4306525

Structure posted at 5:51PM Fri, 02 June 2017 - #4306486

try this

# -*- coding: utf-8 -*- 

import poser

scene = poser.Scene()
figure = scene.CurrentFigure()
scene.SelectFigure( scene.Figure( figure.Name() ) ) 
if figure:
    poser.ProcessCommand( 1568 )

Perfect, thank you.

You're Welcome.

Locked Out