Why DataIO sample code in API help does not work?

Why DataIO sample code in API help does not work?

Anonymous
Not applicable
589 Views
3 Replies
Message 1 of 4

Why DataIO sample code in API help does not work?

Anonymous
Not applicable
I followed the sample code and opened a part file before run it. Why I got an error(Method 'WriteDataToFile' of object '_IRxDataIO' failed)? What did I do wrong?

The Code:
--------------------------------
Public Sub WriteSheetMetalDXF()
' Get the active document. This assumes it is a part document.
Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument

' Get the DataIO object.
Dim oDataIO As DataIO
Set oDataIO = oDoc.ComponentDefinition.DataIO

' Build the string that defines the format of the DXF file.
Dim sOut As String
sOut = "FLAT PATTERN DXF?AcadVersion=R12&OuterProfileLayer=Outer"

' Create the DXF file.
oDataIO.WriteDataToFile sOut, "c:\temp\flat2.dxf"
End Sub

----------------------------------------
Thanks
0 Likes
590 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Are you sure that you are opening a sheet metal part? And if so, are you
able to create a flat pattern within that part?

Sanjay-

wrote in message news:5582543@discussion.autodesk.com...
I followed the sample code and opened a part file before run it. Why I got
an error(Method 'WriteDataToFile' of object '_IRxDataIO' failed)? What did I
do wrong?

The Code:
--------------------------------
Public Sub WriteSheetMetalDXF()
' Get the active document. This assumes it is a part document.
Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument

' Get the DataIO object.
Dim oDataIO As DataIO
Set oDataIO = oDoc.ComponentDefinition.DataIO

' Build the string that defines the format of the DXF file.
Dim sOut As String
sOut = "FLAT PATTERN DXF?AcadVersion=R12&OuterProfileLayer=Outer"

' Create the DXF file.
oDataIO.WriteDataToFile sOut, "c:\temp\flat2.dxf"
End Sub

----------------------------------------
Thanks
0 Likes
Message 3 of 4

Anonymous
Not applicable
No, it's just a regular part. I thought I can output a DXF file by this way.
Is it possible to generate a DXF file from a common .ipt file without using DrawingView?
Thanks
0 Likes
Message 4 of 4

Anonymous
Not applicable
I believe DXF output through DataIO is only supported for sketches. You can
create DWG output through DataIO for flattened sheetmetal parts. The
primary support for DataIO is for extracting SAT data for parts and
assemblies.
--
Brian Ekins
Autodesk Inventor API

wrote in message news:5582746@discussion.autodesk.com...
No, it's just a regular part. I thought I can output a DXF file by this way.
Is it possible to generate a DXF file from a common .ipt file without using
DrawingView?
Thanks
0 Likes