明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3099|回复: 3

[求助]当文字是插入的块时,如何用VBA编程序得到其字符.-->mccad转移

[复制链接]
发表于 2002-4-28 20:52 | 显示全部楼层 |阅读模式
有时文字是从别的图中复制-粘贴的,如果不打破的话,能否直接得到文字内容.
发表于 2002-4-28 21:05 | 显示全部楼层

记住,在VBA中,模型空间和图纸空间也是图块,所以操作方法可以一样,只是针对的对

记住,在VBA中,模型空间和图纸空间也是图块,所以操作方法可以一样,只是针对的对象不同[br]
 楼主| 发表于 2002-5-1 10:21 | 显示全部楼层

我就是不知道该用什么对象的什么属性

发表于 2002-5-5 21:14 | 显示全部楼层

这种方法简单...

GetSubEntity 方法
它可以直接取得图元或嵌套图元的信息,取得后你就可以随便对其进行读取或更改。
语法:
object.GetSubEntity Object, PickedPoint, TransMatrix, ContextData[, Prompt]
样例:
Sub Example_GetSubEntity()
    ' This example prompts the user to select on object on the screen with a mouse click,
    ' and returns some information about the selected object.
   
    Dim Object As Object
    Dim PickedPoint As Variant, TransMatrix As Variant, ContextData As Variant
    Dim HasContextData As String
   
    On Error GoTo NOT_ENTITY

        
TRYAGAIN:
        
    MsgBox "Use the mouse to click on an entity in the current drawing after dismissing this dialog box."
        
    ' Get information about selected object
    ThisDrawing.Utility.GetSubEntity Object, PickedPoint, TransMatrix, ContextData
   
    ' Process and display selected object properties
    HasContextData = IIf(VarType(ContextData) = vbEmpty, " does not ", " does ")
   
    MsgBox "The object you chose was an: " & TypeName(Object) & vbCrLf & _

            "Your point of selection was: " & PickedPoint(0) & ", " & _
                                              PickedPoint(1) & ", " & _
                                              PickedPoint(2) & vbCrLf & _
            "This object" & HasContextData & "have nested objects."
   
    Exit Sub
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-3-29 14:47 , Processed in 0.147815 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表