zoukankan      html  css  js  c++  java
  • AutoCAD VBA文字自动对齐操作

    AutoCAD VBA文字自动对齐,代码如下。

    Public Type TextWithPnt
    Index As Long
    TextObj As AcadText
    PntIntX As Double
    PntIntY As Double
    PntLeftX As Double
    PntMidX As Double
    PntRigX As Double
    End Type
    Public OrgTexts() As TextWithPnt
    Public Function CreateSSet(Optional SS As String = "mjtd") As AcadSelectionSet
    On Error Resume Next
    ThisDrawing.SelectionSets(SS).Delete
    Set CreateSSet = ThisDrawing.SelectionSets.Add(SS)
    End Function
    Public Sub BuildFilter(typeArray, dataArray, ParamArray gCodes())
    Dim fType() As Integer, fData()
    Dim Index As Long, i As Long
    Index = LBound(gCodes) - 1
    For i = LBound(gCodes) To UBound(gCodes) Step 2
    Index = Index + 1
    ReDim Preserve fType(0 To Index)
    ReDim Preserve fData(0 To Index)
    fType(Index) = CInt(gCodes(i))
    fData(Index) = gCodes(i + 1)
    Next
    End Sub
    Public Function ssExtents(SS As AcadSelectionSet) As Variant
    Dim Points(), C As Long
    Dim Min As Variant, Max As Variant
    Dim i As Long, j As Long
    C = 0
    For i = 0 To SS.count - 1
    SS.Item(i).GetBoundingBox Min, Max
    ReDim Preserve Points(0 To C + 1)
    Points(C) = Min: Points(C + 1) = Max
    C = C + 2
    Next
    ssExtents = Extents(Points)
    End Function
    Public Function Extents(Points)
    Dim Min As Variant, Max As Variant
    Dim i As Long, j As Long, Pt, RetVal(0 To 1)
    Min = Points(LBound(Points))
    Max = Points(LBound(Points))
    For i = LBound(Points) To UBound(Points)
    Pt = Points(i)
    For j = LBound(Pt) To UBound(Pt)
    If Pt(j) < Min(j) Then Min(j) = Pt(j)
    If Pt(j) > Max(j) Then Max(j) = Pt(j)
    Next
    Next
    RetVal(0) = Min: RetVal(1) = Max
    Extents = RetVal
    End Function

    代码完。

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


  • 相关阅读:
    爱奇艺笔试题 输出01020304... ...
    ThreadPoolExecutor 中为什么WorkQueue会在corePoolSize满了之后入队
    jvisualvm 的使用
    连续子数组的最大和
    最长连续子序列
    leetcode 需要了解的知识点储备
    java String
    mysql MVCC
    java 批量导出(zip文件)
    java 中接口调用
  • 原文地址:https://www.cnblogs.com/bimgoo/p/2502900.html
Copyright © 2011-2022 走看看