0 Replies Latest reply on Apr 28, 2016 12:09 PM by John Raffensperger

    Access Hidden Rows of a RevisionTableAnnotation

    John Raffensperger

      I am attempting to access and manipulate a Revision Table via the RevistionTableAnnotation interface.

       

      I am not having success in dealing with hidden rows.  If I cast the RevisionTableAnnotation as a TableAnnotation, and attempt to set "hidden" to false, I end up duplicating rows in the Revision Table, and increasing row count.

       

      Ultimately I'm really only after the "last" revision, but need to make sure it isn't hidden, and hence unreadable.  I also would like to be able to end up with the Revision Table only showing the last "X" Revisions.  Additional tasks will involve adding a Revision as part of integrating with EPDM (Which for some reason has no knowledge and/or integration with Revision Tables...)

       

      Here is some code to illustrate my trials:

              public void ASEC_RevTable()
              {
                  Debug.Print("Start ASEC_RevTable");

                  ModelDoc2 doc;
                  DrawingDoc draw;
                  Sheet sheet;

                  IRevisionTableAnnotation revTable;
                  RevisionTableFeature revFeature = default(RevisionTableFeature);
                  object[] annos;
                  TableAnnotation table;

                  doc = iSwApp.ActiveDoc as ModelDoc2;
                  draw = doc as DrawingDoc;

                  sheet = draw.GetCurrentSheet();

                  revTable = sheet.RevisionTable;
                  Debug.Print("Current Rev: " + revTable.CurrentRevision);
                  revFeature = revTable.RevisionTableFeature;
                  Debug.Print("Rev Count: " + revFeature.GetTableAnnotationCount() );
                  annos = revFeature.GetTableAnnotations();
                  Debug.Print("annos upper bound: " + annos.GetUpperBound(0).ToString());
                  table = (TableAnnotation)revTable;
                  Debug.Print("table rows: " + table.TotalRowCount );
                  Debug.Print("table Columns: " + table.TotalColumnCount);

                  int rows = table.TotalRowCount;

                  //Uncomment this block to attempt to unhide rows...
                  /*
                  for (Int32 i = 0; i < rows - 2; i++)
                  {
                      //if(table.RowHidden[i]) // always returns false...
                      if (table.Text[i, 1] == "")
                      {
                          table.RowHidden[i] = false;
                      }
                  }
                  */

                  for(Int32 i = 0; i < table.TotalRowCount - 1; i++)
                  {
                      string s;
                      s = String.Format("Row {0} ({1}, {2}): ", i, revTable.GetIdForRowNumber(i), revTable.GetRevisionForId(revTable.GetIdForRowNumber(i)));
                      for(Int32 j = 0;j < table.TotalColumnCount; j++)
                      {
                          s += String.Format(" {0}; ", table.Text[i, j]);
                      }
                      Debug.Print(s);
                  }

                  Debug.Print("End ASEC_RevTable");
              }

       

      Here is the "Debug.Print" output when the block to "Unhide" is Commented Out:

       

      Start ASEC_RevTable

      Current Rev: W

      Rev Count: 1

      annos upper bound: 0

      table rows: 21

      table Columns: 4

      Row 0 (19, W):  W;  UPDATED CODE YEAR ADDENDA;  1/28/2016;  GJB;

      Row 1 (18, V):  V;  UPDATED TO SOLIDWORKS/UPDATED CODE YEAR ADDENDA;  6/26/2014;  MPS;

      Row 2 (17, U):  U;  UPDATED CODE YEAR ADDENDA;  5/11/2012;  MPS;

      Row 3 (16, T):  T;  UPDATED CODE YEAR ADDENDA;  4/29/2011;  MPS;

      Row 4 (15, R):  R;  UPDATED CODE YEAR ADDENDA;  3/19/2010;  MPS;

      Row 5 (9, J):  J;  UPDATED CODE YEAR ADDENDA;  3/230/2004;  JLR;

      Row 6 (8, H):  H;  UPDATED CODE YEAR ADDENDA;  5/14/2003;  JLR;

      Row 7 (7, G):  G;  UPDATED CODE YEAR ADDENDA;  4/24/2002;  PWmH;

      Row 8 (6, F):  F;  UPDATED CODE YEAR ADDENDA;  5/18/2001;  PWmH;

      Row 9 (5, E):  E;  CHANGED TOP HEAD PART NO.;  7/8/1999;  DJN;

      Row 10 (4, D):  D;  UPDATED CODE YEAR ADDENDA;  7/7/1998;  DJN;

      Row 11 (3, C):  C;  CHANGED PN. OF ITEM 4;  9/29/1997;  DJN;

      Row 12 (2, B):  B;  REMOVED ITEM & CHANGED PN. OF ITEM 3;  6/17/1997;  DJN;

      Row 13 (1, A):  A;  ;  ;  ;

      Row 14 (0, ):  REV;  DESCRIPTION;  DATE;  BY;

      Row 15 (-1, ):  ;  ;  ;  ;

      Row 16 (-1, ):  ;  ;  ;  ;

      Row 17 (-1, ):  ;  ;  ;  ;

      Row 18 (-1, ):  ;  ;  ;  ;

      Row 19 (-1, ):  ;  ;  ;  ;

      End ASEC_RevTable

       

       

      Here is the output when I uncomment that block Note that rows 0-5 are duplicates of other rows that were "added" by attempting to "unhide" Revisions K - P (We skip "O").

       

      Start ASEC_RevTable

      Current Rev: W

      Rev Count: 1

      annos upper bound: 0

      table rows: 21

      table Columns: 4

      Row 0 (6, F):  F;  UPDATED CODE YEAR ADDENDA;  5/18/2001;  PWmH;

      Row 1 (5, E):  E;  CHANGED TOP HEAD PART NO.;  7/8/1999;  DJN;

      Row 2 (4, D):  D;  UPDATED CODE YEAR ADDENDA;  7/7/1998;  DJN;

      Row 3 (0, C):  C;  CHANGED PN. OF ITEM 3;  9/29/1997;  DJN;

      Row 4 (0, C):  B;  REMOVED ITEM & CHANGED PN. OF ITEM 6;  6/17/1997;  DJN;

      Row 5 (3, C):  C;  ADDED LOCATION FOR ITEM 7 AND CHANGED PN. OF ITEM 5;  9/29/1997;  DJN;

      Row 6 (19, W):  W;  UPDATED CODE YEAR ADDENDA;  1/28/2016;  GJB;

      Row 7 (18, V):  V;  UPDATED TO SOLIDWORKS/UPDATED CODE YEAR ADDENDA;  6/26/2014;  MPS;

      Row 8 (17, U):  U;  UPDATED CODE YEAR ADDENDA;  5/11/2012;  MPS;

      Row 9 (16, T):  T;  UPDATED CODE YEAR ADDENDA;  4/29/2011;  MPS;

      Row 10 (15, R):  R;  UPDATED CODE YEAR ADDENDA;  3/19/2010;  MPS;

      Row 11 (9, J):  J;  UPDATED CODE YEAR ADDENDA;  3/230/2004;  JLR;

      Row 12 (8, H):  H;  UPDATED CODE YEAR ADDENDA;  5/14/2003;  JLR;

      Row 13 (7, G):  G;  UPDATED CODE YEAR ADDENDA;  4/24/2002;  <FONT size=6PTS>PWmH;

      Row 14 (6, F):  F;  UPDATED CODE YEAR ADDENDA;  5/18/2001;  <FONT size=6PTS>PWmH;

      Row 15 (5, E):  E;  CHANGED TOP HEAD PART NO.;  7/8/1999;  DJN;

      Row 16 (4, D):  D;  UPDATED CODE YEAR ADDENDA;  7/7/1998;  DJN;

      Row 17 (3, C):  C;  CHANGED PN. OF ITEM 4;  9/29/1997;  DJN;

      Row 18 (2, B):  B;  REMOVED ITEM & CHANGED PN. OF ITEM 3;  6/17/1997;  DJN;

      Row 19 (1, A):  A;  ;  ;  ;

      Row 20 (0, C):  REV;  DESCRIPTION;  DATE;  BY;

      Row 21 (-1, ):  ;  ;  ;  ;

      Row 22 (-1, ):  ;  ;  ;  ;

      Row 23 (-1, ):  ;  ;  ;  ;

      Row 24 (-1, ):  ;  ;  ;  ;

      Row 25 (-1, ):  ;  ;  ;  ;

      End ASEC_RevTable