09-24-2023
12:52 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
09-24-2023
12:52 PM
try this:
Dim extension = ".csv"
Try
If (System.IO.File.Exists(ThisDoc.PathAndFileName(False) + extension)) Then
System.IO.File.Delete(ThisDoc.PathAndFileName(False) + extension)
End If
Dim sBom = ThisDoc.Document.ComponentDefinition.BOM
sBom.PartsOnlyViewEnabled = True
Dim sBOMView = sBom.BOMViews.Item("Только детали")
For Each sRow As BOMRow In sBOMView.BOMRows
Try
Dim sCompDef = sRow.ComponentDefinitions.Item(1)
If sCompDef.Type = ObjectTypeEnum.kSheetMetalComponentDefinitionObject Then
Try
If sCompDef.HasFlatPattern Then
Dim oFlat = sCompDef.FlatPattern
Dim oStr = sCompDef.Document.DisplayName
oStr = oStr + ";" + (oFlat.Length * 10).ToString
oStr = oStr + ";" + (oFlat.Width * 10).ToString
oStr = oStr + ";" + (sCompDef.Thickness.Value * 10).ToString
oStr = oStr + ";" + (sCompDef.Material.Name).ToString
oStr = oStr + ";" + (sRow.ItemQuantity).ToString
System.IO.File.AppendAllText(ThisDoc.PathAndFileName(False) + extension, oStr + vbNewLine, System.Text.Encoding.Default)
End If
Catch
MessageBox.Show("Ошибка 2", "Ошибка")
End Try
End If
Catch
MessageBox.Show("Ошибка 3", "Ошибка")
End Try
Next
Catch
MessageBox.Show("Ошибка 4", "Ошибка")
End Try
Try
ThisDoc.Launch(ThisDoc.PathAndFileName(False) + extension)
Catch
MessageBox.Show("Ошибка открытия файла", "Ошибка")
End Try
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Blog: hjalte.nl - github.com