FX_tool pour Hython Basic02

Fluid Simulation Setup tool Nous publierons un outil qui crée automatiquement la configuration Houdini Fluid Simulation Base. Vous pouvez choisir Flip ou Pyro. Veuillez le modifier à votre guise.

Article Houdini ** Control_Dynamics Houdini 01 ** etc. Je pensais que la configuration était gênante, alors veuillez l'utiliser pour étudier ensemble. Cliquez ici pour Control_Dynamics Houdini 01 http://qiita.com/ts_bros/items/c8c9ace7863e8b93df4c


Fluid Simulation Setup

Simu_Setup.PNG

[Python]

#Function Select Fluid Base

#Create Dialog Function
Dialog = hou.ui.readMultiInput(message ="          -User Guide-\n\
  =================\n  :Fluid_Simulation_Setup\n  =================\n\
-Compute Setup Simulation-\n\n  :Flip = Flip Based Setup\n  :Pyro = Pyro Based Setup\
\n\n\
  FLIP = BlueColor\n  Pyro = RedColor\n  =================\n",input_labels = ["  -DopName-","\
  -GridSize-"],help ="\
   -Main Detail-\n   :Simulation Node\n",title = "\
Houdini_FluidSimulation_Setup_Tool",initial_contents =["\
Sim","1"],buttons=["Flip","Pyro","Cancel"]);




#Create Base Node Function

obj = hou.node("/obj");
Namespace = Dialog[1];
GridScale = Namespace[1];
print Namespace

#Get Section Function
#Dialog return 
#Flip =0,Pyro = 1,Cacnel = 2, -Dopname- is list[1];

#Convert Namelist to list
typename = Namespace[0];

#======Fase for Click Flip======#
if Dialog[0]==0:
   Flipnode = obj.createNode("geo",run_init_scripts=0);   
   Flipnode.setName(typename);
   
   #Flip SetNode Color
   FlipColor = hou.Color((0.0,0.6,1.0));
   
   Flipnode.setColor(FlipColor);
   
   #Best Position
   Flipnode.moveToGoodPosition();
   
   #Fase OBJ Node End
   
   #get Sop Node 
   Fpath = Flipnode.path();
   Fnode = hou.node(Fpath);
   
#++                              ++#   
        #function For Sop 
   
   #Create BoundingSource for Box Sop
   Boundsop = Fnode.createNode("box","BoundArea");
   
   Boundsop.setPosition([-2.1,0.9]);
   #Set Color
   boundcol = hou.Color((1.0,0.8,0.0));
   Boundsop.setColor(boundcol);
   
  
#++                                     ++#
            #Edit Def Parameter
             #Edit Def Parameter
   Boundsop.setParms({"sizex":GridScale,"sizey":GridScale,"sizez":GridScale}); 
   Boundsop.setParmExpressions({"ty":"ch('sizey')/2"});
   #Export Parms Variables
   boundsizex =  Boundsop.parm("sizex");
   boundsizey =  Boundsop.parm("sizey");
   boundsizez =  Boundsop.parm("sizez");
   
   boundtrx = Boundsop.parm("tx");
   boundtry = Boundsop.parm("ty");
   boundtrz = Boundsop.parm("tz");
   
   #Create Dop network
   Fdop = Fnode.createNode("dopnet");
   #Set Name
   Fdop.setName(typename+'_network');
#===============================================#
#++                                     ++#
           #Create into Dop 
   
   #Create Solver Asset        
   #Get Simulation Dop nodepath
   Doppath = Fdop.path();
   dpnode = hou.node(Doppath);
#++                                     ++#
           #Create dopnode 
   #Delete DefNode
   out = '/output';
   outpath = Doppath+out;
   outnode =hou.node(outpath);
   outnode.destroy();
   
   #Create Flip Object node
   Flipobj = dpnode.createNode("flipobject","FLIP"); 
   fppath = Flipobj.path();
   
   #Edtit Parm
   Flipobj.setParms({"closedends":1});
   Flipobj.setParms({"visprim":3});
   
#++                                     ++#
           #Edit Flipobj Parm
    
   
   FPathparm = Flipobj.parm("soppath");
   FPathparm.set("");
   
   #create FlipSolver Node
   Flipsolver = Flipobj.createOutputNode("flipsolver",'Flip_Solver');
   Flipsolver.setPosition([1,-1.5]);
    
#++                                     ++#
           #Edit FliSolver Parm
   
   Flipsolver.setParms({"limit_sizex":boundsizex,"limit_sizey":boundsizey,"limit_sizez":boundsizez});
   Flipsolver.setParms({"limit_tx":boundtrx,"limit_ty":boundtry,"limit_tz":boundtrz});
   Flipsolver.setParms({"vislimitcolorr":1.0,"vislimitcolorg":0.0,"vislimitcolorb":0.0});
   
   #Create Gravity dop
   Gravitydop = Flipsolver.createOutputNode("gravity","Gravity");
   Gravitydop.setPosition([1.4,-3.0]);
   
   
   
   
   #create null dop
   dpnull = Gravitydop.createOutputNode("null","OUT");
   dplColor = hou.Color((1.0,1.0,0.4));
   
   dpnull.setPosition([1.4,-4.4]);
   dpnull.setColor(dplColor);
   dpnull.setDisplayFlag(1);
#===============================================#   
   
   #Create Dop Importsop
   Dpio = Fnode.createNode("dopimportfield","Sim_Data");
   Dpio.setPosition([-1.9,-1.4]);
#++                                     ++#
          #Edit Def Parameter
   #Get Simulation Dop nodepath
   Doppath = Fdop.path();
   Dpiopathnet = Dpio.parm('doppath');
   
   Dpiopathnet.set(Doppath);
   #Get Simulation Dop node
   getdpobj = fppath;
   Dpionode =  Dpio.parm("dopnode");
   Dpionode.set( getdpobj);
  
   #Create Filecache Node
   cachenode = Dpio.createOutputNode("filecache");
   
   cachenode.setName(typename+"_cahce");
   
   #Create Nullsop
   nullsop = cachenode.createOutputNode("null","Sim_OUT");
   
   nullsop.setPosition([-1.5,-3.5]);
   nullCol = hou.Color((1.0,0.4,0.4));
   nullsop.setColor(nullCol);
   
   #Set Display Flag
   nullsop.setDisplayFlag(1);
   Boundsop.setRenderFlag(0);
   Boundsop.setTemplateFlag(1);
   
#=========  Fase for Click Flip EnD =========#
   
   





#======Fase for Click Pyro======#
if Dialog[0]==1:
   Pyronode = obj.createNode("geo",run_init_scripts=0);   
   Pyronode.setName(typename);
   
   #Flip SetNode Color
   PyroColor = hou.Color((1.0,0.4,0.4));
   
   Pyronode.setColor(PyroColor);
   
   #Best Position
   Pyronode.moveToGoodPosition();
   
   #Fase OBJ Node End
   
   #get Sop Node 
   Ppath = Pyronode.path();
   Pnode = hou.node(Ppath);
   
#++                              ++#   
        #function For Sop 
   
   #Create BoundingSource for Box Sop
   Boundsop = Pnode.createNode("box","BoundArea");
   
   Boundsop.setPosition([-2.1,0.9]);
   #Set Color
   boundcol = hou.Color((1.0,0.8,0.0));
   Boundsop.setColor(boundcol);
   
  
#++                                     ++#
            #Edit Def Parameter
           
   Boundsop.setParms({"sizex":GridScale,"sizey":GridScale,"sizez":GridScale}); 
   Boundsop.setParmExpressions({"ty":"ch('sizey')/2"});
   #Export Parms Variables
   boundsizex =  Boundsop.parm("sizex");
   boundsizey =  Boundsop.parm("sizey");
   boundsizez =  Boundsop.parm("sizez");
   
   boundtrx = Boundsop.parm("tx");
   boundtry = Boundsop.parm("ty");
   boundtrz = Boundsop.parm("tz");
   
   #Create Dop network
   Pdop = Pnode.createNode("dopnet");
   #Set Name
   Pdop.setName(typename+'_network');
#===============================================#
#++                                     ++#
           #Create into Dop 
   
   #Create Solver Asset        
   #Get Simulation Dop nodepath
   Doppath = Pdop.path();
   dpnode = hou.node(Doppath);
#++                                     ++#
           #Create dopnode 
   #Delete DefNode
   out = '/output';
   outpath = Doppath+out;
   outnode =hou.node(outpath);
   outnode.destroy();
   
   #Create Pyro Object node
   Pyroobj = dpnode.createNode("smokeobject","Pyro"); 
   Pppath = Pyroobj.path();
#++                                     ++#
            #Edit Parameter
            
          #Size,Center,ClosedBound
   Pyroobj.setParms({"sizex":boundsizex,"sizey":boundsizey,"sizez":boundsizez});
   Pyroobj.setParms({"tx":boundtrx,"ty":boundtry,"tz":boundtrz});
   Pyroobj.setParms({"closedends":1});
            
              #Visualizer volume
   Pyroobj.setParms({"multifield_densityfield":'density'});
   Pyroobj.setParms({"multifield_showguide":1});
   Pyroobj.setParms({"density_showguide":0});
   
   #create PyroSolver Node
   Pyrosolver = Pyroobj.createOutputNode("pyrosolver",'Pyro_Solver');
   Pyrosolver.setPosition([2,-1.9]);
   
   #create Resize Node
   dpresize = dpnode.createNode("gasresizefluiddynamic","Resize_Grid");
   
   dpresize.setPosition([2.0,0.7]);
   
   Pyrosolver.setInput(1,dpresize);
   
   
   
   #create null dop
   dpnull = Pyrosolver.createOutputNode("null","OUT");
   dplColor = hou.Color((1.0,1.0,0.4));
   
   dpnull.setPosition([2.0,-3.0]);
   dpnull.setColor(dplColor);
   dpnull.setDisplayFlag(1);

  
#===============================================#   
   
   #Create Dop Importsop
   Dpio = Pnode.createNode("dopimportfield","Sim_Data");
   Dpio.setPosition([-1.9,-1.4]);
#++                                     ++#
          #Edit Def Parameter
   #Get Simulation Dop nodepath
   Doppath = Pdop.path();
   Dpiopathnet = Dpio.parm('doppath');
   
   Dpiopathnet.set(Doppath);
   #Get Simulation Dop node
   getdpobj = Pppath;
   Dpionode =  Dpio.parm("dopnode");
   Dpionode.set(getdpobj);
  
   #Create Filecache Node
   cachenode = Dpio.createOutputNode("filecache");
   
   cachenode.setName(typename+"_cahce");
   
   #Create Nullsop
   nullsop = cachenode.createOutputNode("null","Sim_OUT");
   
   nullsop.setPosition([-1.5,-3.5]);
   nullCol = hou.Color((1.0,0.4,0.4));
   nullsop.setColor(nullCol);
   
   #Set Display Flag
   nullsop.setDisplayFlag(1);
   Boundsop.setRenderFlag(0);
   Boundsop.setTemplateFlag(1);
   
#=========  Fase for Click Pyro EnD =========#
   
   


if Dialog[0]==2:
   None;

J'utilise: Fenêtre Popup.

Recommended Posts

FX_tool pour Hython Basic02
FX_tool pour Hython Basic01
Grammaire de base Python pour les débutants
Commandes de base pour les opérations sur les fichiers
Notes de syntaxe de base pour le script shell
Formation de base Linux pour l'ingénieur front-end
Politique de base pour la recherche de mahjong
Installation d'Elasticsearch et fonctionnement de base pour ubuntu
Fonctionnement Linux pour les débutants Résumé des commandes de base
(Pour moi) Django_1 (Basic / Hello World / Template)
JupyterLab Basic Setting 2 pour l'analyse des données (pip)
Configuration de base de JupyterLab pour l'analyse des données (pip)