Sub TabCol()
Dim FilterType(0 To 1) As Integer
Dim FilterData(0 To 1) As Variant
Dim FlagTCdAnt As Boolean
Dim ModelSpecObj As AcadModelSpace
Dim NCirc As Integer
Dim NCol As Integer, NLin As Integer
Dim NOrig As Integer
Dim NumLinsTCd As Variant
Dim PtoInsTCd As Variant
Dim PtoLL As Variant, PtoUR As Variant
Dim PtoMR(0 To 2) As Double
Dim SelEnt As AcadSelectionSet
Dim TabEnt As AcadTable
Dim TCCdEnt As AcadTable
Dim Verde As AcadAcCmColor
Dim Dad() As String
Dim TagShf As String
Dim LrgShf As Single
Dim PrfShf As Single
'GetEsc Esc
'check if there are no crossings
For Each SSet In ThisDrawing.SelectionSets
If SSet.Name = "ENTS" Then
ThisDrawing.SelectionSets.Item("ENTS").Delete ' preciso trocar o nome ents
Exit For
End If
Next SSet
'creat crossings
Set SelEnt = ThisDrawing.SelectionSets.Add("ENTS")
'check the block
Set BlkCol = ThisDrawing.Blocks
'filter the type of block
FilterType(0) = 0
FilterData(0) = "Insert"
FilterType(1) = 8 ' vai precisar acrescentar desenhos 3d
FilterData(1) = "SHF" ' preciso trocar o shf
SelEnt.SelectOnScreen FilterType, FilterData
'MAKES ANALYSIS AND DEFINITIONS ABOUT THE OBJECTS THAT PASS THROUGH THE FILTER
For Each BlkEnt In SelEnt 'preciso trocar nome do for
If Left(BlkEnt.Name, 5) = "HD§SH" Then ' n sei exatamente o q é mas sh preciso trocar
NumCarTagShf = Len(BlkEnt.Name)
TagShf = Right(BlkEnt.Name, NumCarTagShf - 3)
Set BlkDef = BlkCol.Item(BlkEnt.Name)
NumEntsShf = BlkDef.Count
''DEFINE THE STARTING POINT OF TABLE INSERTION
PtInsShf = BlkEnt.InsertionPoint
AngTab = BlkEnt.Rotation
XSFac = BlkEnt.XScaleFactor
'' EXTRACT DIMENSIONS FROM THE DRAWING
AtribColShf = BlkEnt.GetAttributes
For Each Atrib In AtribColShf
Select Case Atrib.TagString
Case "LARG"
LrgShf = Atrib.TextString
Case "PROF"
PrfShf = Atrib.TextString ' talvez precise criar mais uma variavel para pegar o comprimento
End Select
Next Atrib
ReDim Dad(1 To NumEntsShf, 1 To 2) As String
'CYCLES THE ENTITIES IN THE BLOCK, AND STORES THE COLUMN TAGS, THEIR 'DIAMETER AND THE
'NUM OF COLUMNS PRESENT IN SHAFT
NumColShf = 0
For NEnt = 0 To NumEntsShf - 1
Set EntBlkCol = BlkDef.Item(NEnt)
If EntBlkCol.ObjectName = "AcDbBlockReference" Then
If Left(EntBlkCol.Name, 6) = "HD§COL" Then
NumColShf = NumColShf + 1
AtribColCol = EntBlkCol.GetAttributes
For Each AtribCol In AtribColCol
Select Case AtribCol.TagString
Case "TAG"
Dad(NumColShf, 1) = AtribCol.TextString
Case "DIA"
Dad(NumColShf, 2) = AtribCol.TextString
End Select
Next AtribCol
End If
End If
Next NEnt
'CALCULATES INSERTION POINT OF COLUMN DATA TABLE
HTab = (NumColsShf * 4 + 5) * Esc ' preciso redimencionar tudo isso para o meu objetivo
DistP1 = Sqr((LrgShf / 2) ^ 2 + PrfShf ^ 2)
AngP1 = Atn(PrfShf / LrgShf * 2)
XInsTab = LrgShf / 2 - HTab / 2
YInsTab = PrfShf * SFac + 10 * Esc
DistPtTab = Sqr(XInsTab ^ 2 + YInsTab ^ 2)
AngPtTab = Atn(YInsTab / XInsTab) + Pi
'CALCULATE THE INSERTION POINT OF THE DATA TABLE OF COLUMNS AND EXTERNAL POINTS OF THE LINE
'CALL
PtTab = ThisDrawing.Utility.PolarPoint(PtInsShf, AngPtTab + AngTab, DistPtTab)
PtP1 = ThisDrawing.Utility.PolarPoint(PtInsShf, AngP1 + AngTab, DistP1)
PtP2 = ThisDrawing.Utility.PolarPoint(PtTab, AngTab, HTab / 2)
'CALL PROCEDURE TO DRAW, FORMAT, SCALE AND ROTATE THE DATA TABLE 'OF COLUMNS AND DRAW LEADER LINE
If XSFac = -1 Then
CorAng = Pi
Else
CorAng = 0
End If
DesTCol PtTab, AngTab + CorAng + Pi / 2, Val(NumColShf), TagShf, Dad
Set LineObj = ThisDrawing.ModelSpace.AddLine(PtP1, PtP2)
LineObj.Layer = "TABCOL"
End If
Next BlkEnt
'delet selection set
ThisDrawing.SelectionSets.Item("ENTS").Delete
End Sub
'THIS PART DRAWS THE SHAFTS TABLE
Sub DesTCol(PtInsTC As Variant, AngTC, NumCols As Integer, TagShf, Dad() As String)
Dim NCol As Integer, NLin As Integer
Dim TColsEnt As AcadTable
'FORMATTING VARIABLES
Set Verd = AcadApplication.GetInterfaceObject("AutoCAD.acCmColor.20") ' talvez trocar as cores
Set Cyan = AcadApplication.GetInterfaceObject("AutoCAD.acCmColor.20")
Verd.ColorIndex = acGreen
Cyan.ColorIndex = acCyan
'CREATE A TABLE OF COLUMN DATA AT THE INFORMED INSERTION POINT
Set TColsEnt = ThisDrawing.ModelSpace.AddTable(PtInsTC, NumCols + 1, 3, 4, 10)
With TColsEnt
.AllowManualHeights = True
'CYCLE THE ARROW THE WIDTH OF THE COLUMNS
.SetColumnWidth 1, 8
.SetColumnWidth 2, 8
'MERGE AND FORMAT HEADER CELL LINES AND TEXT
.MergeCells 0, 0, 0, 2
.SetRowHeight 0, 3
.SetCellContentColor 0, 0, Verd
.SetCellTextHeight 0, 0, 2
.SetCellAlignment 0, 0, acMiddleCenter
.SetCellGridColor 0, 0, AcCellEdgeMask.acLeftMask, Cyan
.SetCellGridColor 0, 2, AcCellEdgeMask.acRightMask, Cyan
.SetCellGridColor 0, 0, AcCellEdgeMask.acBottomMask, Verd
.SetCellGridColor 0, 1, AcCellEdgeMask.acBottomMask, Verd
.SetCellGridColor 0, 2, AcCellEdgeMask.acBottomMask, Verd
'CYCLAE FORMATS THE CELLS OF THE OTHER LINES
For NLin = 1 To NumCols
For NCol = 0 To 2
.SetCellAlignment NLin, NCol, acMiddleCenter
.SetCellTextStyle NLin, NCol, "SIMPLEX"
Next NCol
Next NLin
'FORMAT AND LOWER CLOSURE OF THE TABLE
.SetCellGridColor NumCols, 0, AcCellEdgeMask.acBottomMask, Cyan
.SetCellGridColor NumCols, 1, AcCellEdgeMask.acBottomMask, Cyan
.SetCellGridColor NumCols, 2, AcCellEdgeMask.acBottomMask, Cyan
'PRENCHE CÉLULA DE CABEÇALHO
.SetText 0, 0, "SHAFT" & TagShf
'CICLA LINHAS E COLUNAS E FORMATA TEXTO DAS DEMAIS LINHAS DA TABELA
For NLin = 1 To NumCols
.SetText NLin, 0, Dad(NLin, 1)
.SetText NLin, 2, Dad(NLin, 2)
Next NLin
'SCALE THE TABLE AND COLUMNS AND SWITCH TO THE TABCOL LAYER
'.StyleName = "TABCOLS"
' .ScaleEntity PtInsTC, 1 * Esc
' .Rotate PtInsTC, AngTC
' .Layer = "TABCOL"
End With
End Sub
I managed to find a rudimentary code, but due to updates to the project I need to do something similar with 3dsolid, but I'm finding little information, at the moment I'm studying it alone, but if anyone can help