Public Sub AsScan()
'Разные переменные
Dim i As Integer
' Активация сборки
Dim ass_DCE As Inventor.AssemblyDocument
Set ass_DCE = ThisApplication.ActiveDocument
'Определяем компонент сборки
Dim part_DCE As Inventor.PartDocument
Dim oCompDef As ComponentDefinition
Set oCompDef = ass_DCE.ComponentDefinition
'активация EXCEL
Excel.Application.Workbooks.Add
Dim WBook As Excel.Workbook
Set WBook = Excel.ActiveWorkbook
Dim LSheets As Excel.Sheets
Set LSheets = WBook.Sheets
''Шпака для таблицы
LSheets.Application.Cells(1, 1) = "Обозначение"
LSheets.Application.Cells(1, 2) = "Наименование"
LSheets.Application.Cells(1, 3) = "Масса, кг"
LSheets.Application.Cells(1, 4) = "Площадь поверхности детали"
LSheets.Application.Cells(1, 5) = "Габарит.Длина"
LSheets.Application.Cells(1, 6) = "Габарит.Ширина"
LSheets.Application.Cells(1, 7) = "Габарит.Высота"
Dim occ As ComponentOccurrence
Dim odoc As Document
Dim name_DCE As String
i = 2
For Each odoc In oCompDef.Document.AllReferencedDocuments
Set occ = oCompDef.Occurrences.AllReferencedOccurrences(odoc).Item(1)
name_DCE = odoc.DisplayName
' 'Определение 1 точки параллелограмма
Xo = occ.RangeBox.MinPoint.X
Yo = occ.RangeBox.MinPoint.Y
Zo = occ.RangeBox.MinPoint.Z
' 'определение второй точки параллелограмма
X1 = occ.RangeBox.MaxPoint.X
Y1 = occ.RangeBox.MaxPoint.Y
Z1 = occ.RangeBox.MaxPoint.Z
' 'Расчет размеров габаритов ДСЕ
With_FP = (X1 - Xo) * 10
Leght_FP = (Y1 - Yo) * 10
T_Fp = (Z1 - Zo) * 10
'Вывод в ексель
'-----------------------------------------------------------------------------------------------
LSheets.Application.Cells(i, 1) = Format(name_DCE, "###0.00")
LSheets.Application.Cells(i, 3) = Format(occ.MassProperties.Mass, "###0.00")
LSheets.Application.Cells(i, 4) = Format(occ.MassProperties.Area / 10000, "###0.00")
LSheets.Application.Cells(i, 5) = Format(Leght_FP, "###0.00")
LSheets.Application.Cells(i, 6) = Format(With_FP, "###0.00")
LSheets.Application.Cells(i, 7) = Format(T_Fp, "###0.00")
i = 1 + i
Next
Excel.Application.Workbooks.Close
Excel.Application.Quit
End Sub