Hi Cris,
 
Not as such - I'm running it from the script editor within Soft.
 
But where I'm currently at is....
 
I've knocked up a script that will generate two scripts (1. .py and 1 .bat)
 
The first is the caching script which contains something like this:
 
(This gets saved as pointcloud1_batch.py)
 
sceneName = 'batchCaching_002.scn' 
Application.OpenScene (sceneName , '', '') 
Application.SetValue('PlayControl.Current', 1, '')
Application.CacheObjectsIntoFile('pointcloud1', 5, 1, 100, 1, True, False, 
'Color,Force,Mass,NbSubSamples,Orientation,PointPosition,PointVelocity,Scale,Shape,SimulatedFrameFraction,Size,State_ID',
 'AnimTake1' , 
'[project]\\Simulation\\[model]\\[object]\\[object]_AnimTake1_####.icecache', 
False)
 
and the second is the batch script which looks something like this:
 
(This gets saved as pointcloud1_batch.bat)

@echo off 
call 'C:\Program Files\Autodesk\Softimage 2013 SP1\Application\in\setenv.bat' 
'C:\Program Files\Autodesk\Softimage 2013 SP1\Application\in\XSIBatch.exe' %* 
xsibatch -processing -script 
\\place\folder\Gareth\batchcaching_project\Scripts\ 
<file://place/folder/Gareth/batchcaching_project/Scripts/pointcloud1_batch.py> 
pointcloud1_batch.py
 
I'm then running this in the snippet editor:
 
import subprocess
subprocess.Popen 
("\\\\place\\folder\Gareth\\batchcaching_project\\Scripts\\pointcloud1_batch.bat",
 shell=False )
 
Which will open the command prompt and run the batch script. (oddly, it does 
error but still gets the job done)
 
 
Ideally the plan is to then run this final snippet from inside the logic of a 
custom property so that when you hit the button it creates all the above and 
then launches the cmd prompt. But I'm still working that out.....
 
Hope this is of some use
 
G
 
 
 
 

________________________________

From: [email protected] on behalf of Cristobal Infante
Sent: Thu 06/12/2012 16:17
To: [email protected]
Subject: Re: Python: subprocess caching


Hi Gareth, 

Did you get it working ? Would you mind posting an example?

thanks for the tip Raff!

Best,
Cris


On 6 December 2012 15:12, Gareth Bell <[email protected]> wrote:


        

        Hi Raff,

         

        That's awesome.

         

        Forgive my ignorance but is it possible to run subprocess.Popen within 
logic? As it is currently written it works outside of logic but not within it.

         

        g

         

         

        
________________________________


        From: [email protected] 
[mailto:[email protected]] On Behalf Of Raffaele Fragapane
        Sent: 06 December 2012 03:27
        To: [email protected]
        Subject: Re: Python: subprocess caching

         

        The absolute dumbest way out of it is, in the same script, to copy the 
siShell bat file, add a line at the end with xsibatch's call and parameters the 
way you would manually call it in that shell, save it with a predetermined name 
and location, then call Popen on that bat instead of the base one. Delete the 
file once done.
        
        Hard to get any more straightforward than that if you have no 
particular needs other than launching a bat.

        On Thu, Dec 6, 2012 at 3:54 AM, Cristobal Infante <[email protected]> 
wrote:

        Hi guys,

         

        I would like to make python script that will: 

         

        - call the command prompt. 

        - cache a given scene, without opening the softimage gui.

         

        I know I can run: xsi -script cache.py, so that takes care of the 
events inside soft.

         

        But how do I call the subprocess so it receives this commands? (xsi 
-script)

         

        import subprocess

        proc = subprocess.Popen ("C:/Program Files/Autodesk/Softimage 2013 
SP1/Application/bin/SIShell.bat", shell=False )

         

        # this just opens the command prompt

         

        Any idea?

         

        Cheers,

        Cris

         

         

        
        
        
        -- 
        Our users will know fear and cower before our software! Ship it! Ship 
it and let them flee like the dogs they are!


<<winmail.dat>>

Reply via email to