cottage 发表于 2005-10-17 20:54:00

求助!后绑定问题?

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

雪山飞狐_lzh 发表于 2005-10-17 22:53:00

<P>sliceobj(1).Boolean acSubtraction, cylinderObj</P>
<P>改为</P>
<P>sliceobj(1).Boolean 2, cylinderObj</P>

cottage 发表于 2005-10-18 12:45:00

<P>谢谢版主,你太厉害了,以后哦还有向你多多学习请教啊!呵呵</P>
页: [1]
查看完整版本: 求助!后绑定问题?