02-22-2021
12:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
02-22-2021
12:53 AM
Export DXF Flat pattern in sub-assembly with iLogic
Hi everyone,
I'm trying to export the dxf flat pattern of sheet metal part in assembly B that is place in Assembly A.
I tryed to use this rule, but it didn't run correcty. Where is the error?
'IPT_OM_template is the name of Assembly in the rule
Sub Print_Assembly_IPT_DXF(IPT_OM_Template As String, pathOutputDXF As String)
Dim oAsm As AssemblyDocument
Dim oPenDoc as Document=ThisDoc.Document
Dim AsmCompDefMainL0 As AssemblyComponentDefinition = ThisApplication.ActiveDocument.ComponentDefinition
Dim AsmCompDefL1 As AssemblyComponentDefinition = ThisApplication.ActiveDocument.ComponentDefinition
Dim OccurMainL0 As ComponentOccurrence
Dim OccurL1 as ComponentOccurrence
Dim AsmCompMainL0 As ComponentDefinition = ThisDoc.Document.ComponentDefinition
Dim AsmCompMainL1 As ComponentDefinition = ThisDoc.Document.ComponentDefinition
For Each OccurMainL0 In AsmCompDefMainL0.Occurrences
Dim oOccNameL0 As String = OccurMainL0.Name
Dim thisAssembly as AssemblyDocument = oOccNameL0
Logger.Info("Apro assieme per DXF: " & oOccNameL0)
'If OccurMainL0.Definition.Type = ObjectTypeEnum.kAssemblyComponentDefinitionObject Then
'For Each OccurL1 In OccurMainL0.SubOccurrences
For Each doc In thisAssembly.AllReferencedDocuments
Dim parsedPartName = doc.DisplayName
Logger.Info("Selezionare parte da esportare in DXF: " & parsedPartName)
if parsedPartName.Contains("CTG") Then
Logger.Info("Ho selezionato la parte in CTG")
Else
Logger.Info("Ho selezionato la parte in lamiera")
Dim sOut As String = "FLAT PATTERN DXF?AcadVersion=2004&OuterProfileLayer=OUTER_PROFILE&OuterProfileLayerColor=0;0;0&InteriorProfilesLayer=INNER_PROFILE&InteriorProfilesLayerColor=0;0;0&InvisibleLayers=IV_BEND;IV_BEND_DOWN;IV_UNCONSUMED_SKETCH;IV_ARC_CENTERS;IV_TANGENT;IV_ROLL;IV_ROLL_TANGENT;IV_ALTREP_BACK;IV_ALTREP_FRONT;IV_FEATURE_PROFILES_DOWN;IV_FEATURE_PROFILES;IV_TOOL_CENTER;IV_TOOL_CENTER_DOWN;DIGI_MARKER_TOOL_1;DIGI_MARKER_TOOL_2"
Dim component As SheetMetalComponentDefinition = doc.ComponentDefinition
Dim PathDXF as String = pathOutputLamieraDXF & iProperties.Value(OccurL1, "Custom", "Nome_File")
component.Unfold
If System.IO.File.Exists(pathOutputDXF) = True Then
System.IO.File.Delete(pathOutputDXF)
End If
component.DataIO.WriteDataToFile(sOut, PathDXF )
Logger.Info("DXF " & SharedVariable("VPR_Codice") & " SUCCESS")
component.FlatPattern.ExitEdit()
doc.Close()
End if
Next
'End if
Next
End Sub