明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2264|回复: 0

[例程]使用尺寸--坐标标注

[复制链接]
发表于 2002-5-28 21:01:00 | 显示全部楼层 |阅读模式
Public Sub UseDimOrdinate()
   
    Dim oldOSMODE As Integer
    oldOSMODE = ThisDrawing.GetVariable("OSMODE")
    ThisDrawing.SetVariable "OSMODE", 15349
   
    Dim dimObj As AcadDimOrdinate
    Dim definingPoint As Variant
    Dim leaderEndPoint As Variant
    Dim useXAxis As Boolean
   
    '选择被标注点和标注文字的插入点
    definingPoint = ThisDrawing.Utility.GetPoint(, "选择被标注点:")
    leaderEndPoint = ThisDrawing.Utility.GetPoint _
                     (definingPoint, "选择标注文字显示位置点:")
   
    Dim kwordList As String
    Dim returnString As String
   
    '定义关键词
    kwordList = "True False"
    '允许键入回车键
    ThisDrawing.Utility.InitializeUserInput 2, kwordList
    '返回选定的关键词
    returnString = ThisDrawing.Utility.GetKeyword _
                   ("显示X坐标True / 显示Y坐标 <True>: ")
    '根据关键词确定显示被标注点的X坐标或Y坐标
    If StrComp(returnString, "False", 1) = 0 Then
        useXAxis = False
    Else
        useXAxis = True
    End If
   
    '在模型空间创建坐标标注对象
    Set dimObj = ThisDrawing.ModelSpace.AddDimOrdinate _
                 (definingPoint, leaderEndPoint, useXAxis)

    ThisDrawing.SetVariable "OSMODE", oldOSMODE
   
    dimObj.ArrowheadSize = 5.5
    dimObj.TextHeight = 7
    dimObj.TextGap = 2.5
    dimObj.DecimalSeparator = "."
   
    Dim txtLocation As Variant
    Dim rotAngular As Double
   
    'txtLocation = ThisDrawing.Utility.GetPoint _
                  (leaderEndPoint, "确定标注值位置:")
    'dimObj.TextPosition = txtLocation
    rotAngular = ThisDrawing.Utility.GetReal("输入旋转角度:")
    dimObj.Rotation = rotAngular * 3.1415926 / 180
   
End Sub
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-28 23:39 , Processed in 0.150000 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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