12-06-2018 12:17 AM - edited 12-06-2018 05:35 AM
Hi all,
I need to add a Row to the Revision table in drawing sheet and add new revision and date into the row. I used the following code.
Public Sub generateRow()
' ----------------------------------------------
myTabularNoteTags = New List(Of Tag)
If FindTabularNotes(myTabularNoteTags) = 0 Then
'no tabular notes to process
Return
End If
'----------------------------------------------------
For Each tableNote As Tag In myTabularNoteTags
tableNote = myTabularNoteTags.Item(0)
Dim numRows As Integer
ufsession.Tabnot.AskNmRows(tableNote, numRows)
Dim numCols As Integer
ufsession.Tabnot.AskNmColumns(tableNote, numCols)
For i As Integer = 0 To 0
'------------------------------------------------------
'To Get next revision version
'-----------------------------------------------------
ufsession.Tabnot.AskNthRow(tableNote, 0, rowTag)
ufsession.Tabnot.AskNthColumn(tableNote, 0, colTag)
ufsession.Tabnot.AskCellAtRowCol(rowTag, colTag, cellTag)
ufsession.Tabnot.AskCellText(cellTag, cellText)
letter = Chr(Asc(cellText) + 1)
'-----------------------------------------------------
'Adding a new row
'-----------------------------------------------------
ufsession.Tabnot.CreateRow(7, rowTag)
ufsession.Tabnot.AddRow(tableNote, rowTag, 0)
'------------------------------------------------------
'Adding new revison number
'-------------------------------------------------------
ufsession.Tabnot.AskNmRows(tableNote, numRows)
ufsession.Tabnot.AskNthRow(tableNote, 0, rowTag)
ufsession.Tabnot.AskNthColumn(tableNote, 0, colTag)
ufsession.Tabnot.AskCellAtRowCol(rowTag, colTag, cellTag)
ufsession.Tabnot.SetCellText(cellTag, letter)
'--------------------------------------------------------
'Adding revision date to table
'----------------------------------------------------------
ufsession.Tabnot.AskNthColumn(tableNote, 6, colTag)
ufsession.Tabnot.AskCellAtRowCol(rowTag, colTag, cellTag)
ufsession.Tabnot.SetCellText(cellTag, currentTime.ToShortDateString)
Next
Next
End Sub
Function FindTabularNotes(ByRef theTabNotes As List(Of Tag)) As Integer '----For after adding the table
'myTabularNoteTags
Dim tmpTabNote As NXOpen.Tag = NXOpen.Tag.Null
Dim type As Integer
Dim subtype As Integer
Do
ufsession.Obj.CycleObjsInPart(workPart.Tag, UFConstants.UF_tabular_note_type, tmpTabNote)
If tmpTabNote = NXOpen.Tag.Null Then
Continue Do
End If
If tmpTabNote <> NXOpen.Tag.Null Then
ufsession.Obj.AskTypeAndSubtype(tmpTabNote, type, subtype)
If subtype = UFConstants.UF_tabular_note_subtype Then
theTabNotes.Add(tmpTabNote)
End If
End If
Loop Until tmpTabNote = NXOpen.Tag.Null
Return theTabNotes.Count
End Function
End Class
it is working for some drawing sheet but doesn't for most it adds row to billing table
Help me with alternative way for adding row and data to revision table