mlr_nj 发表于 2005-2-14 17:07:00

[VBA]线性标注的问题?

Sub Example_AddDimAligned()<BR>                       Dim dimObj As AcadDimAligned<BR>                       Dim fenkua(500, 2) As Double<BR>                       Dim pt1(2) As Double<BR>                       Dim pt2(2) As Double<BR>                       Dim pt3(3) As Double<BR>                       Dim text As String<BR>                       Dim dunshu As Double<BR>                       Dim bili As Integer<BR>                       Dim i As Integer<BR>                       bili = 2<BR>                       i = 5<BR>                       dunshu = 20<BR>                       For i = 1 To dunshu<BR>                                                       fenkua(i, 0) = i<BR>                                                       fenkua(i, 1) = i * 2<BR>                                                       fenkua(i, 2) = 0<BR>                       Next i<BR>                                       For i = 1 To dunshu - 1<BR>                                                                       pt1(0) = fenkua(i, 0)<BR>                                                                       pt1(1) = fenkua(i, 1)<BR>                                                                       pt1(2) = 0<BR>                                                                       pt2(0) = fenkua(i + 1, 0)<BR>                                                                       pt2(1) = fenkua(i + 1, 1)<BR>                                                                       pt2(2) = 0<BR>                                                                       pt3(0) = (fenkua(i, 0) + fenkua(i + 1, 0)) / 2 + 2.5 * 2 * bili<BR>                                                                       pt3(1) = (fenkua(i, 1) + fenkua(i + 1, 1)) / 2 + 2.5 * 2 * bili<BR>                                                                       pt3(2) = 0<BR>                                                                       text = 30<BR>                                                                       Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, pt3)<BR>                                                                                dimObj.TextOverride = text<BR>                                                               <BR>                                               Next i<BR>                               ZoomAll<BR>End Sub<BR>

mccad 发表于 2005-2-14 18:03:00

想问什么问题?<BR>你定义的三个点是pt1,pt2,pt3<BR>但AddDimAligned方法中的三个点却是point1, point2, pt3,这不会存在问题吗?<BR>复制修改的程序要看看参数定义才行。

houlinbo 发表于 2005-2-18 20:48:00

怎样能使每个线性标注与所标注的线段的距离相等?是一直困扰我的问题。

laoliu09 发表于 2005-2-19 13:09:00

用对齐标注不就行了吗?我还不大明白你的意思!

houlinbo 发表于 2005-2-20 16:03:00

对,是对齐标注,但对齐标注上的文字位置总是不好确定。如:正交好标注,斜交上的对齐标注对我来说就很难实现了

mlr_nj 发表于 2005-2-22 09:35:00

<A name=9789><FONT color=#990000><B>mccad</B></FONT></A>老师批评的对,我在复制程序的时候太粗心了。很明显:Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, pt3)和前面不对应。


还有个错误:Dim pt3(3) As Double,这个错误害的我耽误了好几天,把别的方面的都调试了,最后才发现这个错误。这里我自己指出来,让和我同样的初学者引以为戒啊。


另外还有问题请教:<A name=9789><FONT color=#990000><B>mccad</B></FONT></A>老师,就是<A name=10623><FONT color=#000066><B>houlinbo</B></FONT></A>提出的一样的问题:斜交、曲线、的对齐标注,怎样看齐来更齐整些?不太好做。

mccad 发表于 2005-2-23 22:07:00

程序是自己写的,文字想放在哪里就是你自己的问题了。怎样让它好看,你就放到哪里,总结出规律就可以了。

crazylsp 发表于 2013-3-4 16:31:33

Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, pt3)

谢谢这个例子很好经典
页: [1]
查看完整版本: [VBA]线性标注的问题?