更改标注尺寸值的<>为真实值
不少地方看不懂.................
Public Sub SelfOverRide(objDim As AcadDimension) Dim objBlk As AcadBlock Dim objEnt As AcadEntity Dim varPos As Variant Dim varInsPnt As Variant Dim objDimText As AcadMText Dim objBlocks As AcadBlocks Dim blnDone As Boolean Set objBlocks = ThisDrawing.Blocks varPos = objDim.TextPosition For Each objBlk In objBlocks If Not blnDone Then If Left(objBlk.Name, 2) = "*D" Then For Each objEnt In objBlk If TypeOf objEnt Is AcadMText Then Set objDimText = objEnt varInsPnt = objDimText.InsertionPoint If varInsPnt(0) = varPos(0) Then If varInsPnt(1) = varPos(1) Then objDim.TextOverride = objDimText.TextString blnDone = True Exit For End If End If End If Next objEnt End If Else Exit For End If Next objBlk End Sub
Sub TEST_SelfOverRide() Dim strPrmt As String Dim objEnt As AcadEntity Dim varPnt As Variant Dim IsDimension As Boolean Dim objDim As AcadDimension
If Left(objBlk.Name, 2) = "*D" Then
标注实际上是一个无名块,以 "*D" 开头
If TypeOf objEnt Is AcadMText Then
取得标注中的标注文字
Set objDim = objEnt
将获得的标注对象类型转换为标注,因为SelfOverRide的参数为AcadDimension
谢谢呵呵
这个 Set objDim = objEnt
我还不太明白
Dim objEnt As AcadEntity Dim objDim As AcadDimension 不一样的东西啊 怎么就=了。
有什么特别的作用是吧?
第一个子程序中还有这个类似的 Set objDimText = objEnt