我想看一级黄色大片_久久亚洲国产精品一区二区_久久精品免视看国产明星_91久久青青青国产免费

您的位置:網(wǎng)站首頁 > CAD新聞

VB編程修改AutoCAD長度型尺寸標注

時間:2012-01-15 09:28:28 來源:未知

用于長度型尺寸標注編輯的屬性十分豐富,TextOverride屬性可用于修改尺寸標注的文本,該屬性適用于除了導線型標注之外的所有尺寸標注對象,尺寸標注的默認數(shù)值默認顯示為AutoCAD自動計算的實際測量值。

要修改尺寸標注的文本顯示,可設置TextOverride屬性,用自定義字符串取代實際測量值。下面的程序用AddDimAligned方法返回尺寸標注的實際測量值,設置TextOverride屬性,用自定義數(shù)值取代尺寸標注的實際測量值。

Private Sub Command1_Click()
    Dim leaderobj As AcadLeader
    Dim points(0 To 8) As Double
    Dim leadertype As Integer
    Dim annotationobject As AcadObject
    Dim mtextobj As AcadMText
    Dim corner(0 To 2) As Double
    Dim width As Double
    Dim text As String
    corner(0) = 0#: corner(1) = 15#: corner(2) = 0#
    width = 30
    text = "R1.5(min)"
    Set mtextobj = acadapp.ActiveDocument.ModelSpace.AddMText(corner, width, text)
    Set annotationobject = mtextobj
    points(0) = 0: points(1) = 0: points(2) = 0
    points(3) = 4: points(4) = 4: points(5) = 0
    points(6) = 4: points(7) = 5: points(8) = 0
    leadertype = acLineWidthArrow
    Set leaderobj = acadapp.ActiveDocument.ModelSpace.AddLeader(points, annotaionobject, leadertype)
    ZoomExtents
End Sub

DimensionLineColor屬性用來設置標注尺寸線的顏色,適用于所有尺寸標注對象,不同的顏色可用顏色索引值或內(nèi)置顏色來設置。VerticalTextPosition屬性設置標注文字在垂直標注線方向的位置,適用于所有尺寸標注對象,下面的代碼創(chuàng)建一個指定角度的尺寸標注,并設置標尺文字位于標注線中心位置。

Private Sub Command1_Click()
    Dim dimobj As AcadDimRotated
    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    Dim location(0 To 2) As Double
    Dim rotangle As Double
    point1(0) = 5#: point1(1) = 0#: point1(2) = 0#
    point2(0) = 5#: point2(1) = 25#: point2(2) = 0#
    location(0) = 30#: location(1) = 0#: location(2) = 0#
    rotangle = 90
    rotangle = rotangle * 3.14 / 180#
    Set dimobj = acadapp.ActiveDocument.ModelSpace.AddDimRotated(point1, point2, location, rotangle)
    dimobj.VerticalTextPosition = acOutside
    dimobj.Update
    ZoomExtents
End Sub