FaceProperty Script

From PHASTA Wiki
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 by Simmetrix if it was exported from SpaceClaim. If this happens, you can try open it and save it again from ThreeDViewer (see softenv).

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

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 your change:

 git clone git@github.com:mrasquin/myUsefulScripts.git
  • Run the following command:
 ./runMatchFaceID.sh OldGeometricModel NewGeometricModel OldBLattr.inp 

This bash script will call successively the FaceProperty program, a matlab script and a ruby script.

  • The FaceProperty program is first called and will construct a list of properties for each face of your old and new geometric model. These face properties are saved by default in FacePropFile*.dat. It can take a few minutes to generate these files.
  • Then, the bash script runs a matlab script 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. The output of this matlab script is 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 in the recycled BLattr.inp file produced by the ruby script described below.
  • Finally, the bash runs a ruby script that produces the "output" file. This files 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 and will need to be fixed manually.