Export Flat Pattern to SAT error (API bug in Inventor 2022?)

Export Flat Pattern to SAT error (API bug in Inventor 2022?)

w.pepping
Advocate Advocate
188 Views
2 Replies
Message 1 of 3

Export Flat Pattern to SAT error (API bug in Inventor 2022?)

w.pepping
Advocate
Advocate

In Inventor 2022 I get an error after export to SAT with this line of code:

oCompDef.FlatPattern.Body.DataIO.WriteDataToFile("ACIS SAT", "C:/TEMP/test.sat")

The error only pops up after export an double curved model. (attached)

All other models are ok and export to SAT without code works fine.

Get control of your sheet metal files.
Download the app from matprop.com
0 Likes
189 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor

Hi @w.pepping.  I am using Inventor 2024.0.1.  I downloaded your part, opened it, used the manual tool button to generate the flat pattern (just to see if it worked OK), then went back to the folded model and deleted the flat pattern.  Then I wrote a quickie iLogic rule to export its flat pattern out as a SAT file, as described.  It worked just fine for me, without throwing any errors.  However, I had to include some code to generate the flat pattern if it was not already present, and also had to change the file path.  First of all, my local folder is named "Temp" (first letter capitalized, others lower case), not "TEMP" (all capitalized).  Then, I had to reverse the "/" characters to "\" characters in the file path.

Dim oPDoc As PartDocument = ThisDoc.Document
Dim oSMDef As SheetMetalComponentDefinition = oPDoc.ComponentDefinition
Dim oFP As FlatPattern = Nothing
If oSMDef.HasFlatPattern Then
	oFP = oSMDef.FlatPattern
Else
	Try
		oSMDef.Unfold
		oFP = oSMDef.FlatPattern
		oFP.ExitEdit
	Catch e As Exception
		Logger.Error(e.Message)
	End Try
End If
If oFP Is Nothing Then
	Logger.Debug("Could not get the FlatPattern.")
	Return
End If
Try
	oFP.Body.DataIO.WriteDataToFile("ACIS SAT", "C:\Temp\test.sat")
Catch e As Exception
	Logger.Error(e.Message & vbCrLf & e.StackTrace)
End Try

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 3

w.pepping
Advocate
Advocate

Dear Wesley,

Thank you very much. Your help is very appreciated.

In Inventor 2023 and 2024 it works fine, but try it in 2022 and you get an error-message and an useless sat-file.

 

Get control of your sheet metal files.
Download the app from matprop.com
0 Likes