FaceProperty Script

From PHASTA Wiki
Revision as of 11:39, 9 August 2013 by Mrasquin (talk | contribs)
Jump to: navigation, search

The purpose of this script is to automate the creation of a new BLattr.inp file for a new parasolid or acis model. You need a previous parasolid or acis model that is very nearly the same as the new model, with the exception of a few new changes. You also need the BLattr.inp corresponding to the previous model, and your new geometric model for which you want to create a new BLattr.inp.

  • connect to either viz001 or viz002
  • cd to the working directory where your are planning to use BLMesher.
  • You need in this directory (i) a copy or a link to the old geometric model, (ii) a copy or a link to the new geometric model (required anyway for BLMesher), and a copy or a link to the old BLattr.inp associated with the old geometric model that you want to recycle.

Note that it is possible that your parasolid model cannot be read properly if it was exported from SpaceClaim. If this happens, you can try open it and save it from ThreeDViewer (see softenv).

  • link the following file to the same working directory:
 ln -s /users/mrasquin/myUsefulScripts/FaceProperty/runMatchFaceID.sh .

This bash script will call successively a matlab script and a ruby script saved in the same directory. If you plan to modify these scripts for your own needs, please use git to download a copy of this directory with the following command and let Michel know about it:

 git clone git@github.com:mrasquin/myUsefulScripts.git


  • Run the following command:

./runMatchFaceID.sh OldGeometricModel NewGeometricModel OldBLattr.inp

Notice that this script runs a matlab file but doesn't open the matlab GUI. The statement /opt/matlab/R2013a/bin/matlab may need to be changed if the matlab is updated to a new version in the future - keep this in mind. This matlab script compares the minimum and maximum x,y,z coordinates of all vertices (6 pieces of information) for each face and will call faces a "match" if all 6 agree within a certain tolerance. There is a variable called "tol", which is currently set to 5e-5. Feel free to play around with this number, but 1e-5 has worked the best so far.

It will take about a minute to generate the files "output" and "MatchFaceID.dat". "output" contains your new BLattr.inp, and it has all the same attributes as the old BLattr.inp - all it did was replace the old face ID's with new matching face ID's. In "output", every new face that was uniquely matched to the old model has a comment saying "#corrected" after the line. Every face that either was not matched at all or had multiple matches says "#Match not found" after the line.

  • Open the file MatchFaceID.dat

This will tell you in detail which faces were matched, which faces were not uniquely matched (i.e. had duplicate matches), and which faces had no match at all. The left column lists faces from the old model, and the right column lists the corresponding match from the new model. You need to pay attention to the faces that had duplicates or were not matched at all and manually give these faces attributes.