CustomTable, detect if split

CustomTable, detect if split

sellis
Advocate Advocate
741 Views
2 Replies
Message 1 of 3

CustomTable, detect if split

sellis
Advocate
Advocate

Inventor 2017, VS 2015, VB.net addin

 

My addin creates a CustomTable. The addin can update this table and any copies made of the table as data changes. It does this by looking at the CustomTables and replacing the rows of each table with a matching title. 

 

Problem comes when I manually split the table (right click table,Table,Split Table). My addin then sees two tables and tries to update both. I can not find a way to detect if the second table is a copy of first that also needs its data updated or is split off the original table. If I try to change the split section inventor exits to desktop (I assume this is a bug in inventor). 

 

My workaround is to gather properties about each matching table and delete it which will delete any split off sections. After I use the properties gathered to recreate the tables. But I have to then manually recreate the splits that are sometimes necessary.

 

So... how do I deal with split CustomTables?

 

Stan

 

 

0 Likes
Accepted solutions (1)
742 Views
2 Replies
Replies (2)
Message 2 of 3

wayne.brill
Collaborator
Collaborator
Accepted solution

Hi Stan,

 

I am not finding a property on a CustomTable object that will tell if it is split or not.

 

I see that if a CustomTable is split then there is a node in the browser for the split part of the table. In my quick test the VBA code below is determining if a table with the title "Employees" was split. Maybe this could be a work around. It checks to see if the native object for the BrowserNode is a CustomTable.  I am not sure of your workflow and maybe you would not need to do this test. (you could just check the number of BrowserNodes it has)

 

Public Sub customTableIsSlpit_UsingBrowserPaneTest()
    Dim oDrwDoc As DrawingDocument
    Set oDrwDoc = ThisApplication.ActiveDocument
    
    Debug.Print oDrwDoc.ActiveSheet.CustomTables.count

    Dim oBrowserPane As BrowserPane
    Set oBrowserPane = oDrwDoc.BrowserPanes.ActivePane

    Dim oTopBrowserNode As BrowserNode
    Set oTopBrowserNode = oBrowserPane.TopNode
   
    Dim oBrowserNode As BrowserNode
    
    For Each oBrowserNode In oTopBrowserNode.BrowserNodes
     If oBrowserNode.BrowserNodeDefinition.Label = "Sheet:1" Then
        
        Dim oBrowserNode2 As BrowserNode
        For Each oBrowserNode2 In oBrowserNode.BrowserNodes
               
          If oBrowserNode2.BrowserNodeDefinition.Label = "Employees" Then
                      
            Dim oNativeObject As Object
            Set oNativeObject = oBrowserNode2.NativeObject

            If TypeName(oNativeObject) = "CustomTable" Then
                If oBrowserNode2.BrowserNodes.count > 0 Then
                    MsgBox "Custom Table is split"
                Else
                   MsgBox "Custom Table is NOT split"
                End If
                Exit For
            End If
         End If ' If label = "Employees"
       Next
      End If ' If label = "Sheet:1"
    Next
       
End Sub

 

Thanks,

Wayne

 



Wayne Brill
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 3

sellis
Advocate
Advocate

I can work with this... will just use the browser nodes to select the CustomTable I want to update.

 

Thanks!

0 Likes