明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1557|回复: 0

(请各位高手帮忙)关于公差自动标注的源码

[复制链接]
发表于 2006-5-25 10:08:00 | 显示全部楼层 |阅读模式

下面是关于公差自动标注的源码,运行没有达到预期效果,请各位高手指点

Function Tolerance()

Dim entry As AcadEntity
Dim returnObj As AcadObject
Dim Objname As String
Dim AlignedObj As AcadDimAligned
Dim OrdinateOb As AcadDimOrdinate
Dim rotateobj As AcadDimRotated
Dim NL As String
NL = Chr(13) & Chr(10)
On Error Resume Next
RETRY:
ThisDrawing.Utility.GetEntity returnObj, basepnt, NL & "请选择一个标注对象:"
Set entry = returnObj
Objname = entry.ObjectName
If Err <> 0 Then
  Err.Clear
MsgBox "没按提示操作,现在退出!", vbOKOnly + vbCritical, "操作错误"
 Exit Function
 ElseIf Right(Objname, 9) <> "Dimension" Then
 MsgBox "选择的对象不是一个标注,请重新选择!", 0 + 48, "对象选错"
 GoTo RETRY
 End If
 Select Case Objname
 Case "AcDbAlignedDimension"
 Set AlignedObj = entry
 UserForm7.Label1.Caption = "基本尺寸=" & Format(Val(AlignedObj.Measurement), "###0.00")
 
 Case "AcDbRotatedDimension"
 Set rotateobj = entry
 UserForm7.Label1.Caption = "基本尺寸=" & Format(Val(RotatedObj.Measurement), "###0.00")
  MsgBox RotatedObj.Measurement

 Case "AcDbOrdinateDimension"
 Set ordinageobj = entry
 UserForm7.Label1.Caption = "基本尺寸=" & Format(Val(OrdinateObj.Measurement), "###0.00")

 End Select
 UserForm7.Show
 AlignedObj.TextOverride = "\H2.0x;" + "\S" + UserForm7.TextBox1.Text + "^" + UserForm7.TextBox2.Text
 
 AlignedObj.Update
 End Function
 

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-27 02:18 , Processed in 0.159518 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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