本帖最后由 guohq 于 2013-4-18 19:36 编辑
如果要改成一个效果,可能通过更改样式表,这样可以将有到此样式的所有文字、块中的文字等全部改掉。- '''
- ''' 样式改为一种
- '''
- ''' 改后的样式
- '''
- Public Sub TextStyleToSame(ByVal ToStyle As String)
- Using Trans As Transaction = MyBase.DB.TransactionManager.StartTransaction
- Dim StyTab As TextStyleTable = Trans.GetObject(DB.TextStyleTableId, OpenMode.ForWrite)
- ToStyle = ToStyle.Trim.ToUpper
- If StyTab.Has(ToStyle) Then
- Dim MainStyleRec As TextStyleTableRecord = Trans.GetObject(StyTab(ToStyle), OpenMode.ForWrite)
- Dim TempRec As TextStyleTableRecord = Nothing, TempName As String = ""
- For Each ID As ObjectId In StyTab
- Try
- TempRec = Trans.GetObject(ID, OpenMode.ForWrite)
- TempName = TempRec.Name
- If TempName.Trim = "" Then
- Continue For
- End If
- If TempName.ToUpper <> ToStyle Then
- TempRec.CopyFrom(MainStyleRec)
- TempRec.Name = TempName
- End If
- Catch ex As Autodesk.AutoCAD.Runtime.Exception
- End Try
- Next
- End If
- Trans.Commit()
- End Using
- End Sub
|