<?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 Re: Scan assembly and all sub-assemblies to export flat patterns in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12442189#M15775</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunatley you are speaking above my head lol. I'm not certain what to change based on what you are saying?&lt;/P&gt;</description>
    <pubDate>Thu, 14 Dec 2023 21:32:15 GMT</pubDate>
    <dc:creator>blandb</dc:creator>
    <dc:date>2023-12-14T21:32:15Z</dc:date>
    <item>
      <title>Scan assembly and all sub-assemblies to export flat patterns</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12433245#M15757</link>
      <description>&lt;P&gt;Good morning all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone happen to have a rule that will scan the assembly and all sub-assemblies and or components to export the flat patterns to a specific folder? I believe I have seen where some will do the current level assembly. But didn't know if it was possible to just start at the final assembly and run the rule and it will either generate the flat if it doesn't exists and export the dxf to a specific folder, but if it does exist then just export the dxf to the folder.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also during the export, is there a way to control what is exported in the dxf such as just the outer boundary and bend line only?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Only draw back I can see with it auto generating flats would be flat orientation (at an angle when flattened). Obviously it would be better to have users generate their own flats and check that while detailing. So, if that is done, then the exportation of the dxfs, would be no issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for any assistance. Have a great week!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2023 14:29:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12433245#M15757</guid>
      <dc:creator>blandb</dc:creator>
      <dc:date>2023-12-11T14:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: Scan assembly and all sub-assemblies to export flat patterns</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12434670#M15758</link>
      <description>&lt;P&gt;You could try something like this. The dxf file gets saved in the same directory as the part.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="visual-basic"&gt;    Public Sub main()
        Dim doc As AssemblyDocument = ThisDoc.Document

        For Each refDoc As Document In doc.AllReferencedDocuments

            If (refDoc.DocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kPartDocumentObject) Then Continue For
            If (refDoc.SubType &amp;lt;&amp;gt; "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}") Then Continue For

            Dim sheetMetalDoc = ThisApplication.Documents.Open(refDoc.FullFileName)

            Dim fileName = CreateFileName(sheetMetalDoc)
            Export(sheetMetalDoc, fileName)
        Next

        doc.Activate()

    End Sub

    Function CreateFileName(doc As PartDocument) As String
        Dim dirName As String = IO.Path.GetDirectoryName(doc.FullFileName)
        Dim fileNameWithoutExtension As String = IO.Path.GetFileNameWithoutExtension(doc.FullFileName)
        Return String.Format("{0}\{1}.dxf", dirName, fileNameWithoutExtension)
    End Function

    Function Export(doc As PartDocument, newFileName As String)
        Dim oCompDef As SheetMetalComponentDefinition = doc.ComponentDefinition
        If oCompDef.HasFlatPattern = False Then
            oCompDef.Unfold()
        Else
            oCompDef.FlatPattern.Edit()
        End If

        ' more options can be found here:
        ' https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-54B44291-4E1D-4CDB-80CB-FBB38D0239C2
        Dim sOut As String = "FLAT PATTERN DXF?AcadVersion=2000&amp;amp; "
        sOut = sOut + "&amp;amp;BendUpLayerColor=255;0;0"
        sOut = sOut + "&amp;amp;BendDownLayerColor=0;255;0"
        sOut = sOut + "&amp;amp;InvisibleLayers=IV_TANGENT"
        oCompDef.DataIO.WriteDataToFile(sOut, newFileName)
        oCompDef.FlatPattern.ExitEdit()
    End Function&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2023 21:46:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12434670#M15758</guid>
      <dc:creator>JelteDeJong</dc:creator>
      <dc:date>2023-12-11T21:46:03Z</dc:date>
    </item>
    <item>
      <title>Re: Scan assembly and all sub-assemblies to export flat patterns</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12434996#M15759</link>
      <description>&lt;P&gt;Thanks for the help. I have been able to change the line type and color, but it appears I cannot change the bend lines to a different layer name, what am I missing here? Also, is there a way for it to place all this into a folder called "DXF's" in the same location as the assembly itself along with not opening every instance of the parts? Maybe running in the background, or if it needs to open, then have it close the files?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        &lt;SPAN&gt;' https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-54B44291-4E1D-4CDB-80CB-FBB38D0239C2&lt;/SPAN&gt;
        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;sOut&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;"FLAT PATTERN DXF?AcadVersion=2000&amp;amp; "&lt;/SPAN&gt;
	&lt;SPAN&gt;sOut&lt;/SPAN&gt; = &lt;SPAN&gt;sOut&lt;/SPAN&gt; + &lt;SPAN&gt;"&amp;amp;BendUpLayerColor=255;0;0"&lt;/SPAN&gt;
	&lt;SPAN&gt;sOut&lt;/SPAN&gt; = &lt;SPAN&gt;sOut&lt;/SPAN&gt; + &lt;SPAN&gt;"&amp;amp;BendUpLayerLineType=37637"&lt;/SPAN&gt;
        &lt;SPAN&gt;sOut&lt;/SPAN&gt; = &lt;SPAN&gt;sOut&lt;/SPAN&gt; + &lt;SPAN&gt;"&amp;amp;BendDownLayerColor=255;0;0"&lt;/SPAN&gt;
	&lt;SPAN&gt;sOut&lt;/SPAN&gt; = &lt;SPAN&gt;sOut&lt;/SPAN&gt; + &lt;SPAN&gt;"&amp;amp;BendDownLayerLineType=37637"&lt;/SPAN&gt;
        &lt;SPAN&gt;sOut&lt;/SPAN&gt; = &lt;SPAN&gt;sOut&lt;/SPAN&gt; + &lt;SPAN&gt;"&amp;amp;InvisibleLayers=IV_TANGENT"&lt;/SPAN&gt;
        &lt;SPAN&gt;oCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;DataIO&lt;/SPAN&gt;.&lt;SPAN&gt;WriteDataToFile&lt;/SPAN&gt;(&lt;SPAN&gt;sOut&lt;/SPAN&gt;, &lt;SPAN&gt;newFileName&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 01:32:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12434996#M15759</guid>
      <dc:creator>blandb</dc:creator>
      <dc:date>2023-12-12T01:32:14Z</dc:date>
    </item>
    <item>
      <title>Re: Scan assembly and all sub-assemblies to export flat patterns</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12435195#M15760</link>
      <description>&lt;P&gt;I figured out the naming, I guess I have to add as separate lines? I also removed the last "&amp;amp;" that was after the 2000 in the first line. That seemed to help? I'm still trying to figure out how to place these into a folder.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;sOut&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;"FLAT PATTERN DXF?AcadVersion=2000"&lt;/SPAN&gt;
		&lt;SPAN&gt;sOut&lt;/SPAN&gt; = &lt;SPAN&gt;sOut&lt;/SPAN&gt; + &lt;SPAN&gt;"&amp;amp;OuterProfileLayer=OBJECT"&lt;/SPAN&gt;
		&lt;SPAN&gt;sOut&lt;/SPAN&gt; = &lt;SPAN&gt;sOut&lt;/SPAN&gt; + &lt;SPAN&gt;"&amp;amp;InteriorProfilesLayer=OBJECT"&lt;/SPAN&gt;
		&lt;SPAN&gt;sOut&lt;/SPAN&gt; = &lt;SPAN&gt;sOut&lt;/SPAN&gt; + &lt;SPAN&gt;"&amp;amp;BendLayer=BEND"&lt;/SPAN&gt;
		&lt;SPAN&gt;sOut&lt;/SPAN&gt; = &lt;SPAN&gt;sOut&lt;/SPAN&gt; + &lt;SPAN&gt;"&amp;amp;BendUpLayerColor=255;0;0"&lt;/SPAN&gt;
		&lt;SPAN&gt;sOut&lt;/SPAN&gt; = &lt;SPAN&gt;sOut&lt;/SPAN&gt; + &lt;SPAN&gt;"&amp;amp;BendUpLayerLineType=37637"&lt;/SPAN&gt;
                &lt;SPAN&gt;sOut&lt;/SPAN&gt; = &lt;SPAN&gt;sOut&lt;/SPAN&gt; + &lt;SPAN&gt;"&amp;amp;BendDownLayerColor=255;0;0"&lt;/SPAN&gt;
		&lt;SPAN&gt;sOut&lt;/SPAN&gt; = &lt;SPAN&gt;sOut&lt;/SPAN&gt; + &lt;SPAN&gt;"&amp;amp;BendDownLayerLineType=37637"&lt;/SPAN&gt;
        &lt;SPAN&gt;sOut&lt;/SPAN&gt; = &lt;SPAN&gt;sOut&lt;/SPAN&gt; + &lt;SPAN&gt;"&amp;amp;InvisibleLayers=IV_TANGENT"&lt;/SPAN&gt;
        &lt;SPAN&gt;oCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;DataIO&lt;/SPAN&gt;.&lt;SPAN&gt;WriteDataToFile&lt;/SPAN&gt;(&lt;SPAN&gt;sOut&lt;/SPAN&gt;, &lt;SPAN&gt;newFileName&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 04:20:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12435195#M15760</guid>
      <dc:creator>blandb</dc:creator>
      <dc:date>2023-12-12T04:20:31Z</dc:date>
    </item>
    <item>
      <title>Re: Scan assembly and all sub-assemblies to export flat patterns</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12435839#M15761</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;change your output setup like this:&lt;/P&gt;&lt;P&gt;in the example below, Layers in the dxf will be "0" and "GRAV"&lt;/P&gt;&lt;P&gt;here is the API link:&amp;nbsp;&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=DataIO_WriteDataToFile" target="_blank"&gt;Inventor 2024 Help | DataIO.WriteDataToFile Method | Autodesk&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;sOut&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;

&lt;SPAN&gt;sOut&lt;/SPAN&gt; = &lt;SPAN&gt;"FLAT PATTERN DXF?&amp;amp;AcadVersion=2013"&lt;/SPAN&gt; _
            + &lt;SPAN&gt;"&amp;amp;InvisibleLayers=IV_ARC_CENTERS;IV_FEATURE_PROFILES_DOWN;IV_TANGENT;IV_BEND;IV_BEND_DOWN;IV_FEATURE_PROFILES;IV_ALTREP_FRONT;IV_ALTREP_BACK;IV_ROLL_TANGENT;IV_ROLL"&lt;/SPAN&gt; _
            + &lt;SPAN&gt;"&amp;amp;OuterProfileLayer=0&amp;amp;OuterProfileLayerLineType=37633&amp;amp;OuterProfileLayerLineWeight=0.2500&amp;amp;OuterProfileLayerColor=0;0;0"&lt;/SPAN&gt; _
            + &lt;SPAN&gt;"&amp;amp;InteriorProfilesLayer=0&amp;amp;InteriorProfilesLayerLineType=37633&amp;amp;InteriorProfilesLayerLineWeight=0.2500&amp;amp;InteriorProfilesLayerColor=0;0;0"&lt;/SPAN&gt; _
            + &lt;SPAN&gt;"&amp;amp;UnconsumedSketchesLayer=GRAV&amp;amp;UnconsumedSketchesLayerLineType=37633&amp;amp;UnconsumedSketchesLayerLineWeight=0.2500&amp;amp;UnconsumedSketchesLayerColor=255;255;0"&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 11:45:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12435839#M15761</guid>
      <dc:creator>jeremy.goenen</dc:creator>
      <dc:date>2023-12-12T11:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: Scan assembly and all sub-assemblies to export flat patterns</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12436628#M15762</link>
      <description>&lt;P&gt;Am I correct in placing this "close" operation here (see below in bold). Does this save the file, or simply a close only? Reason I ask is if somone may have made changes in context of the assembly and not open and save the part. Then they run this command, will it capture the changes and save it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Public&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;Main&lt;/SPAN&gt;()
        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;doc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;

        &lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;refDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;doc&lt;/SPAN&gt;.&lt;SPAN&gt;AllReferencedDocuments&lt;/SPAN&gt;

            &lt;SPAN&gt;If&lt;/SPAN&gt; (&lt;SPAN&gt;refDoc&lt;/SPAN&gt;.&lt;SPAN&gt;DocumentType&lt;/SPAN&gt; &amp;lt;&amp;gt; &lt;SPAN&gt;DocumentTypeEnum&lt;/SPAN&gt;.&lt;SPAN&gt;kPartDocumentObject&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt; &lt;SPAN&gt;Continue&lt;/SPAN&gt; &lt;SPAN&gt;For&lt;/SPAN&gt;
            &lt;SPAN&gt;If&lt;/SPAN&gt; (&lt;SPAN&gt;refDoc&lt;/SPAN&gt;.&lt;SPAN&gt;SubType&lt;/SPAN&gt; &amp;lt;&amp;gt; &lt;SPAN&gt;"{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt; &lt;SPAN&gt;Continue&lt;/SPAN&gt; &lt;SPAN&gt;For&lt;/SPAN&gt;

            &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;sheetMetalDoc&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;Documents&lt;/SPAN&gt;.&lt;SPAN&gt;Open&lt;/SPAN&gt;(&lt;SPAN&gt;refDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt;)

            &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;fileName&lt;/SPAN&gt; = &lt;SPAN&gt;CreateFileName&lt;/SPAN&gt;(&lt;SPAN&gt;sheetMetalDoc&lt;/SPAN&gt;)
            &lt;SPAN&gt;Export&lt;/SPAN&gt;(&lt;SPAN&gt;sheetMetalDoc&lt;/SPAN&gt;, &lt;SPAN&gt;fileName&lt;/SPAN&gt;)
	    &lt;STRONG&gt;sheetMetalDoc.Close()&lt;/STRONG&gt;
        &lt;SPAN&gt;Next&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 16:49:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12436628#M15762</guid>
      <dc:creator>blandb</dc:creator>
      <dc:date>2023-12-12T16:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: Scan assembly and all sub-assemblies to export flat patterns</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12436658#M15763</link>
      <description>&lt;P&gt;No, it will only close it, see here&amp;nbsp;&lt;A href="https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-CF60F6F3-8074-4719-B8E0-5E482E5AF783" target="_blank"&gt;https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-CF60F6F3-8074-4719-B8E0-5E482E5AF783&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 17:01:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12436658#M15763</guid>
      <dc:creator>jeremy.goenen</dc:creator>
      <dc:date>2023-12-12T17:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: Scan assembly and all sub-assemblies to export flat patterns</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12436759#M15764</link>
      <description>&lt;P&gt;I'm asking just in case, do you also need to add like Partnumber or Revision Number to the DXF for graving with Lasercutting for Example ? If Yes, i can share you an adapted Version of my Code, it is also executed from Assembly or Part Level, like what you try to do.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 17:54:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12436759#M15764</guid>
      <dc:creator>jeremy.goenen</dc:creator>
      <dc:date>2023-12-12T17:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: Scan assembly and all sub-assemblies to export flat patterns</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12436820#M15765</link>
      <description>&lt;P&gt;If that document is being referenced by the assembly, it will not actually close anyways.&amp;nbsp; If opened 'visibly', then closing it will just make it not visible anymore, but it will still remain open until the assembly that is referencing it is closed.&amp;nbsp; You usually do not need to open each referenced document, because they are already open in the background.&amp;nbsp; The exception is when all components referencing certain model documents have been suppressed.&amp;nbsp; In that case, the document they reference can get 'unloaded' from session memory, for performance reasons.&amp;nbsp; If you opened a document that is not being referenced by the assembly, then closing it would actually close it.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 18:24:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12436820#M15765</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-12-12T18:24:10Z</dc:date>
    </item>
    <item>
      <title>Re: Scan assembly and all sub-assemblies to export flat patterns</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12436886#M15766</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The original code that was posted was opening each part and the tab would remain open. As you can tell, if there were 50 parts it went through, there were 50 part tabs open. I would then have to go and close them all manually. I was trying to eliminate that and that is why I tried ading the "close" option where I did. It was working as it would open the file, export and then close so the tab. If it could somehow just do that in the back ground and prompt when done, then cool. Also, just trying to capture if anyone was to do "in context" editing, that the dxf would capture that. I would assume it would as if someone was to do in-context editing, then they save the assy, then the file would be saved, so then when this rule is ran, it would be updated. Draw back, is now we are re-creating dxfs. I have another rule where I can do it manually per an instance, so in a rev scenario, I can do that for single parts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unless anyone has a better approach for how you typically handle these situations. I was just trying to use this as a batch first release type situation. Then handle part specific revisions later in a different format?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6909763"&gt;@jeremy.goenen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No engraving is needed. As for revisions, I need to see how the guys want to hand that. If we just leave the DXF as the filename.dxf with no indication of revision (this is always the latest and greatest), or if we add an index of revison in the name. I have messed with things like this before, and if the first release is "nothing" then there is always and empy space in the file name, but it works if there is a revision because then there is a character there. Not sure the best way to handle that.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 18:52:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12436886#M15766</guid>
      <dc:creator>blandb</dc:creator>
      <dc:date>2023-12-12T18:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: Scan assembly and all sub-assemblies to export flat patterns</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12436931#M15767</link>
      <description>&lt;P&gt;If you wanted to keep the &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=Documents_Open" target="_blank" rel="noopener"&gt;Open&lt;/A&gt;() method in there, then you could just include the optional second input, which specifies whether to open it visibly or not visibly, and specify False, so they do not open visibly, then you would not have to close any document tabs.&amp;nbsp; But as mentioned before, opening them is usually not needed.&amp;nbsp; Each Document object has a ReadOnly Boolean property named &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=Document_Open" target="_blank" rel="noopener"&gt;Open&lt;/A&gt;, which will return True if it is already open, and False if the document has only been 'initialized' (not fully open yet, but will open if anything is done to it).&amp;nbsp; The very definition of a &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=GUID-Document" target="_blank" rel="noopener"&gt;Document&lt;/A&gt;&amp;nbsp;tells us that it represents an 'in-memory' Inventor document.&amp;nbsp; You can also check if a Document has been modified since it was last saved by checking its &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=Document_Dirty" target="_blank" rel="noopener"&gt;Document.Dirty&lt;/A&gt; property value.&amp;nbsp; If True, then it has been modified since it was last saved, and you may want to update/save that document before exporting, depending on your needs.&lt;/P&gt;
&lt;P&gt;And if you decide to include Revision Number into the exported file name, you should create a variable to hold the Revision Number value first, then set its value from the iProperty, then check the value of that variable, before trying to include it in the file name.&amp;nbsp; If it has no value (empty String), then do not include it in the file name.&amp;nbsp; Same goes for Part Number and other iProperty values.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 19:24:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12436931#M15767</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-12-12T19:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Scan assembly and all sub-assemblies to export flat patterns</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12436941#M15768</link>
      <description>&lt;P&gt;Thanks for the input. I have been messing around trying to place all these DXF's into a DXF folder in the same level as the assembly, but no luck.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 19:29:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12436941#M15768</guid>
      <dc:creator>blandb</dc:creator>
      <dc:date>2023-12-12T19:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: Scan assembly and all sub-assemblies to export flat patterns</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12436960#M15769</link>
      <description>&lt;P&gt;Using the example code that&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5011186"&gt;@JelteDeJong&lt;/a&gt;&amp;nbsp;provided above, I would create a 'shared' variable (declared between custom methods) just for the DXF's folder.&amp;nbsp; Then set its value within the Sub Main area, while we have a direct reference to the main assembly.&amp;nbsp; Then add the "\DXF's\" portion to the assembly's path, then make sure that directory exists.&amp;nbsp; Then down within the CreateFileName Function, just use that variable when specifying the new full file name of the DXF file.&amp;nbsp; Below is a modified version of that earlier code, with these changes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Public Sub Main()
    Dim doc As AssemblyDocument = ThisDoc.Document
	sAsmDXFFolder = System.IO.Path.GetDirectoryName(doc.FullFileName)
	sAsmDXFFolder = sAsmDXFFolder &amp;amp; "\DXF's"
	If System.IO.Directory.Exists(sAsmDXFFolder) = False Then
		System.IO.Directory.CreateDirectory(sAsmDXFFolder)
	End If
    For Each refDoc As Document In doc.AllReferencedDocuments
        If (refDoc.DocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kPartDocumentObject) Then Continue For
        If (refDoc.SubType &amp;lt;&amp;gt; "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}") Then Continue For
        Dim fileName = CreateFileName(refDoc)
        Export(refDoc, fileName)
    Next
    doc.Activate()
End Sub

Dim sAsmDXFFolder As String

Function CreateFileName(doc As PartDocument) As String
    Dim fileNameWithoutExtension As String = IO.Path.GetFileNameWithoutExtension(doc.FullFileName)
    Return String.Format("{0}\{1}.dxf", sAsmDXFFolder, fileNameWithoutExtension)
End Function

Function Export(doc As PartDocument, newFileName As String)
    Dim oCompDef As SheetMetalComponentDefinition = doc.ComponentDefinition
    If oCompDef.HasFlatPattern = False Then
        oCompDef.Unfold()
    Else
        oCompDef.FlatPattern.Edit()
    End If
    ' more options can be found here:
    ' https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-54B44291-4E1D-4CDB-80CB-FBB38D0239C2
    Dim sOut As String = "FLAT PATTERN DXF?AcadVersion=2000&amp;amp; "
    sOut = sOut + "&amp;amp;BendUpLayerColor=255;0;0"
    sOut = sOut + "&amp;amp;BendDownLayerColor=0;255;0"
    sOut = sOut + "&amp;amp;InvisibleLayers=IV_TANGENT"
    oCompDef.DataIO.WriteDataToFile(sOut, newFileName)
    oCompDef.FlatPattern.ExitEdit()
End Function&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 19:42:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12436960#M15769</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-12-12T19:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: Scan assembly and all sub-assemblies to export flat patterns</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12437018#M15770</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;Thanks for the sample.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 20:16:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12437018#M15770</guid>
      <dc:creator>blandb</dc:creator>
      <dc:date>2023-12-12T20:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: Scan assembly and all sub-assemblies to export flat patterns</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12437178#M15771</link>
      <description>&lt;P&gt;Just to give an idea, if you set up your filename like this, there will not be an empty space in case of a "Null" Revision:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;'get the filename&lt;/SPAN&gt;
&lt;SPAN&gt;filename&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FileName&lt;/SPAN&gt;(&lt;SPAN&gt;False&lt;/SPAN&gt;) &lt;SPAN&gt;'without extension&lt;/SPAN&gt;

&lt;SPAN&gt;'get revision indicator&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;revindicator&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;
&lt;SPAN&gt;Try&lt;/SPAN&gt;	
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;Not&lt;/SPAN&gt; (&lt;SPAN&gt;iProperties&lt;/SPAN&gt;.&lt;SPAN&gt;Value&lt;/SPAN&gt;(&lt;SPAN&gt;"Project"&lt;/SPAN&gt;, &lt;SPAN&gt;"Revision Number"&lt;/SPAN&gt;) = &lt;SPAN&gt;""&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt; &lt;SPAN&gt;'you can use what you want here&lt;/SPAN&gt;
	&lt;SPAN&gt;revindicator&lt;/SPAN&gt; = &lt;SPAN&gt;"-REV"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;iProperties&lt;/SPAN&gt;.&lt;SPAN&gt;Value&lt;/SPAN&gt;(&lt;SPAN&gt;"Project"&lt;/SPAN&gt;, &lt;SPAN&gt;"Revision Number"&lt;/SPAN&gt;) 
	&lt;SPAN&gt;Else&lt;/SPAN&gt;
	&lt;SPAN&gt;revindicator&lt;/SPAN&gt; = &lt;SPAN&gt;""&lt;/SPAN&gt;
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
&lt;SPAN&gt;Catch&lt;/SPAN&gt;
&lt;SPAN&gt;revindicator&lt;/SPAN&gt; = &lt;SPAN&gt;""&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;
	
&lt;SPAN&gt;'set the dxf filename&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;dxffilename&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;
&lt;SPAN&gt;dxffilename&lt;/SPAN&gt; = &lt;SPAN&gt;filename&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;revindicator&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;".dxf"&lt;/SPAN&gt;	&lt;/PRE&gt;&lt;P&gt;J&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 21:29:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12437178#M15771</guid>
      <dc:creator>jeremy.goenen</dc:creator>
      <dc:date>2023-12-12T21:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: Scan assembly and all sub-assemblies to export flat patterns</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12439243#M15772</link>
      <description>&lt;P&gt;Interesting....All was ok yesterday, but I went to run this today after closing down and restarting today, and now I get the following message. Only thing I did differently was installed Nesting 2024 to play around with it.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="blandb_0-1702487850164.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1304422i6F9876B9935AA404/image-size/medium?v=v2&amp;amp;px=400" role="button" title="blandb_0-1702487850164.png" alt="blandb_0-1702487850164.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="blandb_1-1702487910716.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1304423i97B24DE34350D0D4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="blandb_1-1702487910716.png" alt="blandb_1-1702487910716.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 17:25:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12439243#M15772</guid>
      <dc:creator>blandb</dc:creator>
      <dc:date>2023-12-13T17:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: Scan assembly and all sub-assemblies to export flat patterns</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12439280#M15773</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/467314"&gt;@blandb&lt;/a&gt;.&amp;nbsp; I am not 100% sure what caused that error, but what comes to mind is that the main assembly is the 'active' document, but then you are 'activating' the 'flat pattern edit mode' of one of the parts within the assembly, without first entering into 'component edit mode' for the component, and maybe that is where the problem originates from.&amp;nbsp; In my opinion, you do not even need to enter into the 'edit mode' of the flat pattern.&amp;nbsp; As long as the flat pattern exists, or it can be created using the 'unfold' method, then all you need to do is use the &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=FlatPattern_DataIO" target="_blank" rel="noopener"&gt;FlatPattern.DataIO&lt;/A&gt; instead of the &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=SheetMetalComponentDefinition_DataIO" target="_blank" rel="noopener"&gt;SheetMetalComponentDefinition.DataIO&lt;/A&gt; object, without being in edit mode.&amp;nbsp; That edit mode is just for user interactions.&lt;/P&gt;
&lt;P&gt;Edit:&amp;nbsp; Possibly, when you were opening them visibly, it was not a problem, but now that you are leaving them not visible, it does not like you trying to activate the edit mode on the flat pattern in a referenced part.&amp;nbsp; Just my thoughts/suspicions.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 17:34:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12439280#M15773</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-12-13T17:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: Scan assembly and all sub-assemblies to export flat patterns</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12439311#M15774</link>
      <description>&lt;P&gt;Weird thing is, I am running this in the same assy I was yesterday. I just created a new rule and posted the original code from&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5011186"&gt;@JelteDeJong&lt;/a&gt;and it worked. Then, I ran the failing rule again which was the last code from &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;where it was placing all into a specific folder (which worked yesterday), and mysteriously it worked....hmmmm&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 17:42:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12439311#M15774</guid>
      <dc:creator>blandb</dc:creator>
      <dc:date>2023-12-13T17:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: Scan assembly and all sub-assemblies to export flat patterns</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12442189#M15775</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunatley you are speaking above my head lol. I'm not certain what to change based on what you are saying?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 21:32:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12442189#M15775</guid>
      <dc:creator>blandb</dc:creator>
      <dc:date>2023-12-14T21:32:15Z</dc:date>
    </item>
    <item>
      <title>Re: Scan assembly and all sub-assemblies to export flat patterns</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12443266#M15776</link>
      <description>&lt;P&gt;Hello &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/467314"&gt;@blandb&lt;/a&gt;, based on the Screenshot you shared, your Code will Run fine aslong as the target part has no flatpattern, because you can use the unfold method on a "in memory" only Document, the flatpattern.edit can only be used on Visible Acitive Documents, which will cause an exception in your case, because you dont Open the Document first. To export your dxf the way you want, you dont need to enter edit mode, so if you remove this Line you should be fine.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2023 11:32:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/scan-assembly-and-all-sub-assemblies-to-export-flat-patterns/m-p/12443266#M15776</guid>
      <dc:creator>jeremy.goenen</dc:creator>
      <dc:date>2023-12-15T11:32:50Z</dc:date>
    </item>
  </channel>
</rss>

