Thu, Jan 2, 2:40 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: 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: creaseAngle Method?


karibousboutique ( ) posted Sat, 28 February 2009 at 2:00 PM · edited Fri, 29 November 2024 at 8:35 PM

I'm trying to alter the crease angle (for poly smoothing) with a python script.  I don't see a "SetCreaseAngle()" method in any of the manuals or documentation, so should I assume it doesn't exist?  If it doesn't, is there anything else I can do to change this property?  It's in the properties tab, not in the parameters tab.  I'm stumped.

Intel Core i7-8700 6-Core 3.2 GHz (4.6 GHz Turbo), 32GB RAM, two GeForce GTX 1080 Ti GPUs

DS 4.10, Photoshop CC and CS6, Poser 11 Pro, Vue 2016, CarraraPro 64bit, Autodesk Inventor, Mudbox, and 3DS Max

One in 68 children is diagnosed with autism.  One is mine.


PhilC ( ) posted Sat, 28 February 2009 at 3:02 PM

There is a method that will turn smoothing on or off but I do not believe there is one to set the crease angle.

A solution would be to do it via a pose file in the format as below:-

Code:

<pre class="alt2" dir="ltr" style="border-right:1px inset;padding-right:6px;border-top:1px inset;padding-left:6px;padding-bottom:6px;margin:0px;border-left:1px inset;width:640px;padding-top:6px;border-bottom:1px inset;height:130px;text-align:left;">

 
{
    actor abdomen:1
    {
        creaseAngle 40
    }
}

You could write the script to prompt the user for a value then have it write the pose file and apply it.


karibousboutique ( ) posted Sat, 28 February 2009 at 3:10 PM

That should work!  Thanks, Phil.  Never would have thought to do that on my own. 

Intel Core i7-8700 6-Core 3.2 GHz (4.6 GHz Turbo), 32GB RAM, two GeForce GTX 1080 Ti GPUs

DS 4.10, Photoshop CC and CS6, Poser 11 Pro, Vue 2016, CarraraPro 64bit, Autodesk Inventor, Mudbox, and 3DS Max

One in 68 children is diagnosed with autism.  One is mine.


karibousboutique ( ) posted Sat, 28 February 2009 at 4:49 PM

Quote - There is a method that will turn smoothing on or off but I do not believe there is one to set the crease angle.

A solution would be to do it via a pose file in the format as below:-

Code:

<pre class="alt2" dir="ltr" style="border:1px inset;margin:0px;padding:6px;width:640px;height:130px;text-align:left;">
 
{
    actor abdomen:1
    {
        creaseAngle 40
    }
}

You could write the script to prompt the user for a value then have it write the pose file and apply it.

Phil,
I can't seem to get a pose file that works.  Every time I add "crease angle" to the pose, it tells me that it's not a valid poser file.  Is crease angle something that you can change with a pose?  If you have a pose file -- ANY pose file -- with a correct reference to this, I'd love to see an example.  

Karen

Intel Core i7-8700 6-Core 3.2 GHz (4.6 GHz Turbo), 32GB RAM, two GeForce GTX 1080 Ti GPUs

DS 4.10, Photoshop CC and CS6, Poser 11 Pro, Vue 2016, CarraraPro 64bit, Autodesk Inventor, Mudbox, and 3DS Max

One in 68 children is diagnosed with autism.  One is mine.


PhilC ( ) posted Sat, 28 February 2009 at 7:37 PM

For me the above worked exactly as is.

As does this below:-

{<br></br>
version<br></br>
    {<br></br>
    number 4<br></br>
    }<br></br>
actor abdomen:1<br></br>
    {<br></br>
    creaseAngle 40<br></br>
    }<br></br>
}


karibousboutique ( ) posted Sat, 28 February 2009 at 9:03 PM

That works.  I must have had some sort of syntax issue.

Intel Core i7-8700 6-Core 3.2 GHz (4.6 GHz Turbo), 32GB RAM, two GeForce GTX 1080 Ti GPUs

DS 4.10, Photoshop CC and CS6, Poser 11 Pro, Vue 2016, CarraraPro 64bit, Autodesk Inventor, Mudbox, and 3DS Max

One in 68 children is diagnosed with autism.  One is mine.


karibousboutique ( ) posted Sat, 28 February 2009 at 10:53 PM

Thanks for your help. The final result is here: http://www.karibousboutique.com/shares/setcreaseangle.zip

Works like a charm!

Karen  :)

Intel Core i7-8700 6-Core 3.2 GHz (4.6 GHz Turbo), 32GB RAM, two GeForce GTX 1080 Ti GPUs

DS 4.10, Photoshop CC and CS6, Poser 11 Pro, Vue 2016, CarraraPro 64bit, Autodesk Inventor, Mudbox, and 3DS Max

One in 68 children is diagnosed with autism.  One is mine.


PhilC ( ) posted Sun, 01 March 2009 at 3:54 AM

Cool you are apparently putting my Python manual to good use :)

However if you open temp.pz2 in a text editor you'll see where you are not quite right yet.

Change line 23 to:-
for actor in figure.Actors():

and in line 29 change currentActorName to actor.InternalName()

Hope that helps.


PhilC ( ) posted Sun, 01 March 2009 at 4:34 AM

Oh and you need to add the final brace } to the pose file.


karibousboutique ( ) posted Sun, 01 March 2009 at 9:40 AM · edited Sun, 01 March 2009 at 9:40 AM

Quote - Cool you are apparently putting my Python manual to good use :)

However if you open temp.pz2 in a text editor you'll see where you are not quite right yet.

Change line 23 to:-
for actor in figure.Actors():

and in line 29 change currentActorName to actor.InternalName()

Hope that helps.

Thank you for the help!!  And yes, the manual is a HUGE help! (You should go to lulu.com and offer it for sale in a bound version.  I've got mine printed in a binder, but a bound hardcover would be awesome!)

The currentActorName is a variable that I defined earlier with actor.InternalName.  (See line 9)

currentActorName = scene.CurrentActor().InternalName()

(I figured out the need for the internal name the hard way -- when the script ran but didn't change anything, LOL!)  And you're right about the end bracket. I'll fix that.

As for line 23...   So, the "for actor in figure.Actors()" can replace the counter I set up?  (Am I in the right spot?  I edit in notepad, so no line numbers!) Cool.

Thanks for your help!!

Intel Core i7-8700 6-Core 3.2 GHz (4.6 GHz Turbo), 32GB RAM, two GeForce GTX 1080 Ti GPUs

DS 4.10, Photoshop CC and CS6, Poser 11 Pro, Vue 2016, CarraraPro 64bit, Autodesk Inventor, Mudbox, and 3DS Max

One in 68 children is diagnosed with autism.  One is mine.


karibousboutique ( ) posted Sun, 01 March 2009 at 10:26 AM

Quote -

The currentActorName is a variable that I defined earlier with actor.InternalName.  (See line 9)

currentActorName = scene.CurrentActor().InternalName()

And now I understand...  Since it was defined in line 9... it uses the same name defined at the start of the program.

I defer to your Python Greatness.  :)

Thanks again!

Intel Core i7-8700 6-Core 3.2 GHz (4.6 GHz Turbo), 32GB RAM, two GeForce GTX 1080 Ti GPUs

DS 4.10, Photoshop CC and CS6, Poser 11 Pro, Vue 2016, CarraraPro 64bit, Autodesk Inventor, Mudbox, and 3DS Max

One in 68 children is diagnosed with autism.  One is mine.


karibousboutique ( ) posted Sun, 01 March 2009 at 1:48 PM

Phil, I've tweaked and updated.  (Script looks a tad different now because I poked around with it so much.)  It works, but not quite the way I want it to work.  If I use the "for actor in figure.Actors():" line as suggested, it goes through EVERY actor and writes a pose file that includes deformers, etc.  I can't get it to only work for ONLY bodypart actors.  If I leave the bodypart counter in, then my pose file does, indeed, have the correct number of body part lines in it -- but they all read the current actor.  The file has been updated at the previous link's location.  At your leisure, if you can offer a suggestion, I'd be very grateful.  (I'm cross-eyed from staring at the darn thing for so long!)

Thanks.
Karen

Intel Core i7-8700 6-Core 3.2 GHz (4.6 GHz Turbo), 32GB RAM, two GeForce GTX 1080 Ti GPUs

DS 4.10, Photoshop CC and CS6, Poser 11 Pro, Vue 2016, CarraraPro 64bit, Autodesk Inventor, Mudbox, and 3DS Max

One in 68 children is diagnosed with autism.  One is mine.


PhilC ( ) posted Sun, 01 March 2009 at 2:03 PM

Try:-

for actor in figure.Actors():<br></br>
    if actor.IsBodyPart():<br></br>
        # do-stuff #<br></br>
    else:<br></br>
       
pass<br></br>

In the copy of the script that you posted earlier you have the test for body part first so that providing that the current actor is a body part then the pose file will get written for everything. Conversely if you test each actor you can be selective.


karibousboutique ( ) posted Sun, 01 March 2009 at 2:16 PM

I swear, I THOUGHT I already tried that...  But I just did exactly what you wrote, and Voila!  Perfect.

Thanks, Phil!!

Intel Core i7-8700 6-Core 3.2 GHz (4.6 GHz Turbo), 32GB RAM, two GeForce GTX 1080 Ti GPUs

DS 4.10, Photoshop CC and CS6, Poser 11 Pro, Vue 2016, CarraraPro 64bit, Autodesk Inventor, Mudbox, and 3DS Max

One in 68 children is diagnosed with autism.  One is mine.


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.