明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1223|回复: 0

AcadDimRotated的基本用法

[复制链接]
发表于 2008-7-28 08:45:00 | 显示全部楼层 |阅读模式
本帖最后由 作者 于 2008-7-28 9:26:53 编辑

在平常的画图中有时,标注的尺寸格式不统一,下面的程序能对AcadDimRotated的尺寸格式进行统一。
  1. Function CreatSelectionSet(InputEntityObjectName As Variant) As AcadSelectionSet
  2.     On Error Resume Next
  3.     'Dim SSet As AcadSelectionSet
  4.     If Not IsNull(ThisDrawing.SelectionSets.Item("SelectEntity")) Then
  5.       Set CreatSelectionSet = ThisDrawing.SelectionSets.Item("SelectEntity")
  6.       CreatSelectionSet.Delete
  7.     End If
  8.     Set CreatSelectionSet = ThisDrawing.SelectionSets.Add("SelectEntity")
  9.     Pt1 = ThisDrawing.Utility.GetPoint(, "Input First Point")
  10.     Pt2 = ThisDrawing.Utility.GetCorner(Pt1, "Input First Point")
  11.     Dim gpCode(0) As Integer
  12.     Dim dataValue(0) As Variant
  13.     gpCode(0) = 0
  14.     For ii = 0 To UBound(InputEntityObjectName)
  15.       dataValue(ii) = InputEntityObjectName(ii)
  16.     Next ii
  17.     CreatSelectionSet.Select acSelectionSetWindow, Pt1, Pt2, gpCode, dataValue
  18. End Function
  19. Sub ChangeDimensionData()
  20.     Dim SSet As AcadSelectionSet
  21.     Dim InputEntityObjectName As Variant
  22.     InputEntityObjectName = Array("Dimension")
  23.     Set SSet = CreatSelectionSet(InputEntityObjectName)
  24.     Dim Ent As AcadEntity
  25.     Dim objDimension As AcadDimension
  26.     Dim RotatedDimensionEntity As AcadDimRotated
  27.     'RotatedDimensionEntity.ExtensionLineColor=acByLayer
  28.     For Each objDimension In SSet
  29.       With objDimension
  30.         
  31.         If .ObjectName = "AcDbRotatedDimension" _
  32.           Or .ObjectName = "AcDbRadialDimension" _
  33.           Or .ObjectName = "AcDbAlignedDimension" Then
  34.           .LinearScaleFactor = 2
  35.         End If
  36.         Debug.Print .ObjectName
  37.         .Layer = "尺寸线"
  38.         .TextHeight = 3.5
  39.         .DecimalSeparator = "."
  40.         .TextColor = acByLayer
  41.         .DimensionLineColor = acByLayer
  42.         
  43.         
  44. If .ObjectName = "AcDbRotatedDimension" _
  45.     Or .ObjectName = "AcDbAlignedDimension" Then
  46.         .ExtensionLineColor = acByLayer
  47. End If
  48.         .TextStyle = "WMF-宋体0"
  49.         
  50.         
  51.       End With
  52.       'Debug.Print Ent.ObjectName
  53.     Next objDimension
  54. End Sub
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-26 06:25 , Processed in 0.167925 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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