2 Replies Latest reply on May 29, 2015 7:03 AM by James Kashuba

    Automated revision row?

    James Kashuba

      Hey Guys,

      I'm trying to build a macro to automatically insert a redundant revision row. My problem lies in dealing with the automated rev applied by SW in the second column of the newly added row. I don't know what to place in the code to compensate for this.

       

       

      My typical code for each column looks like this times 6:

       

      boolstatus = Part.Extension.SelectByID2("DetailItem351@Sheet1", "REVISIONTABLE", 0.2982784283223, 0.2616111143937, 0, False, 0, Nothing, 0)

      myRevisionTable.Text(2, 0) = "N/A"

       

      Any suggestions?

      Jim

        • Re: Automated revision row?
          Keith Rice

          It's not really clear to me what you're trying to do, such as whether you're trying to change the text in this row or delete the row. Nevertheless, no matter what you're trying to do, it might be best to work with the table interfaces itself and find it through traversal rather than IModelDocExtension::SelectByID2.

           

          For example, at my Macro Library you'll find a free macro called "Get cell data in active sheet’s table" that shows you how to locate a particular type of table and then work with it.

           

          In your case, you want to use ITableAnnotation::Type to find a revision table. Once you have the ITablAnnotation for that table, you can cast it to IRevisionTableAnnotation from which you will have access to all of the revision table related API calls.

           

          But if you're simply trying to change text, then the above macro I mentioned has everything you need. Once you find the cell you want to change, you can use ITableAnnotation::Text.

           

          Keith

          SolidWorks API Tutorials

            • Re: Automated revision row?
              James Kashuba

              Keith or any Reader,

              Sorry for my vagueness I was in a hurry yesterday. What I'm trying to do is automate the "add revision" process for a particular project. I have to rev about 75 drawings by placing the same rev information on ever one of those drawings. The example I was trying to show is the SW automation of adding the next rev letter which is B. The B is what is messing me up. I have code written that will automatically fill in the zone, rev ??, ref no, description, date, and apvd. What I have works but when it get to the second column (rev) it gets messed up because SW wants to put the next rev in there and all the other columns end up getting shifted. I don't know how to deal with that second column. The code I provided was just an example of the text string that would place the text I want in each of the columns. I hope that makes more sense now.

               

              The following is what happens when I run it:

               

              This is what I should look like:

              It is the REV column that is messing things up.