Revision Control from Item Master – Part 1 – Rev Tables

Originally Published 9/9/2013

Well, it’s been a hell of a couple of weeks over here.  Several shout outs of thanks forthcoming in this post.  For a number of reasons we made a decision a while back to modify the way we were handling our revision control through Autodesk ® Vault Professional 2013. A little background might be helpful.  We currently use Autodesk ® Autocad 2013, Autodesk ® Autocad Electrical 2013 and Autodesk ® Inventor Professional 2013, in addition to the aforementioned Vault package.

For so many reasons that I don’t really want to relay them all here, (and doubting any of you would get past the first few paragraphs), we decided to change our revision control from File to Item.  This means, among other things, giving up the Vault Revision Table (VRT).  So the question became, how do we handle showing our revisions on drawings?  The easy answer was to simply place them manually with blocks or tables edited by the user.  To me, this opens the door to a lot of human error.  I was looking for some way to, at least partially, automate this process like the VRT, only using properties from the Item Master.

First thing I had to do was to disable the VRT, and then change the lifecycle rules in Vault so that a revision bump only occurred when going from Released to Work In Progress in Item Master.  A few property mappings and some Category rules later, and I started to work on the new revision table for Inventor.

Now, here is where the shout outs are going to come in.  With Autodesk ® Inventor, I knew I had to setup my revision table in the styles editor… since it HAD been setup for the Vault table.  So I set it up using custom properties, which were mapped from the Item Master, so that a Vault “Update Properties” would do just that.  The problem was how to lock down the table rows of previous revisions.  I knew I could manually go into the table and set these rows to static in order to lock in those values.  But that was just not cool enough, I wanted to automate it.  So, I enlisted the help of the Autodesk ® Discussion Forums… knowing there are some bright minds out there who are well versed in the customizations that I need to learn badly.  I figured there had to be a way to do this with an iLogic rule that would automatically find the last row of the revision table, copy it to a new row, and then set the now previous row to static values.  Then I could simply run the Update Properties command, and the new row would take the latest property values from the Item Master… leaving the previous revision information untouched.

Kudos and many thank yous to fellow Expert Elite member, Mr. Jonathon Kriek, for providing me, in what seemed like no time at all, with the following rule which does exactly what I describe above.

Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument


‘ Get the revision table

Dim oRevTable As RevisionTable = oDrawDoc.ActiveSheet.RevisionTables.Item(1)


‘ Get last row

Dim oRow As RevisionTableRow

oRow = oRevTable.RevisionTableRows.Item(oRevTable.RevisionTableRows.Count)


‘ Make sure we have the active row

If oRow.IsActiveRow Then

    ‘ Go through all columns in that row

    For i = 1 To oRevTable.RevisionTableColumns.Count

        Dim oCell As RevisionTableCell = oRow.Item(i)

        ‘ Set all cells to static

        oCell.Text = oCell.Text

        ‘ or static and blank

        ‘oCell.Text = “”

    Next

End If


‘ Add another row at the end

Dim oRows As RevisionTableRows = oRevTable.RevisionTableRows

oRows.Add()

So, with the above code, I am now able to semi-automate the new vault revision table.  We use ECO’s in Vault, so this is the procedure I follow now.  When I get a change order, I change the state of the Item to WIP, which bumps the revision.  I then Edit the Item to fill in the new revision information.  I use User Defined Properties (UDP”S) to push the info out to the drawing.  Revision Author, Approved, and Description.  The Revision itself comes from the lifecycle rules I have in place.  The date is set to the date that the drawing is modified.  Once these are set, I do a “Get Revision” on the CAD file, but do NOT update properties when prompted.  That would be a bad thing.  I run the rule on my rev table, and then Update Properties to fill in the new row with the new properties.  Piece of cake!  Thanks Jonathon!

I thought this was pretty slick, so I moved on to Autodesk ®Autocad.  We still use vanilla Autocad for a lot of our non-electrical schematics, so I needed to come up with a new rev table there as well.  The VRT in Autocad utilizes the Table command, so I had to find a way to do something similar to the solution above with an Autocad table.  I played around with what can be done in tables and came up with a workflow that I thought I liked.  After following the same ECO procedure as above, I wanted to be able to open the drawing and Get Revision (without updating properties), modify the revision table to add a row and then lock the previous row.  In my table I set the cells to be Fields, using custom drawing properties which were mapped to the same Item Properties that I used in Inventor.  So they updated perfectly when the properties from Vault were updated.

Once again I turned to the programming gurus in the forums for help with the next step.  In what seemed like the blink of an eye (these guys are good!), I had a sample AutoLisp program written for me by Mr. Lee Mac ( http://lee-mac.com/)

(defun c:tabmod ( / c i o r s )

    (if (setq s (ssget “_:L” ‘((0 . “ACAD_TABLE”))))

        (repeat (setq i (sslength s))

            (setq o (vlax-ename->vla-object (ssname s (setq i (1- i))))

                  r (1- (vla-get-rows o))

            )

            (vla-insertrows o r (vla-getrowheight o r) 1)

            (repeat (setq c (vla-get-columns o))

                (vla-settext o r (setq c (1- c)) (vla-gettext o (1+ r) c))

                (vla-setcellstate o r c accellstatecontentlocked)

            )

        )

    )

    (princ)

)

(vl-load-com) (princ)

This program finds the table, copies the last row to a new row in order to get the fields.  It then sets the cells of the previous row to Text, maintaining the value.  Then it locks the content of that previous row so it cannot be modified.  Now the new row is set for Update Properties.  The whole thing is fast and silent, you don’t even realize what just happened.  Thanks Lee!

I was so confident by this time that I was certain the same program would work for Autodesk ® Autocad Electrical (AcadE).  I could have been more right.  I forgot that the only way to pull properties onto a drawing, from the Vault, is through the project manager in AcadE.  And these cannot use fields like Autocad.  AcadE needs to use a block with attributes, and these attributes need to be mapped to project properties through the project.wdt file.  This file maps attributes to the Project Descriptions which are edited through the project manager or are mapped from Vault.  So… the table was out.  I started playing with a block with the attributes mapped to the project in the .wdt file, and with a little practice I got that procedure down.  The descriptions are set up as Line Items in the project.wdl file, a text file that simply lists the line # and what property is associated with it:

 

 
Autocad Electrical Project.wdl Descriptions File

The .wdt file then lists the attributes that go with each line number… so they can find each other.  First giving the block name, and then mapping each attribute to a certain line item in the .wdl file.

Autocad Electrical Project.wdt Attibute File

So, using this I was able to get a table that accepted the Vault properties, mapped to the appropriate description in the project.  But, how to get a new line item while leaving the previous line intact.  I remembered seeing something in the Express Tools menu that would explode attributes to text.  Burst is the command name, but how to make use of it.  I created a secondary block with the same attributes, which was a single line of a revision table… no header.

Revision table block with header and Revision table single line item block – Tool Pallette

So for now, I simply place this new block, burst the previous line item (or the main block if there is only one revision) and then update properties to populate the new block.

I have enlisted, once again, the help of some new online friends for the following code which locates a specific block and bursts the attributes to text. Thanks to Lee Mac once again, and Henrique Silva – also a fellow Expert Elite.

(defun c:burev (/ pfst ss)
(if (setq ss (ssget “_x” ‘((0 . “INSERT”)(2 . “e-revtable”))))
(progn
(setq pfst (getvar ‘PICKFIRST))
(setvar ‘PICKFIRST 1)
(sssetfirst nil ss)
(c:burst)
(setvar ‘PICKFIRST pfst)
);; progn
)
(princ)
);; burev

I haven’t quite figured out where I want this to go yet… for the moment the manual burst seems to be working.  I’ve added the blocks, as well as the burst command to my tool pallettes to speed it up a bit.  I may have to think about this one some more.  Seems a shame to waste good code.  Thanks Guys!

So… three CAD systems, three different solutions to the same challenge, three custom programs to do the job.  My hand is getting tired from all of this typing, so I’m just going to end this here and call this part one…. stay tuned, more Item Master changes are coming soon!

Enjoy!

“Autodesk® screen shots reprinted with the permission of Autodesk, Inc.  Autodesk ® , AutoCAD ® , DWG, the DWG logo, Vault®, Autocad Electrical® and Inventor® are registered trademarks or trademarks of Autodesk, Inc., and/or its subsidiaries and/or affiliates in the USA and other countries.”  Programs and programmers’ information used with permission.  Thanks guys!

Advertisements
About

CAD Department Supervisor at Powell Fabrication & Manufacturing, Inc. CAD Designer & Detailer specializing in Inventor Tube & Pipe, Frame Generator, Content Center, Vault Professional. Autodesk Expert Elite member. Blogger. AU 2014 Speaker. Husband and father.

Posted in Autodesk Vault, Show All

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Post Archive
Follow me on Twitter
CADproTips

Providing the CAD knowledge you need to succeed.

The CAD Setter Out

AutoCAD and Inventor Tips, Tricks & Tutorials.

Design & Motion

Design and Manufacturing solutions through Digital Prototyping and Interoperability

CADToolbox.com

Dedicated to the Autodesk Inventor Community

%d bloggers like this: