Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 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.
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.
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 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).
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
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.
Hi folks, is there any way to find the height of the current figure in poser units with a python script? any ideas?