WriteDataToFile Problem

WriteDataToFile Problem

Anonymous
Not applicable
495 Views
3 Replies
Message 1 of 4

WriteDataToFile Problem

Anonymous
Not applicable
I'm trying this code on VBA, but it ONLY works if sketch is on XY plane, otherwise I got a bad DXF.
What kind of options does exist to DXF (on sOut)?

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

' Get the DataIO object.
'Dim sFormats() As String
'Dim sStorageTypes() As StorageTypeEnum

Dim oDataIO As DataIO
Set oDataIO = oDoc.ComponentDefinition.Sketches.Item(1).DataIO

'oDataIO.GetOutputFormats sFormats, sStorageTypes
'MsgBox ("CompDef Output: " & ioPrint(sFormats, sStorageTypes))

' Build the string that defines the format of the DXF file.
Dim sOut As String
sOut = "DXF"

' Create the DXF file.
oDataIO.WriteDataToFile sOut, "c:\sketch.dxf"
End Sub
0 Likes
496 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
That's a good catch. There is indeed a problem with exporting sketches that
are not parallel to the XY plane. I'll log this as a high priority issue.
The only workaround would be to select the sketch programmatically and
execute the "GeomToDXFCommand" as you already know (from your previous
post).

Thanks for reporting this issue.

Sanjay-
0 Likes
Message 3 of 4

Anonymous
Not applicable
I did a "redefine" on the sketch puting it on the XY plane (by hands) and the WriteDXF worked very well , but I couldnt automate doing the same redefine using the:
ThisApplication.CommandManager.ControlDefinitions.Item("cmd")

How can I find the full instructions for the Redefine using CommandManager????

Thanks for the reply.
0 Likes
Message 4 of 4

Anonymous
Not applicable
You can redefine a sketch using the PlanarSketch.PlanarEntity property. Just
set the property to the new planar entity (XY work plane in your case).

Sanjay-
0 Likes