块插入点不正确
你好我有一些代码可以获取块的插入点,以确保它在0,0,0处插入。在Autocad中列出块时,插入点为0,0,0(即使单位设置为8个小数点)。当我在vba中获得块的插入点时,它显示插入点(0)=-2.05182e-009。
为什么插入点的值与autocad中显示的值不同? 检查块(编辑器),查看其中是否包含硬插入点。 返回的坐标是UCS还是WCS? UCS设置为“世界”,块的插入点为0,0,0。 这是纸面空间中的标题栏/边界吗?如果是这样,偏移可能与打印偏移有关。有人把这个从0,0中去掉了吗? 请张贴您的密码,并封锁。 我已连接了该块。当我检查块的扩展数据时,我可以看到不正确的插入点(10-2.05182e-009 0.0 0.0)。当我列出块时,插入点是0,0,0。
以下是检查块以确保其在0,0,0处插入的代码:
Private Sub checkTitleBlockInsertionPoint()
Dim temp1 As AcadBlockReference
If strDrawingType = "iso" Then
grpCode(0) = 2
dataVal(0) = strIsoBorderBlockName
Else
grpCode(0) = 2
dataVal(0) = strGABorderBlockName
End If
'Problem found with iso border insertion point not reading properly.
'Temporarily remove the check for insertion point.
If strDrawingType <> "iso" Then
Set ssetobj = AddSelectionSet("SS01")
mode = acSelectionSetAll
ssetobj.Select mode, , , grpCode, dataVal
Set temp1 = ssetobj.Item(i)
i = 0
For i = 0 To 2
If temp1.InsertionPoint(i) <> 0 Then
errorType (2)
Exit For
End If
i = i + 1
Next
End If
End Sub
我主要使用Visual LISP(ActiveX)编程,所以请原谅我需要澄清。。。
在VBAIDE的“对象浏览器”下,InsertionPoint属性是一个变量,它应该返回(x y z),而不是像DXF代码那样返回(10 x y z),对吗? 是的,你说得对。插入点是一个变体(我的代码中的Insertionpnt(i))。我刚刚加入了dxf组码10,以显示vba中为插入点返回的内容。当我调试代码时,x显示的值是-2.05182e-009,当我列出块时,它实际上是0。 符号-2.05182e-009等于-0.00000000205182。这在只有8位小数的读数中不会显示。然而,从更大的角度来看,该值应被视为0。
请参阅此网页,列出程序员在处理十进制/二进制转换时应考虑的准则。
http://support.microsoft.com/kb/125056
页:
[1]
2