zoukankan      html  css  js  c++  java
  • AutoCAD VBA简单文字操作

    AutoCAD VBA简单文字操作,包括几个简单的文字操作函数,代码如下。

    Public Function AddText(ByVal text As String, ByVal ptinsert As Variant, ByVal height As Double) As AcadText
    Set AddText = ThisDrawing.ModelSpace.AddText(text, ptinsert, height)
    End Function
    Public Function AddTextHA(ByVal text As String, ByVal ptinsert As Variant, ByVal height As Double, ByVal angle As Double) As AcadText
    Dim objText As AcadText
    Set objText = ThisDrawing.ModelSpace.AddText(text, ptinsert, height)
    objText.Rotate ptinsert, angle
    objText.udate
    Set AddTextHA = objText
    End Function
    Public Function AddMtext(ByVal ptinsert As Variant, ByVal width As Double, ByVal text As String) As AcadMText
    Set AddMtext = ThisDrawing.ModelSpace.AddMtext(ptinsert, width, text)
    End Function
    Public Function AddMtextHA(ByVal ptinsert As Variant, ByVal width As Double, ByVal text As String, ByVal height As Double, ByVal angle As Double) As AcadMText
    Dim objMtext As AcadMText
    Set objMtext = ThisDrawing.ModelSpace.AddMtext(ptinsert, width, text)
    objMtext.height = height
    objMtext.Rotate = angle
    Set AddMtextHA = objMtext
    End Function
    Public Sub TestText()
    Dim ptinsert(2) As Double
    ptinsert(0) = 100: ptinsert(1) = 100: ptinsert(2) = 0
    AddText "AutoCAD 2004", ptinsert, 5
    ptinsert(0) = 100: ptinsert(1) = 110: ptinsert(2) = 0
    AddMtext ptinsert, 30, "VBA 程序设计"
    ptinsert(0) = 100: ptinsert(1) = 120: ptinsert(2) = 0
    AddTextHA "清华大学出版社", ptinsert, 5, 0.4
    ptinsert(0) = 100: ptinsert(1) = 140: ptinsert(2) = 0
    AddMtextHA ptinsert, 50, "明经通道欢迎你", 5, 0.4
    ZoomExtents
    End Sub

    代码完。

    ”明经通道欢迎你“没有显示出来,提示438错误“对象不支持该属性或方法”。

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


  • 相关阅读:
    [UOJ#128][BZOJ4196][Noi2015]软件包管理器
    [UOJ#127][BZOJ4195][NOI2015]程序自动分析
    [BZOJ3653]谈笑风生
    Django 数据库查询优化
    C#中引用(ref关键字)参数
    C#中值参数的使用实例
    静态变量和实例变量
    全局变量和局部变量的理解
    C#方法定义和调用-2
    C#函数的方法定义和方法调用小议
  • 原文地址:https://www.cnblogs.com/bimgoo/p/2502917.html
Copyright © 2011-2022 走看看