FaceProperty Script

From PHASTA Wiki
Revision as of 14:05, 20 July 2013 by Jema6380 (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 model. You need a previous 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 model is saved (i.e. for Boeing, it might be Open26_12jets). Copy the old geometric model to this directory and call it geom2_old.xmt_txt, and the old BLattr.inp. Also copy over the new geometric model and call it geom2_new.xmt_txt. Make sure you have saved the native parasolid model that was generated in spaceclaim from ThreeDViewer.
  • copy these files to the same working directory:

/users/jema6380/Executables/MatchFaceID.m

/users/jema6380/Executables/runMatchFaceID.sh

/users/jema6380/Executables/SwitchAttribFileFaces.rb


  • open runMatchFaceID.sh with vim

Notice that this script takes 3 arguments, specified at the top in the following order: the old model file, the new model file, and the old BLattr.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.

  • change "/users/jema6380/Models/TrapWing/FaceProperty_Debug/" to the full path of your working directory.
  • open MatchFaceID.m

This 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 1e-5. Feel free to play around with this number, but 1e-5 has worked the best so far.

  • You need to change 3 paths in this file to your working directory, which are at the top: "/users/jema6380/Models/TrapWing/FaceProperty_Debug/", "/users/jema6380/Models/TrapWing/FaceProperty_Debug/", "/users/jema6380/Models/TrapWing/FaceProperty_Debug/".
  • run the following command:
./runMatchFaceID.sh geom2_old.xmt_txt geom2_new.xmt_txt BLattr.inp

It will take about a minute to generate the files "output" and "MatchFaceID.dat". "output" contains your new BLattr.inp. 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 first column lists faces from the old model, and the second 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.