Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
With the iLogic code below, I export my components in the assembly as DXF. But I want to print the quantity information at the end of the exported files. It can get the number of pieces from the BOM. For example;
2301 05 02 - 16 QTY
Sub Main() Dim New_Folder_Path As String = ThisDoc.Path Dim oAsmDoc As AssemblyDocument = ThisDoc.Document My.Computer.FileSystem.CreateDirectory(New_Folder_Path) 'Ask user for REV level Dim Rev_Level As String = "" Rev_Level = InputBox ("Enter Rev Level","Creating DXF files For Entire Assembly") Dim Count_up As Integer = 0 Dim Gauge_Folders(12) As String Dim Ga As String Dim doc As Document Dim R_Part As String Dim oMaterial As Material For Each doc In oAsmDoc.AllReferencedDocuments If doc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then Try R_Part = doc.DisplayName oMaterial = doc.ComponentDefinition.Material Gauge_Path = New_Folder_Path & "\" & Parameter(R_Part, "Thickness") & " " & oMaterial.Name MessageBox.Show(Gauge_Path ) Try My.Computer.FileSystem.CreateDirectory(Gauge_Path) Catch End Try Call Make_DXF(doc, Rev_Level, Gauge_Path) Catch End Try End If Next MsgBox("DXF Export Complete",,"All Done") End Sub Sub Make_DXF(oDoc As Document, Rev_L As String, File_Location As String) ThisApplication.Documents.Open(oDoc.FullFileName, True) Dim Part_Name As String = oDoc.DisplayName Dim TestPos As Integer = 0 Dim Rev_Adder As String = "" If Rev_L <> "" Then Rev_Adder = " REV " & Rev_L TestPos = InStr(1, Part_Name, ".") If TestPos <> 0 Then Part_Name = Left(Part_Name, InStr(Part_Name, ".")-1) Dim New_Name As String = Part_Name Dim oFilename As String = File_Location & "\" & New_Name & Rev_Adder & ".dxf" Dim oCompDef As SheetMetalComponentDefinition = oDoc.ComponentDefinition If oCompDef.HasFlatPattern = False Then oCompDef.Unfold Else oCompDef.FlatPattern.Edit End If Dim oFlatPattern As FlatPattern = oCompDef.FlatPattern Dim oFace As Face = oFlatPattern.TopFace Dim oCommand As CommandManager = ThisApplication.CommandManager oCommand.DoSelect(oFace) oCommand.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent,oFilename) oCommand.ControlDefinitions.Item("GeomToDXFCommand").Execute2(True) oCompDef.FlatPattern.ExitEdit oDoc.Close End Sub
Solved! Go to Solution.