luckyliya 发表于 2006-5-25 10:08:00

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

<P>下面是关于公差自动标注的源码,运行没有达到预期效果,请各位高手指点</P>
<P>Function Tolerance()</P>
<P>Dim entry As AcadEntity<BR>Dim returnObj As AcadObject<BR>Dim Objname As String<BR>Dim AlignedObj As AcadDimAligned<BR>Dim OrdinateOb As AcadDimOrdinate<BR>Dim rotateobj As AcadDimRotated<BR>Dim NL As String<BR>NL = Chr(13) &amp; Chr(10)<BR>On Error Resume Next<BR>RETRY:<BR>ThisDrawing.Utility.GetEntity returnObj, basepnt, NL &amp; "请选择一个标注对象:"<BR>Set entry = returnObj<BR>Objname = entry.ObjectName<BR>If Err &lt;&gt; 0 Then<BR>&nbsp; Err.Clear<BR>MsgBox "没按提示操作,现在退出!", vbOKOnly + vbCritical, "操作错误"<BR>&nbsp;Exit Function<BR>&nbsp;ElseIf Right(Objname, 9) &lt;&gt; "Dimension" Then<BR>&nbsp;MsgBox "选择的对象不是一个标注,请重新选择!", 0 + 48, "对象选错"<BR>&nbsp;GoTo RETRY<BR>&nbsp;End If<BR>&nbsp;Select Case Objname<BR>&nbsp;Case "AcDbAlignedDimension"<BR>&nbsp;Set AlignedObj = entry<BR>&nbsp;UserForm7.Label1.Caption = "基本尺寸=" &amp; Format(Val(AlignedObj.Measurement), "###0.00")<BR>&nbsp;<BR>&nbsp;Case "AcDbRotatedDimension"<BR>&nbsp;Set rotateobj = entry<BR>&nbsp;UserForm7.Label1.Caption = "基本尺寸=" &amp; Format(Val(RotatedObj.Measurement), "###0.00")<BR>&nbsp; MsgBox RotatedObj.Measurement</P>
<P>&nbsp;Case "AcDbOrdinateDimension"<BR>&nbsp;Set ordinageobj = entry<BR>&nbsp;UserForm7.Label1.Caption = "基本尺寸=" &amp; Format(Val(OrdinateObj.Measurement), "###0.00")</P>
<P>&nbsp;End Select<BR>&nbsp;UserForm7.Show<BR>&nbsp;AlignedObj.TextOverride = "\H2.0x;" + "\S" + UserForm7.TextBox1.Text + "^" + UserForm7.TextBox2.Text<BR>&nbsp;<BR>&nbsp;AlignedObj.Update<BR>&nbsp;End Function<BR>&nbsp;</P>
页: [1]
查看完整版本: (请各位高手帮忙)关于公差自动标注的源码