Revision Table Macro

Hello,

I am trying to create a macro that will allow the user to input text and the text will be populated on the APP box for the latest revision table row. How can I call for the latest row and that specific column? I have got the part where I can get the input box to pop up and everything else, all I am actually needing is a way to call for that specific box. I am aware of the Revision Table macro going around the forum that allows the user to input all the information for the whole table row, I even tried pulling the code from there but can't seem to understand how they are calling for the boxes or even putting the user-input text in the fields.

Thanks

SolidworksApi macros
Answers 7
MM
MM 2015-12-01 Best Answer

Have at the look at the macro I wrote that does this. I use a numbered revision scheme and the macro also keeps the revision table at 3 rows by deleting the oldest row if the table will go over 3.

SF
SF 2015-12-01

Matt,

Thanks for sharing your macro. This is kind of what I had running although it was not working, but looking at your macro made me realize that I was missing a variable and that's why it was not populating into the field.  What I am trying to do now is have the code check to see if there's any text on that field already, but cant seem to make it work.

CA
CA 2016-03-18

Matt,

I'm looking to do something similar, I'm running your macro on my rev table and the description is altering the wrong field.  I can alter the code get it to fill in the right field the first row, however the NEXT revision overwrites the same field as the first. I guessing it is related to the incremental code.

this is what my table looks like.

Also will the macro handle a 00 revision, i see it address a less than 10 and apends the variable...how would it address a 00 rev level?

comment imagecomment image
MM
MM 2016-03-18

I designed this macro for when I wish to bump my parts to the next revision. It adds a line to the revision table, or in the case of it being the first revision adds the table itself, bumps the revision of the drawing, model, and assembly if they all have the same drawing number, and add the description that was input into the revision table. It doesn't handle the 00 revision because I don't put the 00 revision in the table and I use the macro to bump the revision as part of the process.

The reason the code is overwriting the description on subsequent runs is my revision table are on the bottom of my sheets and when the revision gets added it is always top row of the table. The new revision is always in the same place. So i wrote the macro accordingly.

The "0" is this line

swRevTable.Text(0, 2) = revDesc

needs to be altered so that you are always addressing the last row of the table. You should ITableAnnotation::RowCount to get the right row to change the text of.

Something like:

swRevTable.Text(swRevTable.RowCount - 1, 2) = revDesc

or

integer = swRevTable.RowCount - 1

swRevTable.Text(integer, 2) = revDesc

should work.

The code that addresses the less than 10 was added because get the current revision from the revision table, which uses single digits, but i want my revision custom property to always be double digits (table shows revisions 1, 2, 3 but the revision property should be 01, 02, 03). Because i am not familiar with your procedure for revising and where your users are inputting the 00, 0 that you addressed here: ​, i'm not sure how to correct the code for your use. A little more explanation may help me.

comment imagecomment image
CA
CA 2016-03-18

Matt,

Thanks for the detailed response.

I figured it to be a bottom up issue.

My companies first drawing release is always 00 & i would like to incrementally increase from there, Top down of course.

MM
MM 2016-03-18

Do you have a line for the 00 revision, then? Are you trying to alter this macro to add the description to the 00 line? I'm just not sure what exactly you are attempting to accomplish.

CA
CA 2016-03-18

Generally the sheet will have the revblock loaded but NO revision on it, just the header row with the column names....the user will input the first revision as "00" "Released for Production".  Then subsequent revisions there after following the 01, 02, 03.