A dxf file is a pure ASCII text file. I build the dxf file as a text variable DXFText, then write it to disk. The first four lines are always:
DXFText = 0 & vbCrLf
DXFText = DXFText & "SECTION" & vbCrLf
DXFText = DXFText & 2 & vbCrLf
DXFText = DXFText & "ENTITIES" & vbCrLf
The last four lines are always:
DXFText = DXFText & 0 & vbCrLf
DXFText = DXFText & "ENDSEC" & vbCrLf
DXFText = DXFText & 0 & vbCrLf
DXFText = DXFText & "EOF" & vbCrLf
When DXFText is complete, create a text file and print to it like:
Open "C:\" & FileName.Text & ".Dxf" For Output As #1
Print #1, DXFText
Close #1
You need to know the group codes for AutoCAD. For instance, to do a circle, it's:
DXFText = DXFText & 0 & vbCrLf
DXFText = DXFText & "CIRCLE" & vbCrLf
DXFText = DXFText & 8 & vbCrLf
DXFText = DXFText & Layer$ & vbCrLf
DXFText = DXFText & 10 & vbCrLf
DXFText = DXFText & Round(CenterX, 4) & vbCrLf
DXFText = DXFText & 20 & vbCrLf
DXFText = DXFText & Round(CenterY, 4) & vbCrLf
DXFText = DXFText & 40 & vbCrLf
DXFText = DXFText & Round(Radius, 4) & vbCrLf
In this case, 8 preceeds the layer name, 10 preceeds the x coordinate of the circle's center, 20 preceeds the y coordinate of the circle's center and 40 preceeds the circle's redius.
Each AutoCAD entity has similar "codes" that identify it's geometric description. Find them in AutoCAD help or a book. YOu can also lear a lot by creating a dxf file in AutoCAD and reading it.