<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Export DXF Flat pattern in sub-assembly with iLogic in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/export-dxf-flat-pattern-in-sub-assembly-with-ilogic/m-p/10101239#M121220</link>
    <description>&lt;P&gt;Hi everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to export the dxf flat pattern of sheet metal part in assembly B that is place in Assembly A.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tryed to use this rule, but it didn't run correcty.&amp;nbsp; Where is the error?&lt;/P&gt;&lt;LI-CODE lang="general"&gt;'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: " &amp;amp; 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: " &amp;amp; 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&amp;amp;OuterProfileLayer=OUTER_PR​OFILE&amp;amp;OuterProfileLayerColor=0;0;0&amp;amp;InteriorProfilesLayer=INNER_PROFILE&amp;amp;InteriorProfilesLayerColor=0;0;0&amp;amp;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 &amp;amp; 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 " &amp;amp; SharedVariable("VPR_Codice") &amp;amp; " SUCCESS")
			component.FlatPattern.ExitEdit()
			doc.Close()
			End if
			Next
		'End if
	Next
End Sub&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 22 Feb 2021 08:53:00 GMT</pubDate>
    <dc:creator>filippo.costantin3HZMT</dc:creator>
    <dc:date>2021-02-22T08:53:00Z</dc:date>
    <item>
      <title>Export DXF Flat pattern in sub-assembly with iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/export-dxf-flat-pattern-in-sub-assembly-with-ilogic/m-p/10101239#M121220</link>
      <description>&lt;P&gt;Hi everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to export the dxf flat pattern of sheet metal part in assembly B that is place in Assembly A.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tryed to use this rule, but it didn't run correcty.&amp;nbsp; Where is the error?&lt;/P&gt;&lt;LI-CODE lang="general"&gt;'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: " &amp;amp; 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: " &amp;amp; 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&amp;amp;OuterProfileLayer=OUTER_PR​OFILE&amp;amp;OuterProfileLayerColor=0;0;0&amp;amp;InteriorProfilesLayer=INNER_PROFILE&amp;amp;InteriorProfilesLayerColor=0;0;0&amp;amp;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 &amp;amp; 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 " &amp;amp; SharedVariable("VPR_Codice") &amp;amp; " SUCCESS")
			component.FlatPattern.ExitEdit()
			doc.Close()
			End if
			Next
		'End if
	Next
End Sub&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 22 Feb 2021 08:53:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/export-dxf-flat-pattern-in-sub-assembly-with-ilogic/m-p/10101239#M121220</guid>
      <dc:creator>filippo.costantin3HZMT</dc:creator>
      <dc:date>2021-02-22T08:53:00Z</dc:date>
    </item>
    <item>
      <title>Betreff: Export DXF Flat pattern in sub-assembly with iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/export-dxf-flat-pattern-in-sub-assembly-with-ilogic/m-p/10135575#M121802</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which row of your Code is right? It seems you mixed two scripts together.&lt;/P&gt;&lt;P&gt;Is your script called by another script or should it run alone? I assume you calling this script by a Main sub. You will have to fill the string variables for template name and output path. There is a shared variable "VPR_Codice" and I assume it is set elsewhere. There is a variable "pathOutputLamieraDXF" used, but not set anywhere.&lt;/P&gt;&lt;P&gt;I've commented unused code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps it will help, otherwise you have to post more details. It didn't run correctly is a little bit less information. &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@7B4B80143EBEB4F250CEEC82342F6CA1/emoticons/1f609.png" alt=":winking_face:" title=":winking_face:" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sub Main()
	Dim IPT_OM_Template As String = ""	'&amp;lt;--- Fill missing Text
	Dim pathOutputDXF As String = ""		'&amp;lt;--- Fill missing Text
	
	Call Print_Assembly_IPT_DXF(IPT_OM_Template, pathOutputDXF)
End Sub	

'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 = ThisDoc.Document 
	'Dim oPenDoc As Document=ThisDoc.Document
	Dim AsmCompDefMainL0 As AssemblyComponentDefinition = oAsm.ComponentDefinition '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: " &amp;amp; oOccNameL0)
		If OccurMainL0.Definition.Type = ObjectTypeEnum.kAssemblyComponentDefinitionObject Then
			For Each OccurL1 In OccurMainL0.SubOccurrences
			'For Each doc In thisAssembly.AllReferencedDocuments
				If OccurL1.Definition.Type=ObjectTypeEnum.kSheetMetalComponentDefinitionObject Then
					Dim parsedPartName = OccurL1.ReferencedDocumentDescriptor.DisplayName ' doc.DisplayName
					Logger.Info("Selezionare parte da esportare in DXF: " &amp;amp; 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&amp;amp;OuterProfileLayer=OUTER_PR​OFILE&amp;amp;OuterProfileLayerColor=0;0;0&amp;amp;InteriorProfilesLayer=INNER_PROFILE&amp;amp;InteriorProfilesLayerColor=0;0;0&amp;amp;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 = OccurL1.Definition
						'Dim PathDXF As String = pathOutputLamieraDXF &amp;amp; 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)
						component.DataIO.WriteDataToFile(sOut, pathOutputDXF )
						Logger.Info("DXF " &amp;amp; SharedVariable("VPR_Codice") &amp;amp; " SUCCESS")
						component.FlatPattern.ExitEdit()
						'component.Document.close()
					End If
				End If
			Next
		End If
	Next
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Mar 2021 18:09:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/export-dxf-flat-pattern-in-sub-assembly-with-ilogic/m-p/10135575#M121802</guid>
      <dc:creator>Ralf_Krieg</dc:creator>
      <dc:date>2021-03-06T18:09:10Z</dc:date>
    </item>
    <item>
      <title>Betreff: Export DXF Flat pattern in sub-assembly with iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/export-dxf-flat-pattern-in-sub-assembly-with-ilogic/m-p/10156779#M122155</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your answer. Yes I use a Sub Main () for this code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;here the input that you need:&lt;/P&gt;&lt;P&gt;IPT_OM Template is the name of the assembly&lt;/P&gt;&lt;P&gt;Path_Output_DXF is the path of folder where I would save the DXF flat pattern of part.&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SharedVariable&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"pathOutputLamieraDXF"&lt;/SPAN&gt;&lt;SPAN&gt;)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;SharedVariable&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"thisDocPath"&lt;/SPAN&gt;&lt;SPAN&gt;)&amp;nbsp;&amp;amp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"\Output_DXF\"&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I attached the assembly which I use for create the assembly.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt; IPT_OM_Template&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Mar 2021 08:15:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/export-dxf-flat-pattern-in-sub-assembly-with-ilogic/m-p/10156779#M122155</guid>
      <dc:creator>filippo.costantin3HZMT</dc:creator>
      <dc:date>2021-03-15T08:15:14Z</dc:date>
    </item>
    <item>
      <title>Betreff: Export DXF Flat pattern in sub-assembly with iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/export-dxf-flat-pattern-in-sub-assembly-with-ilogic/m-p/10157841#M122207</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, you posted only the iam, the included 3 ipt's are missing.&lt;/P&gt;&lt;P&gt;Anyway, I'll tried to modify the code so you could try to paste it in your assembly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main()
	SharedVariable("VPR_Codice") = ""
	
	Dim IPT_OM_Template As String = ThisDoc.FileName(False) 'Filename of the assembly without file type extension (iam)
	Dim pathOutputDXF As String = ThisDoc.Path &amp;amp; "\Output_DXF\"  &amp;amp; IPT_OM_Template &amp;amp; ".dxf" 'Path to save the dxf to including filename of assembly and file type extension (dxf)
	
	Call Print_Assembly_IPT_DXF(IPT_OM_Template, pathOutputDXF)
End Sub	

Sub Print_Assembly_IPT_DXF(IPT_OM_Template As String, pathOutputDXF As String)
	   
	Dim oAsm As AssemblyDocument = ThisDoc.Document 
	'Dim oPenDoc As Document=ThisDoc.Document
	Dim AsmCompDefMainL0 As AssemblyComponentDefinition = oAsm.ComponentDefinition '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 = OccurMainL0.Definition.Document 
		Logger.Info("Apro assieme per DXF: " &amp;amp; oOccNameL0)
		If OccurMainL0.Definition.Type = ObjectTypeEnum.kAssemblyComponentDefinitionObject Then
			For Each OccurL1 In OccurMainL0.SubOccurrences
			'For Each doc In thisAssembly.AllReferencedDocuments
				If OccurL1.Definition.Type = ObjectTypeEnum.kSheetMetalComponentDefinitionObject Then
					Dim parsedPartName = OccurL1.ReferencedDocumentDescriptor.DisplayName ' doc.DisplayName
					Logger.Info("Selezionare parte da esportare in DXF: " &amp;amp; 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&amp;amp;OuterProfileLayer=OUTER_PR​OFILE&amp;amp;OuterProfileLayerColor=0;0;0&amp;amp;InteriorProfilesLayer=INNER_PROFILE&amp;amp;InteriorProfilesLayerColor=0;0;0&amp;amp;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 = OccurL1.Definition
						'Dim PathDXF As String = pathOutputLamieraDXF &amp;amp; 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, pathOutputDXF)
						Logger.Info("DXF " &amp;amp; SharedVariable("VPR_Codice") &amp;amp; " SUCCESS")
						component.FlatPattern.ExitEdit()
						'component.Document.close()
					End If
				End If
			Next
		End If
	Next
End Sub&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 15 Mar 2021 15:17:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/export-dxf-flat-pattern-in-sub-assembly-with-ilogic/m-p/10157841#M122207</guid>
      <dc:creator>Ralf_Krieg</dc:creator>
      <dc:date>2021-03-15T15:17:19Z</dc:date>
    </item>
  </channel>
</rss>

