Revision Table Column width

Revision Table Column width

Anonymous
Not applicable
1,339 Views
13 Replies
Message 1 of 14

Revision Table Column width

Anonymous
Not applicable

Hi everyone,

 

I've a problem setting the width of a column in a revision table inserted in a drawing via VBA.

 

Below my code

 

Sub RevisionTable()
    
    Dim oDrawDoc As DrawingDocument
   
    Dim oRTBs As RevisionTables
    Dim oLocation As Point2d
    Dim oRTB As RevisionTable
    Dim oRTC As RevisionTableColumn
        
    Set oDrawDoc = ThisApplication.ActiveDocument
    Set oRTBs = oDrawDoc.ActiveSheet.RevisionTables
    Set oLocation = ThisApplication.TransientGeometry.CreatePoint2d(30.253, 6.035)
        
    
    Set oRTB = oRTBs.Add(oLocation)
    
    oRTB.ShowTitle = False
    oRTB.TableDirection = kBottomUpDirection
    
    oRTB.RevisionTableColumns.Item(1).Delete
    oRTB.RevisionTableColumns.Item(3).Reposition (2)
    oRTB.RevisionTableColumns.Add (kRevisionTableSheetProperty)
    oRTB.RevisionTableColumns.Item(5).Title = "PROGETTISTA"
    oRTB.RevisionTableColumns.Item(5).Reposition (4)
    oRTB.RevisionTableColumns.Item(3).Reposition (2)
        
    For Each oRTC In oRTB.RevisionTableColumns
    
      oWidth = "1.2"
      oRTC.Width = oWidth
      
    Next
          
       
End Sub

 

Can someone help me?

 

Thanks.

 

 

0 Likes
1,340 Views
13 Replies
Replies (13)
Message 2 of 14

raymondxu
Autodesk
Autodesk

What is your inventor version?



Raymond Xu
Software Architect
Autodesk, Inc.
0 Likes
Message 3 of 14

JaneFan
Autodesk
Autodesk
Hello,

Please change this line and have a try:
oWidth = 1.2



Jane Fan
Inventor/Fusion QA Engineer
0 Likes
Message 4 of 14

raymondxu
Autodesk
Autodesk

Your VBA code can work well on my Inventor 2017. Please let me know your version, I will see whether we have a defect there.

 

Thanks!

Ray

 

 

 



Raymond Xu
Software Architect
Autodesk, Inc.
0 Likes
Message 5 of 14

Anonymous
Not applicable

Hi,

 

thanks for your reply!

 

I've tried with 1.2 but same problem...

0 Likes
Message 6 of 14

Anonymous
Not applicable

Hi,

 

thanks for the reply.

 

I've a 2016 Inventor version 64 bit.

0 Likes
Message 7 of 14

Anonymous
Not applicable

The Same code is working fine in Inventor 2016 also except the column number 5, because in my revision table I set only 4 columns. please check the name of column 5 and try.

0 Likes
Message 8 of 14

Anonymous
Not applicable

I've tried disabling the formatting to column 5 but...same error (see below)

 

error.jpg

 

The debug points to the line with the 'Width' method.

 

Thanks

0 Likes
Message 9 of 14

Snivek
Enthusiast
Enthusiast
Try oWidth = 1.2 in
0 Likes
Message 10 of 14

Snivek
Enthusiast
Enthusiast

Nevermind. Here is what I did to get it to work in iLogic.

 

Dim oDrawDoc As DrawingDocument
Dim oRTBs As RevisionTables
Dim oLocation As Point2D
Dim oRTB As RevisionTable
Dim oRTC As RevisionTableColumn

oDrawDoc = ThisApplication.ActiveDocument
oRTBs = oDrawDoc.ActiveSheet.RevisionTables
oLocation = ThisApplication.TransientGeometry.CreatePoint2d(30.253,6.035)

oRTB = oRTBs.Add(oLocation)

oRTB.ShowTitle = False
oRTB.TableDirection = TableDirectionEnum.kBottomUpDirection
oRTB.RevisionTableColumns.Item(1).Delete
oRTB.RevisionTableColumns.Item(3).Reposition(2)
oRTB.RevisionTableColumns.Add(RevisionTablePropertyEnum.kRevisionTableSheetProperty)
oRTB.RevisionTableColumns.Item(5).Title = "PROGETTISTA"
oRTB.RevisionTableColumns.Item(5).Reposition(4)
oRTB.RevisionTableColumns.Item(3).Reposition(2)

For Each oRTC In oRTB.RevisionTableColumns
oRTC.Width = 1.2
Next

 

0 Likes
Message 11 of 14

Anonymous
Not applicable

Rev_Table.PNGRev_Table_1.PNG

0 Likes
Message 12 of 14

Anonymous
Not applicable

Hi,

 

tried with iLogic...please see the following error reported.

 

Errore_1.jpg

 

Thanks.

0 Likes
Message 13 of 14

JaneFan
Autodesk
Autodesk

Hello,

 

I tried with Inventor 2016 but the code can be run without error both via VBA and iLogic.

Not sure what kind of settings of the document is making the trouble.

Would you please try to create a fresh drawing document, and do nothing but run your code via VBA or iLogic to see whether there is still error to set Width?




Jane Fan
Inventor/Fusion QA Engineer
0 Likes
Message 14 of 14

Anonymous
Not applicable

Ciao,

 

I tried with a fresh drawing but...same problem...

 

Actually I'm a litlle bit confused...I can not understand what is different my Inventor from yours.

 

Thanks.

0 Likes