Ниже код для вставки блока с 2мя атрибутами, но хотелось бы Позиционной выноской?
И возможно ли в NanoCAD (не СПДС), т.к. в нем тоже есть объект Позиционная выноска?
Sub NANO_Block_2attrib()
Dim wrksht As Worksheet
Dim lastRow As Long
Dim firstRow As Long
Dim blockRefObj As AcadBlockReference
Dim Attr As Variant
Dim i As Long
Dim j As Long
On Error GoTo ERRORHANDLER
Set app = GetObject(, “nanoCAD.Application”)
ERRORHANDLER:
If Err.Description <> “” Then
Set app = CreateObject(“nanoCAD.Application”)
End If
app.Visible = True
app.Visible = True
Set ThisDrawing = app.ActiveDocument
Set wrksht = ActiveWorkbook.Worksheets(“5_Блок-с-Атр_2”)
wrksht.Activate
With wrksht
lastRow = .Cells(.Rows.Count, “A”).End(xlUp).Row
End With
firstRow = 2
Dim InsPoint(0 To 2) As Double
For i = firstRow To lastRow
InsPoint(0) = Range(“B” & i).Value: InsPoint(1) = Range(“C” & i).Value: InsPoint(2) = 0
On Error Resume Next
Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(InsPoint, Range(“A” & i).Value, Range(“D” & i).Value, Range(“D” & i).Value, Range(“D” & i).Value, Range(“E” & i).Value)
Attr = blockRefObj.GetAttributes
For j = 0 To UBound(Attr)
If Attr(j).TagString = “ТЕКСТ1” Then Attr(j).TextString = Range(“F” & i).Value
If Attr(j).TagString = “ТЕКСТ2” Then Attr(j).TextString = Range(“G” & i).Value
Next j
Next i
ThisDrawing.Regen acAllViewports
app.ZoomExtents
Set blockRefObj = Nothing
Set ThisDrawing = Nothing
Set app = Nothing
MsgBox “Блоки вставлены!”, vbInformation, “Finished”
End Sub