[vba]CAD도면 작성-문자열 쓰기(DXF)

도면파일(DXF 파일)에 내가 원하는 문자열을 쓰기

작성의도 : 도면 작성 자동화

Sub WriteDXFText(FileNumber As Integer, myText As String, Layer As String, x As Double, y As Double, z As Double, TextHeight As Double, Color As Integer, Optional Style As String = "Standard")
    '
    'How to use this subprocedure:
    'WriteDXFText(FileNumber , "my  story goes here.", "0", 10, 15, 0, 3, 1)
    
    '"Text" entity
    Print #FileNumber, Format(0, "@@@")
    Print #FileNumber, "TEXT"
    '
    Print #FileNumber, Format(1, "@@@")
    Print #FileNumber, myText
    '
    'Style Name
    Print #FileNumber, Format(7, "@@@")
    Print #FileNumber, Style
    '
    'Layer Name
    Print #FileNumber, Format(8, "@@@")
    Print #FileNumber, Layer
    '
    '
    'x coordinate of start point
    Print #FileNumber, Format(10, "@@@")
    Print #FileNumber, x
    '
    'y coordinate of start point
    Print #FileNumber, Format(20, "@@@")
    Print #FileNumber, y
    '
    'z coordinate of start point
    Print #FileNumber, Format(30, "@@@")
    Print #FileNumber, z
    '
    'Text Height
    Print #FileNumber, Format(40, "@@@")
    Print #FileNumber, TextHeight
    '
    'Text Color
    Print #FileNumber, Format(62, "@@@")
    Print #FileNumber, Color
    '
End Sub

Print Friendly, PDF & Email