streng
23rd Nov 2010, 11:19 pm
Hi
Hope someone can help.
I have created a code to fill a standard autocad table with attributed data.
I now want to write a code to edit the table by re-selecting the blocks.
To edit the table I have created a selection set of tables but I have one (what I thought would be simple) problem
I need to delete all the acDataRows and re-insert new rows.
Have included relevant part of code.
Option Explicit
Dim oTable As AcadTable
Dim TTN As Long
Private Sub PopTable()
GetRefTable
For Each oTable In ThisDrawing.SelectionSets.item("TableSS")
With oTable
MsgBox .StyleName & " - " & .Layer
'Try to delete all data rows and repopulate with 'x' rows
End With
Next
End Sub
Public Function GetRefTable() As AcadSelectionSet
'================================================= =============================
'Return a SelectionSet of Tables (From a Selection Window)
'================================================= =============================
Dim RefSS As AcadSelectionSet
Dim GroupCode(0 To 1) As Integer
Dim DataValue(0 To 1) As Variant
Dim FilterType As Variant
Dim FilterData As Variant
'------------------------------------------------------
On Error Resume Next
ThisDrawing.SelectionSets("TableSS").Delete
Set RefSS = ThisDrawing.SelectionSets.Add("TableSS")
GroupCode(0) = 0: DataValue(0) = "ACAD_table"
GroupCode(1) = 8: DataValue(1) = "TITLEBLOCK"
FilterType = GroupCode: FilterData = DataValue
ThisDrawing.Utility.Prompt ("Select Reference Table:")
RefSS.SelectOnScreen FilterType, FilterData
Set GetRefTable = RefSS
TTN = GetRefTable.count
End Function
Hope someone can help.
I have created a code to fill a standard autocad table with attributed data.
I now want to write a code to edit the table by re-selecting the blocks.
To edit the table I have created a selection set of tables but I have one (what I thought would be simple) problem
I need to delete all the acDataRows and re-insert new rows.
Have included relevant part of code.
Option Explicit
Dim oTable As AcadTable
Dim TTN As Long
Private Sub PopTable()
GetRefTable
For Each oTable In ThisDrawing.SelectionSets.item("TableSS")
With oTable
MsgBox .StyleName & " - " & .Layer
'Try to delete all data rows and repopulate with 'x' rows
End With
Next
End Sub
Public Function GetRefTable() As AcadSelectionSet
'================================================= =============================
'Return a SelectionSet of Tables (From a Selection Window)
'================================================= =============================
Dim RefSS As AcadSelectionSet
Dim GroupCode(0 To 1) As Integer
Dim DataValue(0 To 1) As Variant
Dim FilterType As Variant
Dim FilterData As Variant
'------------------------------------------------------
On Error Resume Next
ThisDrawing.SelectionSets("TableSS").Delete
Set RefSS = ThisDrawing.SelectionSets.Add("TableSS")
GroupCode(0) = 0: DataValue(0) = "ACAD_table"
GroupCode(1) = 8: DataValue(1) = "TITLEBLOCK"
FilterType = GroupCode: FilterData = DataValue
ThisDrawing.Utility.Prompt ("Select Reference Table:")
RefSS.SelectOnScreen FilterType, FilterData
Set GetRefTable = RefSS
TTN = GetRefTable.count
End Function