Sun, Feb 16, 5:25 PM CST

Renderosity Forums / Poser Python Scripting



Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2025 Feb 05 6:41 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 tell a Python script to read a geometry from an .OBJ geometry file?


Anthony Appleyard ( ) posted Sun, 22 July 2018 at 12:17 AM · edited Sun, 04 August 2024 at 5:12 PM

How can I tell a Python script to read a geometry from an .OBJ geometry file?


FVerbaas ( ) posted Thu, 26 July 2018 at 5:00 AM · edited Thu, 26 July 2018 at 5:02 AM
Forum Coordinator

Hello Anthony,

I promised to get back to you sooner. Apologize for the delay.

The shortest example one I have ready at hand is this: (you will ned to set the filename correct for your system)

#---------------------------------
# Get the actor and the Import-Export object
#---------------------------------
scene = poser.Scene()
print "preparing ..."
imExObject = scene.ImExporter()


print ""
print "getting OBJ Export Options..."
imoptions = imExObject.ImportOptions("obj", None)
for key in imoptions.keys():
       print key, ':', imExObject.ImportOptionString("obj", None, key), '=', imoptions[key]

print "setting options"
imoptions[7] = 1
imoptions[poser.kImOptCodeCENTERED] = 0
for key in imoptions.keys():
       print key, ':', imExObject.ImportOptionString("obj", None, key), '=', imoptions[key]

try:
#---------------------------------
# import it
#---------------------------------
  imExObject.Import("obj", "File Format Wavefront", "C:UsersPublicDocumentsPoserMDForMD.obj", imoptions)

  print "Import succeeded"

except:
  print "Import failed -- please check the file name"

further control over the import options can be through setting the full bunch of import options:

imoptions[poser.kImOptCodeMAKEPOLYNORMSCONSISTENT] = 0 
imoptions[poser.kImOptCodeOFFSETX] = 0.0
imoptions[poser.kImOptCodeOFFSETY] = 0.0
imoptions[poser.kImOptCodeOFFSETZ] = 0.0 
imoptions[poser.kImOptCodeFLIPUTEXTCOORDS] = 0
imoptions[poser.kImOptCodeFLIPVTEXTCOORDS] = 0
imoptions[poser.kImOptCodeWELDIDENTICALVERTS] = 1
imoptions[poser.kImOptCodeCENTERED] = 0
imoptions[poser.kImOptCodePERCENTFIGSIZE] = -1
imoptions[poser.kImOptCodeFLIPNORMS] = 0
imoptions[poser.kImOptCodePLACEONFLOOR] = 0

I hope this answers your question. One thing: In the present public version of Poser imoptions[poser.kImOptCodeWELDIDENTICALVERTS] = 1 does not work. You cannot at this moment fake welded export by unwelded export, import as a prop with the welding option, and re-export. This works under manual control but not when called from Python.


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.