zoukankan      html  css  js  c++  java
  • AutoCAD VBA提取多行文字内容

    AutoCAD VBA,提取多行文字内容,代码如下。

    Public Function GetMTextUnformatString(MTextString As String) As String
    Dim s As String
    Dim RE As Object
    Set RE = ThisDrawing.Application.GetInterfaceObject("VBscript.RegExp")
    RE.IgnoreCase = True
    RE.Globa = True
    s = MTextString
    RE.pattern = "\\\"
    s = RE.Replace(s, Chr(1))
    RE.pattern = "\\{"
    s = RE.Replace(s, Chr(2))
    RE.pattern = "\\}"
    s = RE.Replace(s, Chr(3))
    RE.pattern = "\\pi(.[^;]*);"
    s = RE.Replace(s, "")
    RE.pattern = "\\pt(.[^;]*);"
    s = RE.Replace(s, "")
    RE.pattern = "\\s(.[^;]*)(\^|#|\\)(.[^;]*);"
    s = RE.Replace(s, "$1$3")
    RE.pattern = "(\\F|\\C|\\H|\\T|\\Q|\\W|\\A)(.[^;];"
    s = RE.Replace(s, "")
    RE.pattern = "\\~"
    s = RE.Replace(s, "")
    RE.pattern = "\\P"
    s = RE.Replace(s, "")
    RE.pattern = vbLf
    s = RE.Replace(s, "")
    RE.pattern = "({|})"
    s = RE.Replace(s, "")
    RE.pattern = "\x01"
    s = RE.Replace(s, "\")
    RE.pattern = "\x02"
    s = RE.Replace(s, "{")
    RE.pattern = "\x03"
    s = RE.Replace(s, "}")
    Set RE = Nothing
    GetMTextUnformatString = s
    End Function
    Public Sub GetMTextString()
    Dim objMText As AcadMText
    Dim ptPick As Variant
    ThisDrawing.Utility.GetEntity objMText, ptPick
    MsgBox GetMTextUnformatString(objMText.TextString)
    End Sub

    代码完。

    作者:codee
    文章千古事,得失寸心知。


  • 相关阅读:
    c/c++基础 输入函数/流
    数据库的码/键
    sql plus笔记
    cmd delete oracle related
    CAN总线
    SAR ADC : 逐次逼近寄存器型(SAR)模数转换器(ADC)
    Cortex-M3寄存器等基础知识
    Cortex-M3知识点
    ARM指令和Thumb指令区别
    8051、ARM、AVR
  • 原文地址:https://www.cnblogs.com/bimgoo/p/2502901.html
Copyright © 2011-2022 走看看