Sat, Dec 28, 5:58 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 Dec 02 3:16 pm)

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 find the height of a figure in python?


maur_2005 ( ) posted Sat, 05 December 2020 at 2:30 PM · edited Sat, 28 December 2024 at 5:23 AM

Hi folks, is there any way to find the height of the current figure in poser units with a python script? any ideas?


HartyBart ( ) posted Sat, 05 December 2020 at 3:29 PM · edited Sat, 05 December 2020 at 3:29 PM

Poser 11 Pro, which everyone should have by now, has measurement tools built it. I recall that these are geared to the crowd who use Poser for forensic crime-scene reconstruction and medical uses. Thus there may well be such tools built in to Poser - you might usefully check the manual on that before writing a new script.



Learn the Secrets of Poser 11 and Line-art Filters.


adp001 ( ) posted Sat, 05 December 2020 at 4:52 PM

HartyBart posted at 4:46PM Sat, 05 December 2020 - #4406507

Poser 11 Pro, which everyone should have by now, has measurement tools built it. I recall that these are geared to the crowd who use Poser for forensic crime-scene reconstruction and medical uses. Thus there may well be such tools built in to Poser - you might usefully check the manual on that before writing a new script.

That doesn't help.

A script has no possibility to create a measurement prop. Nor to access one to measure something.




adp001 ( ) posted Sat, 05 December 2020 at 5:55 PM · edited Sat, 05 December 2020 at 6:02 PM

Here is somethin that works:

import numpy as np

poserfactor = 0.0038145

figure = poser.Scene().CurrentFigure()
scale = figure.RootActor().ParameterByCode(poser.kParmCodeASCALE).Value()
geom, _, _ = figure.UnimeshInfo()
verts = np.array([[v.X(), v.Y(), v.Z()] for v in geom.Vertices()])
height = (np.max(verts[:, 1]) - np.min(verts[:, 1])) * scale / poserfactor
print("Figure height: {:0.2f} Centimeters".format(height))

Maybe you want to deal with the fact that scale is done on actor-basis (e.g. shorter legs). It can go really complicated If you need 100% exact values under all cirumstances. Think of a figure where parts are scaled via morphs for sick people with a bended spine.

I got the "poserfactor" this way:

Go to General Preferences -> Interface and set Units to what you like to measure (I used "Centimeters"). Close preferences. Dial "1" into "yTran". Go back to preferences and set Units to PNU (poser native units). yTrans should now show you a value to use for division (maybe you have to dial any other one to wake up Poser and make him show the changed value).

Or, look up the web or the forum. I bet someone did a list with all possible numbers :)




maur_2005 ( ) posted Mon, 07 December 2020 at 1:59 PM

Thank you Adp001. I was thinking about measuring according to the type of figure, but I think your approach is better In the figures with size morphs we can check the values of Y Scales


adp001 ( ) posted Tue, 08 December 2020 at 9:33 PM

maur_2005 posted at 9:23PM Tue, 08 December 2020 - #4406672

Thank you Adp001. I was thinking about measuring according to the type of figure, but I think your approach is better In the figures with size morphs we can check the values of Y Scales

Y Scale will not help if I let the scales for all bones alone and shorten the figures leg with a morph (remember, from P11 on we can set the joint centers accordingly to make such a change work).




adp001 ( ) posted Wed, 09 December 2020 at 4:06 AM

Another problem with this type of measurment: Make your figure sit or laying on the floor...




structure ( ) posted Wed, 09 December 2020 at 1:50 PM · edited Wed, 09 December 2020 at 1:52 PM
Forum Coordinator
class getunits:
    def analyze ( self , event = None ):
        units, uDisplay = self.unitCalc()
        cType = (u'PNU',u'in',u'ft',u'mm',u'cm',u'm')[['PNU','Inches','Feet','MM','CM','Metres'].index(units)]
        convert  = self.ConvertToPNU(1.0, cType)
        return units

    def unitCalc( self, event = None ):
        prefs=os.path.join(poser.PrefsLocation(),'poser.ini')
        if os.path.exists(prefs):
            pref=open(prefs,'rb').readlines()
            for line in pref:
                if line.lower().startswith('unit'):
                    line = line.split(' ')
                    if 'FACTOR' in str(line[0]):
                        units = float((line)[1])
        uDisplay, pType = float(self.response(units)[1]) , self.response(units)[0] 
        return pType, uDisplay

    def ConvertToPNU( self, value = 1, unit = '' ):
        multiplier = (1.0, 103.2, 8.6, 2621.28, 262.128, 2.62128)[[u'PNU', u'in', u'ft', u'mm', u'cm', u'm'].index(unit)]
        return value * multiplier

getunits = getunits()
analyze = getunits.analyze()

print analyze

get your own units or convert them using this script ( will need a little modification for purpose).

Locked Out


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.