Flat pattern as SAT file in C code (Inventor9)

Flat pattern as SAT file in C code (Inventor9)

Anonymous
Not applicable
325 Views
2 Replies
Message 1 of 3

Flat pattern as SAT file in C code (Inventor9)

Anonymous
Not applicable
It's possible to save the sheet metal flat pattern to a .sat file in V9. below is a VBA sample that does it How do i do the same in C/C++ code? The tricky vba line seems to be the Call oSB.DataIO.WriteDataToFile("ACIS SAT", "C:\TEMP\satfile.sat") If i do that in C code, the translation is (?) SurfaceBodyPtr osb = smptr->GetFlatPattern()->GetBody(); osb->GetDataIO()->WriteDataToFile(formatsat, filename); and you get a compile error - no such member of surfacebodyptr. If you go the other route, and say osb->GetComponentDefinition()->GetDataIO()->WriteDataToFile(formatsat, filename); GetComponentDefinition() returns the 'regular' component def and you get the non-flattened body written to your file.... i'm confused...is this only supported in basic? bd -------- Yes, this is possible to do in R9. Here is a VBA sample that does this. Have a sheet metal document open (with a flat pattern generated) before running this. Sub FlatPatternToSAT() Dim oDoc As PartDocument Set oDoc = ThisApplication.ActiveDocument Dim oCD As SheetMetalComponentDefinition Set oCD = oDoc.ComponentDefinition Dim oSB As SurfaceBody Set oSB = oCD.FlatPattern.Body Call oSB.DataIO.WriteDataToFile("ACIS SAT", "C:\TEMP\satfile.sat") End Sub Sanjay-
0 Likes
326 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
No reason why this shouldn't work with C++ code. Can you make sure that you have the correct typelibrary? Have you tried the VBA code and that works? Sanjay- "bd" wrote in message news:40fea7d6$1_3@newsprd01... > It's possible to save the sheet metal flat pattern to a .sat file in V9. > below is a VBA sample that does it > > How do i do the same in C/C++ code? > > The tricky vba line seems to be the Call > oSB.DataIO.WriteDataToFile("ACIS SAT", "C:\TEMP\satfile.sat") > If i do that in C code, the translation is (?) > SurfaceBodyPtr osb = smptr->GetFlatPattern()->GetBody(); > osb->GetDataIO()->WriteDataToFile(formatsat, filename); > > and you get a compile error - no such member of surfacebodyptr. > If you go the other route, and say > osb->GetComponentDefinition()->GetDataIO()->WriteDataToFile(formatsat, > filename); > > GetComponentDefinition() returns the 'regular' component def and you get > the non-flattened body written to your file.... > i'm confused...is this only supported in basic? > bd > > -------- > Yes, this is possible to do in R9. Here is a VBA sample that does this. Have > a sheet metal document open (with a flat pattern generated) before running > this. > > Sub FlatPatternToSAT() > Dim oDoc As PartDocument > Set oDoc = ThisApplication.ActiveDocument > > Dim oCD As SheetMetalComponentDefinition > Set oCD = oDoc.ComponentDefinition > > Dim oSB As SurfaceBody > Set oSB = oCD.FlatPattern.Body > > Call oSB.DataIO.WriteDataToFile("ACIS SAT", "C:\TEMP\satfile.sat") > End Sub > > Sanjay- > >
0 Likes
Message 3 of 3

Anonymous
Not applicable
I have tried this code in VB, and while it does produce an .sat file, the .sat file that it creates is different from what you get if you right click on the FlatPattern and Save Copy As .sat on the interface.

For example, the attached ZIP contains the SAT files that result from using the sheet metal sample .ipt files included with Inventor 9.

I have problems loading the .sat created from the API into other applications such as SolidWorks.

Any ideas why the files are different and what can be done to get the one from the API to match what is created from the Interface?

Thanks,

Dennis Martin
DP Technology Corp
0 Likes