You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

We start by creating a script. In the toolbox tool window on the right click on the scripting folder ("scripts" ) and select "Add new script". This will add a new script (with the name you provided) to your "scripts" folder and open the scripting editor (see Scripting editor overview for more details on the editor).  To create a new flow flexible mesh model we start by adding the following lines:

Creating a new FM model
from Libraries.FlowFlexibleMeshFunctions import *

fmModel = WaterFlowFMModel()

 

In the first line we declare that we want to use a library. The first part "from Libraries.FlowFlexibleMeshFunctions" specifies where the library is located. In this case it is located in the Libraries folder (under the scripting folder "scripts") in the file FlowFlexibleMeshFunctions.py. The second part "import *" declares what part we want to use from this library in this case everything. It is also possible to only select the parts you want to use by declaring the import as follows : "from Libraries.FlowFlexibleMeshFunctions import WaterFlowFMModel"

In the second line we create a variable named "fmModel" and assign a new "WaterFlowFMModel" instance to it. This is possible because the "FlowFlexibleMeshFunctions" library defined WaterFlowFMModel.

To run the script select the lines and press Ctrl + Enter. The fmModel variable will now contain an instance of a flow flexible mesh model.

You will be able to view the model by adding the following lines :

Creating a new FM model
from Libraries.StandardFunctions import *
AddToProject(fmModel)
  • No labels