Skip to content
Snippets Groups Projects
Commit 221f0bd4 authored by Mikhail Polikarpov's avatar Mikhail Polikarpov
Browse files

Export BB volumes to Excel

parent 878b7ea6
No related branches found
No related tags found
No related merge requests found
...@@ -188,6 +188,9 @@ Public Class AssemblyTiers2 ...@@ -188,6 +188,9 @@ Public Class AssemblyTiers2
MsgBox("Bounding box calculation took " & CStr(BBSecondsElapsed) & " seconds") MsgBox("Bounding box calculation took " & CStr(BBSecondsElapsed) & " seconds")
Debug.Print("Number of faces in assembly: " & CStr(intNumFaces)) Debug.Print("Number of faces in assembly: " & CStr(intNumFaces))
'Export BB volumes of parts to Excel
ExportBBVolumes()
'Collision parameters 'Collision parameters
If bAutomaticStep Then If bAutomaticStep Then
Dim dGeomMean As Double Dim dGeomMean As Double
...@@ -1875,6 +1878,33 @@ Finish: ...@@ -1875,6 +1878,33 @@ Finish:
Return True Return True
End Function End Function
Sub ExportBBVolumes()
'Use Excel
Dim objExcel As Microsoft.Office.Interop.Excel.Application
objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add()
objExcel.ActiveWorkbook.Sheets.Add.Name = "BB Volumes"
Dim objSheet1 As Object
objSheet1 = objExcel.ActiveWorkbook.Worksheets(1)
'Write data
objSheet1.Cells(1, 1).Value = "Product"
objSheet1.Cells(1, 2).Value = "BB volume"
For int_i = 0 To cRelevantProducts.Count - 1
Dim dPartBBVolume As Double
dPartBBVolume = (aPartBBGlob(int_i, 0) - aPartBBGlob(int_i, 1)) * (aPartBBGlob(int_i, 2) - aPartBBGlob(int_i, 3)) * (aPartBBGlob(int_i, 4) - aPartBBGlob(int_i, 5))
objSheet1.Cells(int_i + 2, 1).Value = cRelevantProducts.Item(int_i).Name
objSheet1.Cells(int_i + 2, 2).Value = dPartBBVolume
Next int_i
'Save and close excel workbook
Dim xlsFileName As String = CATIA.ActiveDocument.Name
objExcel.ActiveWorkbook.SaveAs(Filename:=xlsPath & xlsFileName & "_BB Volumes.xlsx")
objExcel.ActiveWorkbook.Close(SaveChanges:=True)
'close the excel application
objExcel.Quit()
ReleaseObject(objExcel)
End Sub
Private Sub ReleaseObject(ByVal obj As Object) Private Sub ReleaseObject(ByVal obj As Object)
Try Try
Dim intRel As Integer = 0 Dim intRel As Integer = 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment