<?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: ilogic Export Sheet metal flat pattern to .SAT in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-export-sheet-metal-flat-pattern-to-sat/m-p/9717967#M115348</link>
    <description>&lt;P&gt;Also, FYI:&lt;/P&gt;&lt;P&gt;Here are a couple of informational links about the DataIO object.&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2021/ENU/?guid=GUID-451B918E-9374-442D-B9AE-31A8C83674B7" target="_blank" rel="noopener"&gt;DataIO Object&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2021/ENU/?guid=GUID-2710DD46-99DE-4599-9293-221D1826BCCB" target="_blank" rel="noopener"&gt;DataIO&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Aug 2020 18:58:41 GMT</pubDate>
    <dc:creator>WCrihfield</dc:creator>
    <dc:date>2020-08-28T18:58:41Z</dc:date>
    <item>
      <title>ilogic Export Sheet metal flat pattern to .SAT</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-export-sheet-metal-flat-pattern-to-sat/m-p/9717445#M115332</link>
      <description>&lt;P&gt;I'm trying to tweak my code (global rule) to export the &lt;U&gt;flat pattern&lt;/U&gt; to .sat in format 7.0 (INV2020), it does so but always the folded model. What am I missing???&lt;/P&gt;&lt;LI-CODE lang="general"&gt;'On Error GoTo ErrorTrapper:

If iProperties.Value("Project", "Revision Number") = "" Then
iProperties.Value("Project", "Revision Number") = "0"
End If
oRev = iProperties.Value("Project", "Revision Number")


Dim curDoc = ThisApplication.ActiveDocument
If curDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then


    Dim oDoc As PartDocument

    oDoc = ThisApplication.ActiveDocument

				
    Dim oCompDef As SheetMetalComponentDefinition

    oCompDef = oDoc.ComponentDefinition

	'[ Ensure this part has a flat pattern
				
				If oCompDef.FlatPattern Is Nothing Then 
				oCompDef.Unfold
				Else
				End If
				RuleParametersOutput()
				']
				
	oCompDef.FlatPattern.Edit
	
	Dim sOut As String
	
    Dim sPATH As String
	
	oPathSat = ThisDoc.WorkspacePath() &amp;amp; "\SAT\"
	
	
	'[ Ensure this folder exist
	'Check For the SAT folder And create it If it does Not exist
	If Not System.IO.Directory.Exists(oPathSat) Then
	System.IO.Directory.CreateDirectory(oPathSat)
	End If

	
	Version = 7


	Dim sFname As String
	
	sFname = oPathSat &amp;amp; ThisDoc.FileName(False) &amp;amp; "_REV-" &amp;amp; oRev &amp;amp; ".sat"

oDoc.SaveAs(sFname, True)

	'oCompDef.SaveAs(sFname ,False)
       'oCompDef.DataIO.WriteDataToFile( "ACIS SAT", sFname)
	'oCompDef.DataIO.WriteDataToFile( nsOut, nsFname)
	
	oDoc = ThisApplication.ActiveDocument
	
	oCompDef = oDoc.ComponentDefinition
	
	oCompDef.FlatPattern.ExitEdit
	


	
Else
ThisApplication.StatusBarText = ThisDoc.FileName(False) &amp;amp; " Is not in a sheet metal state, convert to sheetmetal and create flat pattern first --- Jumping to next part" 



End If&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2020 14:36:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-export-sheet-metal-flat-pattern-to-sat/m-p/9717445#M115332</guid>
      <dc:creator>yvandelafontaine</dc:creator>
      <dc:date>2020-08-28T14:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic Export Sheet metal flat pattern to .SAT</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-export-sheet-metal-flat-pattern-to-sat/m-p/9717934#M115346</link>
      <description>&lt;P&gt;See if this works for you.&lt;/P&gt;&lt;P&gt;From the looks of the StatusBar message, this is just a portion of a larger code, so I'm not sure if this is the main part, or if this is the lower Sub part.&amp;nbsp; If this portion of the code is not the main top code in your rule, you likely need to change Sub Main() to something else like Sub FlatPatternToSAT().&lt;/P&gt;&lt;P&gt;I also put a check in there, because the WorkspacePath can be empty, if not defined within your Project file.&amp;nbsp; I also showed an alternate way to get that info, commented out.&lt;/P&gt;&lt;P&gt;As far as the version, I couldn't find any examples of other entries in place of "ACIS SAT".&lt;/P&gt;&lt;P&gt;I tried using the Sub: DataIO.GetOutPutFormats(), but it was constantly throwing errors, so I never was able to get the results.&amp;nbsp; I tried it on the ComponentDefinition, the FlatPattern, on FlatPattern.SolidBodies.Item(1).DataIO, but always errors.&amp;nbsp; There is very little documentation about using DataIO's on here, other that where others have tried to use it at some point in the past.&amp;nbsp; The only official example using it is for DXF's.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main
	Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
	If iProperties.Value("Project", "Revision Number") = "" Then
		iProperties.Value("Project", "Revision Number") = "0"
	End If
	Dim oRev As String = iProperties.Value("Project", "Revision Number")
	''If oPDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
	If oPDoc.PropertySets.Item("Design Tracking Properties").Item("Document SubType Name").Value = "Sheet Metal" Then
		Dim oSMDef As SheetMetalComponentDefinition = oPDoc.ComponentDefinition
		If oSMDef.FlatPattern Is Nothing Then 
			oSMDef.Unfold
			oSMDef.FlatPattern.ExitEdit
		End If
	''	Dim oWSP As String = ThisApplication.DesignProjectManager.ActiveDesignProject.WorkspacePath
		If ThisDoc.WorkspacePath = "" Then
			MsgBox("ThisDoc.WorkspacePath is empty (not defined). Exiting.", vbOKOnly + vbExclamation, "WORKSPACE NOT DEFINED")
			Return 'or Exit Sub
		End If
		Dim oPathSat As String = ThisDoc.WorkspacePath &amp;amp; "\SAT\"
		If Not System.IO.Directory.Exists(oPathSat) Then
			System.IO.Directory.CreateDirectory(oPathSat)
		End If
	''	Version = 7
		Dim oFileName As String = oPathSat &amp;amp; ThisDoc.FileName(False) &amp;amp; "_REV-" &amp;amp; oRev &amp;amp; ".sat"
		Try
			oSMDef.FlatPattern.DataIO.WriteDataToFile("ACIS SAT", oFileName)
		Catch oEx As Exception
			MsgBox("DataIO.WriteDataToFile() failed!" &amp;amp; vbCrLf &amp;amp; _
			"Error Message is as follows:" &amp;amp; vbCrLf &amp;amp; _
			oEx.Message &amp;amp; vbCrLf &amp;amp; vbCrLf  &amp;amp; _
			"Error Source is as follows:" &amp;amp; vbCrLf &amp;amp; _
			oEx.Source &amp;amp; vbCrLf &amp;amp; vbCrLf &amp;amp; _
			"Error StackTrace is as follows:" &amp;amp; vbCrLf &amp;amp; _
			oEx.StackTrace &amp;amp; vbCrLf &amp;amp; vbCrLf  &amp;amp; _
			"Error Type.ToString is as follows:" &amp;amp; vbCrLf &amp;amp; _
			oEx.GetType.ToString, vbOKOnly + vbInformation, " ")
		End Try
	Else
		ThisApplication.StatusBarText = ThisDoc.FileName(False) &amp;amp; " Is not in a sheet metal state, convert to sheetmetal and create flat pattern first --- Jumping to next part" 
	End If
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2020 18:40:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-export-sheet-metal-flat-pattern-to-sat/m-p/9717934#M115346</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-08-28T18:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic Export Sheet metal flat pattern to .SAT</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-export-sheet-metal-flat-pattern-to-sat/m-p/9717953#M115347</link>
      <description>&lt;P&gt;Here's the code I was using to try to get the available formats, in case you or others want to try to get it to work.&lt;/P&gt;&lt;P&gt;I've used this same sub in other situations successfully, but for some reason this situation it just doesn't want to work for me.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main
Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
If oPDoc.PropertySets.Item("Design Tracking Properties").Item("Document SubType Name").Value = "Sheet Metal" Then
	Dim oSMDef As SheetMetalComponentDefinition = oPDoc.ComponentDefinition
	If oSMDef.FlatPattern Is Nothing Then
		MsgBox("FlatPattern was Nothing.", , " ")
		oSMDef.Unfold
		oSMDef.FlatPattern.ExitEdit
	Else
'		MsgBox("FlatPattern was already not Nothing.", , " ")
	End If
	Dim oFormats() As String
	Dim oStorageTypes() As StorageTypeEnum
	Try
'		oSMDef.DataIO.GetOutputFormats(oFormats, oStorageTypes)
		oSMDef.FlatPattern.DataIO.GetOutputFormats(oFormats, oStorageTypes)
'		oSMDef.FlatPattern.SurfaceBodies.Item(1).DataIO.GetOutputFormats(oFormats, oStorageTypes)
		If oFormats.Length &amp;gt; 0 Then
'			a = InputListBox("Output Formats",oFormats)
			For Each oFormat As String In oFormats
				MsgBox(oFormat)
			Next
		End If
	Catch oEx As Exception
		MsgBox("GetOutputFormats failed." &amp;amp; vbCrLf &amp;amp; _
		"Error Message is as follows:" &amp;amp; vbCrLf &amp;amp; _
		oEx.Message &amp;amp; vbCrLf &amp;amp; vbCrLf  &amp;amp; _
		"Error Source is as follows:" &amp;amp; vbCrLf &amp;amp; _
		oEx.Source &amp;amp; vbCrLf &amp;amp; vbCrLf &amp;amp; _
		"Error StackTrace is as follows:" &amp;amp; vbCrLf &amp;amp; _
		oEx.StackTrace &amp;amp; vbCrLf &amp;amp; vbCrLf  &amp;amp; _
		"Error Type.ToString is as follows:" &amp;amp; vbCrLf &amp;amp; _
		oEx.GetType.ToString, vbOKOnly + vbInformation, " ")
	End Try
End If
End Sub&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 28 Aug 2020 18:50:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-export-sheet-metal-flat-pattern-to-sat/m-p/9717953#M115347</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-08-28T18:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic Export Sheet metal flat pattern to .SAT</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-export-sheet-metal-flat-pattern-to-sat/m-p/9717967#M115348</link>
      <description>&lt;P&gt;Also, FYI:&lt;/P&gt;&lt;P&gt;Here are a couple of informational links about the DataIO object.&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2021/ENU/?guid=GUID-451B918E-9374-442D-B9AE-31A8C83674B7" target="_blank" rel="noopener"&gt;DataIO Object&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2021/ENU/?guid=GUID-2710DD46-99DE-4599-9293-221D1826BCCB" target="_blank" rel="noopener"&gt;DataIO&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2020 18:58:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-export-sheet-metal-flat-pattern-to-sat/m-p/9717967#M115348</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-08-28T18:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic Export Sheet metal flat pattern to .SAT</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-export-sheet-metal-flat-pattern-to-sat/m-p/9720792#M115395</link>
      <description>&lt;P&gt;Found the solution the line for exporting is:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;oCompDef.FlatPattern.Body.DataIO.WriteDataToFile("ACIS SAT", sFname)&lt;/LI-CODE&gt;&lt;P&gt;i was actually missing the ".Body." part&lt;/P&gt;</description>
      <pubDate>Mon, 31 Aug 2020 12:48:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-export-sheet-metal-flat-pattern-to-sat/m-p/9720792#M115395</guid>
      <dc:creator>yvandelafontaine</dc:creator>
      <dc:date>2020-08-31T12:48:33Z</dc:date>
    </item>
  </channel>
</rss>

