This code enables a very simple and handy way of texture mapping. The code can handle pre-selected (multiple) parts or the user can select a single part within the script GUI. Additionally the mapping direction and the texture image must be chosen. Now click “Create” and the code will automatically grab the dimension of all selected parts and map the texture over the whole part surface. The GUI remains open so the user can rotate the plane tool for adjusting the texture.
If you are faced with the problem that you have a hole in a surface EnSight has no powerful tool to fill it. Think about the radiator grille of a car. If one has the request to create a clip plane within the grille geometry to calculate the flow for example, the plane tool wont help in most cases as it’s rectangular and radiator grills are often not rectangular.
This tool can create a triangle meshes within a closed spline. If you campare the result with the meshing of a point part it has two big advantages:
1. The mesh elements are connected
2. Point parts along splines are meshed with one row of triangles. Here we have multiple rows. This enables calculation and coloring on the new mesh.
The spline geometry should be circular or elliptic and as flat as possible. Convex or concave geometries might cause problems. If the geometry is elliptic the first spline point should be at a pointed area (Think about the two ends of an egg). The scipt can use an existing spline or you can create a new one. If you select the option new spline, the GUI becomes interactive. Just click along the surface with the left mouse button and check how the spline points get created. There’s a control field of the current number of splines in the script GUI. If you want to get rid of one or more spline points, just use the delete button within the GUI. The spline can be open. The code will create a final spline point to close it. This will be done on existing splines and on new splines. Furthermore you can map an existing fluid variable to the new surface.
When the create button was pressed EnSight will create a new case and geometry file in the current working directory. These files are loaded as an additional case
The attached script is a stand alone tool. You can run it via File > Command > Play. Just contact me if you want to add it to your user tools.
EnSight has no really handy capability to measure the size of a selected part or the distance between two points although all necessary information is existig. I was asked several times for a simple click solution. Well, here it comes. Attached are two Python codes zipped to a complete directory. Both scripts include a dynamical GUI which enables a very handy usage.
The size measurement tool:
Start the routine and just select one ore more parts from the part list or directly from the graphical area – that’s all. The GUI of the code will update immediately so you will get the desired information without more steps.
The distance measurement tool:
Start the routine and choose the measurement mode. Now just click on the first surface point. The GUI will update at once and asks you to select the second surface point. Once again the GUI will update and tell you the distance betwee the two points. Both points are connected with the line tool now. You can continue picking surface points as long as the GUI is active. If you are finished, just quit the GUI and the line tool will disappear.
Both routines are included in a complete user defined tool directory. Download the file, unzip it and copy the whole directory to this path (If the path does not exist you’ll have to create it):
Please contact me at firstname.lastname@example.org if you have any problems.
In addition to the Droplet Histogram Tool I was asked for a routine that calculates the penetration depth and the injection cone angle of droplets. The attached tool does these two things. When launched a small GUI pops up which asks the user for the measured particle data, the time step for calculation and the percentage of droplets within the calculated cone angle. The default value here is 80%. With this value the routine tends to stop at a cone angle which comes close to the groplet injection geometry.
This routine is written as a user defined tool. If you have an existing directory for your own tools just put it together with the image into that directory. Otherwise it can be used as a standalone tool as well if line 360 is activated. Please contact me if you have any problems (email@example.com).
Last week a customer complained about the necessary steps to remove a component from any vector variable. In his case he wanted to project streamlines on the midplane in Y direction around a car surface. The standard way in EnSight is to get the X and Z components of the velocity vector and add those to the MaceVect Calculator function with zero as Y components. This new variable should be renamed and can be used for the desired streamlines. Too unhandy for the user.
This routine does all steps automatically. It launches a small GUI which offers a combo list with all vector variables in the loaded data. The user has to select the component that has to be removed and click OK. The routine will create a new variable on all parts which als called original_variable_name_component-0 (e.g. velocity_Y-0).
This routine is written as a user defined tool. If you have an existing directory for your own tools just put it together with the image into that directory. Otherwise it can be used as a standalone tool as well if line 66 is activated. Please contact me if you have any problems (firstname.lastname@example.org).
I was asked by two customers at the same time if we have a histogram function for droplets or measured parts. In EnSight we can create histograms by looping an isovolume over a 3D part and query the attributes of that isovolume in every loop step. As droplets don’t have a volume this approach will fail.
For droplets we can use EnSight’s capability of exporting geometries. This new routine does that and gets all information from the exported files. The geometry will be exported to the temp file of the operating system. After finishing the script removes all temporary data.
One thing that is typical for droplets is the fact that they usually appear in transient files. Thus this code enables the user to select the time steps to export. By default histogram results for all time steps will be exported. Furthermore the user has to select the desired variable for the histogram. Also the number of value steps has to be selected. This number will define the refinement of the results.
As we usually handle transient files, this routine does not create a x-y plot. This would be unhandy fo several time steps. The results will be written to a text file in two columns. By default this file will be in the working directory and is called histogram_data_pairs.txt.
This routine is written as a user defined tool. If you have an existing directory for your own tools just put it together with the image into that directory. Otherwise it can be used as a standalone tool as well if line 270 is activated. Please contact me if you have any problems (email@example.com).
In EnSight we can move a clip plane depending on a selected part (e.g. a piston surface) over time. This can be done by this command:
test: special xyz clip
Recently a user asked me to automatize this feature. For this it’s necessary to create a new variable which has to be selected. No problem within the GUI but this was not possible in former EnSight versions by script. Thus this routine will only run on EnSight 10.0.2(f) or later. The result should look like this:
This routine is written as a user defined tool. If you have an existing directory for your own tools just put it together with the image into that directory. Otherwise it can be used as a standalone tool as well if line 156 is activated. Please contact me if you have any problems (firstname.lastname@example.org).
The tool will launch a GUI which asks for the fluid part which is clipped, the piston part surface and the moving direction. The tool is capable to create a new clip plane if toggled. Otherwise the name of an existing clip has to be typed in.
An annoying problem I saw quite often in doing support or training classes was to access the EnSight installation data sets. Usually the way to open one of the models is:
File -> Open -> Navigate to $CEI_HOME$/ensightxx/data -> select parts to load
Really exhausting if you have to do this 20 times in a single training class day. Using the ‘Open recent data file’ menu point was no really solution for me as EnSight will always ask you if you want to replace your current data. Too many clicks for me. I have written a routine which creates a background right click menu enhancement. Please find the linked routine. If you run that routine it will search for the hard drive location
The routine will create every directory level if the path could not be not found. However it won’t overwrite existing directories so you can run it if you already have defined some functions at that directory. As soon as the routine has created the new file called training_rightclick_background.py it will exit EnSight. Restart it to use the new right click enhancement.
The enhacement includes a quick tool access and hide function, which can be useful for quadric tools. Furthermore we can delete all currently loaded cases and we can find an option ‘Open Data’. Here the user can access all models which are automatically installed with EnSight. If the user selects oen model or clicks on ‘Delete data’, EnSight will immediately replce all current cases without asking. So this is a very quick way to open the file you need for demonstrating any EnSight functions.
as the grouping syntax has changed in EnSight 10 I’m sure many users will be faced with the problem that their old command files might fail if they do an upgrade to the latest EnSight version. We have some users with large scripts that include grouping operations so I started to think about a solution for this issue. Attached is the latest version which is still not completely finished but it seems to work fine on most command files I have used for testing. Please feel free to run the routine on your own command files and let me know if it crashes or if EnSight 10 fails on playing the translated files.
The only way I saw to get all necessary part and group info was to replay the original command files. So the original data files must be located at the directory which is included in the command file. The script will create a temporary .enc file and a .py file so the user must have writing permissions to his working directory. To start the script, please navigate to the saving path of your command files and run it with EnSight 9. The script will automatically search all .enc and .cmd files in that directory. If the routine failes on any of the found files for a reason it will create a short output message instead of translating the original command file. The translated files will be written to a new directory in the working directory witch will be named as currentyear_currentmonth_currentday_ensight10_command_files.
Download the latest update (June 2012) here.
As many of you know I’ve been working on the pipe centerline routine in the past. Today it’s running well on most geometries so it’s time to share it.
If you already know older versions, you will see that some changes have been made. One thing is that the the routine can be used as a User Defined tool now. If you want to use it that way, please delete the expression run(0), currently in line 693. Copy the routine and the thumbnail to ~/.ensight92/extensions/user_defined/Tools and restart EnSight. Now you should see the thumbnail and the tool description in the UDT dialog. Starting the routine will launch the GUI where you can make your settings.
The GUI changes dynamically, depending on the selectid parts and the settings. For running the script, please select the wall part (this should be the pipe with the desired center spline), an inlet and an outlet. The order of inlet and outlet part is not important. If the pie has no parallel sections you can allow EnSight to generate infinite clips. If there are parallel sections do not allow that. EnSight will then generate a finite pipe clip with the plane tool. The diameter of the plane tool is the twice of the inlet part diameter by default. Modify this setting if the pipe diameter varies.
The step delta controls the moving steps of the plane tool. This value is calculated automatically, depending on the selected wall part. This value should fit for most situations. Only modify it if the spline result is not satisfying. The script should generate a coaxial spline for the pipe geometry. If you are not satisfied with the result please play with the settings or contact me.
The script can be downloaded here: