Message 1 of 4
Why DataIO sample code in API help does not work?

Not applicable
05-10-2007
04:38 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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
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