关于三维旋转的程序,有点问题,大家来帮我看看啊!!!
<P>我生成一个圆环面域,想让它绕着Y轴旋转90度,程序如下,大家帮我改改啊</P><P>Sub Example_Rotate3D()</P>
<P> Dim circle1(0) As AcadEntity<BR> Dim circle2(0) As AcadEntity<BR> Dim regionObj1 As Variant<BR> Dim regionObj2 As Variant<BR> Dim point1(0 To 2) As Double<BR> Dim radius1 As Double<BR> Dim radius2 As Double<BR> Dim solidObj As Acad3DSolid<BR> Dim polyObj As Acad3DPolyline<BR> radius1 = 15<BR> radius2 = 10<BR> point1(0) = 0<BR> point1(1) = -50<BR> point1(2) = 0<BR> <BR> '创建面域<BR> Set circle1(0) = ThisDrawing.ModelSpace.AddCircle(point1, radius1)<BR> Set circle2(0) = ThisDrawing.ModelSpace.AddCircle(point1, radius2)<BR> regionObj1 = ThisDrawing.ModelSpace.AddRegion(circle1)<BR> regionObj2 = ThisDrawing.ModelSpace.AddRegion(circle2)<BR> <BR> '布尔运算<BR> regionObj1(0).Boolean acSubtraction, regionObj2(0)<BR> <BR> '三维旋转<BR> Dim point2(0 To 2) As Double<BR> Dim point3(0 To 2) As Double<BR> Dim rotateAngle As Double<BR> rotateAngle = 90 * 3.141592 / 180#<BR> point2(0) = 0<BR> point2(1) = 0<BR> point2(2) = 0<BR> point3(0) = 0<BR> point3(1) = -50<BR> point3(2) = 0<BR> regionObj1.Rotate3D point2, point3, rotateAngle//这句有问题,说是"要求对象"<BR> ThisDrawing.Regen True</P>
<P>End Sub<BR></P>文字 <P>姐姐,怎么又是你啊,你的程序还有问题啊。。。。。</P>
<P>1,regionobj1是个数组,没有Rotate3D的属性,所以要选定数组里的一个对象才行</P>
<P>2。作为旋转轴的线段事先要创建好才行,不能凭空指定两点</P>
<P>所以把你这句regionObj1.Rotate3D point2, point3, rotateAngle 改成</P>
<P>ThisDrawing.ModelSpace.AddLine point2, point3<BR> regionObj1(0).Rotate3D point2, point3, rotateAngle</P>
<P>就行了!</P> <P>大哥,那我怎么样才能使最后只保留旋转后的面域呢,之前的面域和旋转轴都不要显示</P> <P> Dim Line1 As AcadLine<BR> Set Line1 = ThisDrawing.ModelSpace.AddLine(point2, point3)<BR> regionObj1(0).Rotate3D point2, point3, rotateAngle</P>
<P> circle1(0).Visible = False<BR> circle2(0).Visible = False<BR> Line1.Visible = False</P>
<P> ThisDrawing.Regen True</P>
<P>更正你一下,旋转完面域后原来的面域位置就是两个圆存在,不是面域。。。。。</P>
页:
[1]