Advertisement
Guest User

Get dimensions of Pro/E model via JLink

a guest
Aug 7th, 2012
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1.     void getDimensions() throws jxthrowable {
  2.         // Get all features of the current model
  3.         Model model = pfcGlobal.GetProESession().GetCurrentModel();
  4.         Features features = ((Solid) model).ListFeaturesByType(false, null);
  5.  
  6.         // Get the dimensions of all features
  7.         for (int i = 0; i < features.getarraysize(); i++) {
  8.             Feature feat = features.get(i);
  9.             ModelItems dims = feat.ListSubItems(ModelItemType.ITEM_DIMENSION);
  10.             // Go through every single dimension
  11.             for (int j = 0; j < dims.getarraysize(); j++) {
  12.                 Dimension dim = (Dimension) dims.get(j);
  13.                 if (dim != null) {
  14.                     String dimName = dim.GetName();
  15.                     double dimVal = dim.GetValue().GetDoubleValue();
  16.                 }
  17.             }
  18.         }
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement