Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
R.Mabery
in reply to: Anonymous

'START 
Quit=MessageBox.Show("Do you wish to run this rule?","title",MessageBoxButtons.YesNo)
If Quit=7 Then
Exit Sub
End If

Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument

Dim oSheet As Sheet
oSheet = oDrawDoc.Sheets.Item(1)

TableCheck:'------------------------------------------------------'---------------start finding the table----------------'------------------------------------------------------
For i = 1 To oSheet.CustomTables.Count
    TableTitle = oSheet.CustomTables.Item(i).Title                       
    If TableTitle = "Operating Conditions" Then
        'Remember the table number for editing section
        TableNr = i
        'If table found jump to edit section
        GoTo EditTable
    End If
Next
'------------------------------------------------------'---------------end finding the table----------------'------------------------------------------------------

'CreateTable:'------------------------------------------------------'---------------start creating the table---------------'------------------------------------------------------' Set the column titles
oTitles = New String(){"Item", "Description"}'
'
'
' Create the custom table
oCustomTable = oSheet.CustomTables.Add("Operating Conditions", ThisApplication.TransientGeometry.CreatePoint2d(15, 15), _
                                    2, 11, oTitles,oContents, oColumnWidths)
'------------------------------------------------------'---------------finish creating the table---------------'------------------------------------------------------'edit the table by restarting the check routine
GoTo TableCheck


EditTable:'------------------------------------------------------'---------------start editing the table---------------'------------------------------------------------------'Get the name Of the first model in the drawing
modelName = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)
'MessageBox.Show(modelName, "ilogic")'
'
'
'
'------------------------------------------------------'---------------finish editing the table---------------'------------------------------------------------------

Hi, it's working fine here.  The only place I see a possible issue is if your drawing doesn't have a model in it.  It could fail as currently written if there is no drawing view of a model to get in that last line.

 

 


Thanks,
Randy Mabery
Applications Expert
IMAGINiT Technologies