Write DXF Line

Option Explicit

Type Point3D '3차원 점의 좌표를 위한 사용자정의자료형
    X As Double
    Y As Double
    Z As Double
End Type


Public Sub WriteLineDXF(fileNo As Integer, StartPoint As Point3D, EndPoint As Point3D)

 Dim DXFCode As Integer 'DXF Group Code
 Dim DXFValue As Variant 'DXF value
 '
 DXFCode = 0
 Print #fileNo, Format(DXFCode, "@@@")
 DXFValue = "LINE"
 Print #fileNo, DXFValue
 '
 DXFCode = 8
 Print #fileNo, Format(DXFCode, "@@@")
 DXFValue = 0
 Print #fileNo, DXFValue
 '
 DXFCode = 62
 Print #fileNo, Format(DXFCode, "@@@")
 DXFValue = 4
 Print #fileNo, DXFValue
 '
 DXFCode = 10
 Print #fileNo, Format(DXFCode, "@@@")
 DXFValue = StartPoint.X
 Print #fileNo, DXFValue
 '
 DXFCode = 20
 Print #fileNo, Format(DXFCode, "@@@")
 DXFValue = StartPoint.Y
 Print #fileNo, DXFValue
 '
 DXFCode = 30
 Print #fileNo, Format(DXFCode, "@@@")
 DXFValue = StartPoint.Z
 Print #fileNo, DXFValue
 '
 DXFCode = 11
 Print #fileNo, Format(DXFCode, "@@@")
 DXFValue = EndPoint.X
 Print #fileNo, DXFValue
 '
 DXFCode = 21
 Print #fileNo, Format(DXFCode, "@@@")
 DXFValue = EndPoint.Y
 Print #fileNo, DXFValue
 '
 DXFCode = 31
 Print #fileNo, Format(DXFCode, "@@@")
 DXFValue = EndPoint.Z
 Print #fileNo, DXFValue
End Sub
Sub TestFile()
 Dim fileName As String, textData As String, fileNo As Integer
 '
 Dim DXFCode As Integer 'DXF Group Code
 Dim DXFValue As Variant 'DXF value
 '
 
 fileName = "C:\MyChair.DXF" ' for Mac
 fileNo = FreeFile 'Get first free file number
 '
 '
 Open fileName For Output As #fileNo
 '
 DXFCode = 999
 Print #fileNo, Format(DXFCode, "@@@")
 DXFValue = "Created by SolarView"
 Print #fileNo, DXFValue
 '
 DXFCode = 10
 Print #fileNo, Format(DXFCode, "@@@")
 DXFValue = 12.5
 Print #fileNo, DXFValue
 '
 Close #fileNo
End Sub
Print Friendly, PDF & Email
%d bloggers like this: