• AutoCAD开发3--修改文字图层,颜色


    Dim pText As AcadText

        Dim pColor1 As AcadAcCmColor

        Set pColor1 = Application.GetInterfaceObject("AutoCAD.AcCmColor.16")

        Call pColor1.SetRGB(0, 0, 255)

     

       

        Dim pColor2 As AcadAcCmColor

        Set pColor2 = Application.GetInterfaceObject("AutoCAD.AcCmColor.16")

        Call pColor2.SetRGB(127, 0, 0)

       

        Dim pColor3 As AcadAcCmColor

        Set pColor3 = Application.GetInterfaceObject("AutoCAD.AcCmColor.16")

        Call pColor3.SetRGB(255, 191, 0)

       

        Dim pSlct As AcadSelectionSet

        Set pSlct = CreateSelectionSet

       

        Dim gpCode(0) As Integer

        Dim dataValue(0) As Variant

        gpCode(0) = 0

        dataValue(0) = "Text"

       

        Dim groupCode As Variant, dataCode As Variant

        groupCode = gpCode

        dataCode = dataValue

     

        pSlct.SelectOnScreen gpCode, dataValue

       

        Dim sStr As String

       

        For Each pText In pSlct

        

            If Mid(pText.TextString, 1, 1) = "S" And HasTrim(pText.TextString) Then

                pText.Layer = "图层2"

                pText.TrueColor = pColor1

               

            ElseIf Mid(pText.TextString, 1, 1) = "X" And HasTrim(pText.TextString) Then

                pText.Layer = "图层2"

                pText.TrueColor = pColor2

               

            ElseIf Mid(pText.TextString, 1, 1) = "R" And Mid(pText.TextString, 2, 1) <> "Q" And HasTrim(pText.TextString) Then

                pText.Layer = "图层2"

                pText.TrueColor = pColor3

               

            End If

        Next pText

       

        pSlct.Delete

  • 相关阅读:
    mac 外接显示屏的坑
    ssh 多秘钥管理和坑
    CircleCI 前端自动部署
    jest 事件测试
    await Vue.nextTick() 的含义分析
    Jest 里面需要注意的几个小细节
    element 库 date-picker 的 disabledDate 的坑
    jest 提示 Unexpected identifier 的解决方案
    preventDefault 和 stopPropagation
    数据库:Flask-SQLAlchemy
  • 原文地址:https://www.cnblogs.com/jordonin/p/3178974.html
Copyright © 2020-2023  润新知