Hallo,
I have a question about Hole table.
I wrote a macro that modify the cell in the description colum where the cell value in empty (for me it'snt a hole wizard),
so I add "It's not a Hole Wizard"
But if I want add a text (ex. "See section") in the exist text cell is it possible without touch the variables?
This row of code does't works:
Dim testo As String
testo = swTableAnnotation.Text(intRow, intCol)
swTableAnnotation.Text(intRow, intCol) = testo & " See section "
This is my actual macro:
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swHoleTable As SldWorks.HoleTable
Dim swHoleTableAnnotation As SldWorks.HoleTableAnnotation
Dim swTableAnnotation As SldWorks.TableAnnotation
Dim swAnnotation As SldWorks.Annotation
Dim boolstatus As Boolean
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
boolstatus = swModel.Extension.SelectByID2("Tabella di foratura1", "HOLETABLE", 0, 0, 0, False, 0, Nothing, 0)
Set swHoleTable = swSelMgr.GetSelectedObject6(1, -1)
Set swHoleTableAnnotation = swHoleTable.GetTableAnnotations(0)
Set swTableAnnotation = swHoleTableAnnotation
Set swAnnotation = swTableAnnotation.GetAnnotation
If swHoleTable Is Nothing Then
MsgBox ("Hole table is nothing")
End
End If
start:
'
Dim intCol As Integer
For intCol = 0 To swTableAnnotation.ColumnCount - 1
For intRow = 1 To swTableAnnotation.RowCount - 1
Debug.Print swTableAnnotation.Text(intRow, intCol)
If swTableAnnotation.Text(0, intCol) = "DESCRIZIONE" Then
Dim testo As String
testo = swTableAnnotation.Text(intRow, intCol)
swTableAnnotation.Text(intRow, intCol) = testo & " See section "
If testo = "" Then
Dim value As Boolean
value = swTableAnnotation.DeleteRow(intRow)
GoTo start
swTableAnnotation.Text(intRow, intCol) = "This is not a Hole Wizard"
Debug.Print swTableAnnotation.Text(intRow, 0)
End If
End If
Next intRow
Next intCol
swHoleTable.EnableUpdate = True ' Update hole table and model view
End Sub
Thanks a lot
SolidworksApi macros