Hello,
I'm Doing this Structure on python to simulate objects one by one, because I want to generate a final Hi res Sim and if a simulate all objects at once is to much for my system, so instead I'm Simulating one object at a time.
THis is the script Structure:
Mute all objetcs on SimulationObjects[]
for i in ObjectList
Turn Mute Off
Set this Data
PlaybackSimulation for X Frames
I have manage to do all those on python, But I don't know how to to do the "PlayBackSimulation for X Frames" codet , so the idea is for the loop to wait for the simulation to be done, and then loop to the next object, an so on...
Play Simulation inside a for loop
-
- Posts: 31
- Joined: 16 Sep 2013, 21:29
- Skype: jm_quintela
-
- Posts: 31
- Joined: 16 Sep 2013, 21:29
- Skype: jm_quintela
Re: Play Simulation inside a for loop
This is the Whole Code,
it's for updating Variables inside XSI objects in a fast way
import sys
import os
App = Application
Ice_roots = Ir = [
".pointcloud.ICETree",
"Simulation_Objects.",
"Caches.",
]
Cache_Parameters_Values = CPV = [
True,
True,
True,
0.4,
]
Simulation_Parameters_Values = SPV = [
True,
True,
30000,
0.4,
]
Cache_Parameters_Names = CPN = [
".mute",
".IfNode.condition",
".emRPC4___Main.Enable",
".emRPC4____Settings3___Particles.Custom_Size",
]
Simulation_Parameters_Names = SPN = [
".mute",
".State_FLocking.Enable_Sim",
".State_FLocking.Rate",
".State_FLocking.Emit_from_Geometry.Size",
]
Cache_Objects = Co = [
Ir[2] + "Hoja_1_Cache" + Ir[0],
Ir[2] + "Hoja_2_A_Cache" + Ir[0],
Ir[2] + "Hoja_2_B_Cache" + Ir[0],
Ir[2] + "Hoja_3_A_Cache" + Ir[0],
Ir[2] + "Hoja_3_B_Cache" + Ir[0],
Ir[2] + "Hoja_4_A_Cache" + Ir[0],
Ir[2] + "Hoja_4_B_Cache" + Ir[0],
Ir[2] + "Lotos_Cache" + Ir[0],
Ir[2] + "Lotos_Borde_Cache" + Ir[0],
Ir[2] + "Dis_Y_Publicidad_Cache" + Ir[0],
]
Cache_Time_Values = CTV = [
128,
160,
160,
190,
190,
210,
210,
240,
260,
300,
]
Cache_Time_Names = CTN = ".ScalarNode.value"
Simulation_Objects = SiO = [
Ir[1] + "Hoja_1_SIM" + Ir[0],
Ir[1] + "Hoja_2_A_SIM" + Ir[0],
Ir[1] + "Hoja_2_B_SIM" + Ir[0],
Ir[1] + "Hoja_3_A_SIM" + Ir[0],
Ir[1] + "Hoja_3_B_SIM" + Ir[0],
Ir[1] + "Hoja_4_A_SIM" + Ir[0],
Ir[1] + "Hoja_4_B_SIM" + Ir[0],
Ir[1] + "Dis_Y_Publicidad_SIM" + Ir[0],
Ir[1] + "Lotos_Borde_SIM" + Ir[0],
Ir[1] + "Lotos_SIM" + Ir[0]
]
def SimulationUpdate(Mute,Particles,ParticleSize):
SPV[2] = Particles
SPV[0] = Mute
SPV[3] = ParticleSize
for Item,Object in enumerate(SiO):
for Index,Parameter in enumerate(SPN):
App.SetValue(Object + Parameter , SPV[Index] , "")
def CacheUpdate(Mute,ParticleSize,Render):
CPV[0] = Mute
CPV[2] = Render
CPV[3] = ParticleSize
for Item,Object in enumerate(Co):
for Index,Parameter in enumerate(CPN):
App.SetValue(Object + Parameter , CPV[Index] , "")
def SimulationCascade(Particles):
for Item,Object in enumerate(SiO):
SimulationUpdate(True,Particles)
SPV[0] = False
for Index,Parameter in enumerate(SPN):
App.SetValue(Object + Parameter , SPV[Index] , "")
#Playback Simulation
def CacheCascade(ParticleSize,Render):
for Item,Object in enumerate(SiO):
CacheUpdate(True,ParticleSize,Render)
CPV[0] = False
for Index,Parameter in enumerate(CPN):
App.SetValue(Object + Parameter , CPV[Index] , "")
#Playback Simulation
#SimulationCascade(5000)
SimulationUpdate(True,500,0.2)
CacheUpdate(False,1,True)
it's for updating Variables inside XSI objects in a fast way
import sys
import os
App = Application
Ice_roots = Ir = [
".pointcloud.ICETree",
"Simulation_Objects.",
"Caches.",
]
Cache_Parameters_Values = CPV = [
True,
True,
True,
0.4,
]
Simulation_Parameters_Values = SPV = [
True,
True,
30000,
0.4,
]
Cache_Parameters_Names = CPN = [
".mute",
".IfNode.condition",
".emRPC4___Main.Enable",
".emRPC4____Settings3___Particles.Custom_Size",
]
Simulation_Parameters_Names = SPN = [
".mute",
".State_FLocking.Enable_Sim",
".State_FLocking.Rate",
".State_FLocking.Emit_from_Geometry.Size",
]
Cache_Objects = Co = [
Ir[2] + "Hoja_1_Cache" + Ir[0],
Ir[2] + "Hoja_2_A_Cache" + Ir[0],
Ir[2] + "Hoja_2_B_Cache" + Ir[0],
Ir[2] + "Hoja_3_A_Cache" + Ir[0],
Ir[2] + "Hoja_3_B_Cache" + Ir[0],
Ir[2] + "Hoja_4_A_Cache" + Ir[0],
Ir[2] + "Hoja_4_B_Cache" + Ir[0],
Ir[2] + "Lotos_Cache" + Ir[0],
Ir[2] + "Lotos_Borde_Cache" + Ir[0],
Ir[2] + "Dis_Y_Publicidad_Cache" + Ir[0],
]
Cache_Time_Values = CTV = [
128,
160,
160,
190,
190,
210,
210,
240,
260,
300,
]
Cache_Time_Names = CTN = ".ScalarNode.value"
Simulation_Objects = SiO = [
Ir[1] + "Hoja_1_SIM" + Ir[0],
Ir[1] + "Hoja_2_A_SIM" + Ir[0],
Ir[1] + "Hoja_2_B_SIM" + Ir[0],
Ir[1] + "Hoja_3_A_SIM" + Ir[0],
Ir[1] + "Hoja_3_B_SIM" + Ir[0],
Ir[1] + "Hoja_4_A_SIM" + Ir[0],
Ir[1] + "Hoja_4_B_SIM" + Ir[0],
Ir[1] + "Dis_Y_Publicidad_SIM" + Ir[0],
Ir[1] + "Lotos_Borde_SIM" + Ir[0],
Ir[1] + "Lotos_SIM" + Ir[0]
]
def SimulationUpdate(Mute,Particles,ParticleSize):
SPV[2] = Particles
SPV[0] = Mute
SPV[3] = ParticleSize
for Item,Object in enumerate(SiO):
for Index,Parameter in enumerate(SPN):
App.SetValue(Object + Parameter , SPV[Index] , "")
def CacheUpdate(Mute,ParticleSize,Render):
CPV[0] = Mute
CPV[2] = Render
CPV[3] = ParticleSize
for Item,Object in enumerate(Co):
for Index,Parameter in enumerate(CPN):
App.SetValue(Object + Parameter , CPV[Index] , "")
def SimulationCascade(Particles):
for Item,Object in enumerate(SiO):
SimulationUpdate(True,Particles)
SPV[0] = False
for Index,Parameter in enumerate(SPN):
App.SetValue(Object + Parameter , SPV[Index] , "")
#Playback Simulation
def CacheCascade(ParticleSize,Render):
for Item,Object in enumerate(SiO):
CacheUpdate(True,ParticleSize,Render)
CPV[0] = False
for Index,Parameter in enumerate(CPN):
App.SetValue(Object + Parameter , CPV[Index] , "")
#Playback Simulation
#SimulationCascade(5000)
SimulationUpdate(True,500,0.2)
CacheUpdate(False,1,True)
Who is online
Users browsing this forum: No registered users and 41 guests