本帖最后由 作者 于 2005-10-17 20:57:01 编辑
小弟做cad二次开发时遇到一个问题,请高手帮帮忙!
我是用vb调用cad做的,为了将来生成的程序能在不同版本之间运行,在开始没有引用cad库,采用了后绑定方式。用了很多命令很正常,但是在用布尔运算对实体进行编辑操作时发现了问题。用实体1减实体2,结果不论用求并集,交集还是1减2,结果都是交集。但是引用cad库后就能得出正常的结果了。怎么才能在后绑定状态(不引用cad库)下正常使用布尔运算?程序段如下:
Private Sub buer() Dim sliceobj(1 To 1000) As Object Dim length As Double Dim width As Double Dim height As Double Dim center(0 To 2) As Double center(0) = 4.5: center(1) = 4.5: center(2) = 4.5 length = 9: width = 9: height = 9# ' 在模型空间中创建长方体 (3DSolid) 对象 Set sliceobj(1) = moSpace. _ AddBox(center, length, width, height) ' 对立方体进行开挖 ' Define the cylinder Dim cylinderObj As Object Dim aaa As Object Dim cylinderCenter(0 To 2) As Double Dim cylinderRadius As Double Dim cylinderHeight As Double cylinderCenter(0) = 4.5: cylinderCenter(1) = 4.5: cylinderCenter(2) = 0# cylinderRadius = 3# cylinderHeight = 20# ' Create the Cylinder (3DSolid) object in model space Set cylinderObj = moSpace.AddCylinder(cylinderCenter, cylinderRadius, cylinderHeight)
' 对立方体进行开挖
sliceobj(1).Boolean acSubtraction, cylinderObj
'acadDoc.Regen True acadDoc.Application.ZoomExtents End Sub
请高手帮帮忙,十分感谢! |