我把里面看不懂的代码加进去。程序运行到Set curves(1) = ThisDrawing.ModelSpace.AddLine(curves(0).StartPoint, curves(0).EndPoint)
时停止。这些代码应该如何改呢?谢谢啦!
- [FONT=courier new]
- Sub Example_AddExtrudedSolidAlongPath()
- di = Val(TextBox4.Text)
- d0 = Val(TextBox5.Text)
- W = Val(TextBox6.Text)
- D = Val(TextBox7.Text)
- H = Val(TextBox8.Text)
- N = Val(TextBox9.Text)
- L = Val(TextBox10.Text)
- I = Val(TextBox11.Text)
- ' This example extrudes a solid from a region
- ' along a path defined by a spline.
- ' The region is created from an arc and a line.
-
-
-
- ' This example creates a circle in model space.
- Dim circleObj As AcadCircle
- Dim centerPoint(0 To 2) As Double
- Dim radius As Double
-
- ' Define the circle
- centerPoint(0) = 500 * W - 1200 * D / (N + 1): centerPoint(1) = 500 * H + 500 * d0: centerPoint(2) = 500 * D - 1000 * D / (N + 1)
- radius = 500 * d0
-
- ' Create the Circle object in model space
- Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)
- ' Define the rotation axis with two points
- Dim rotatePt1(0 To 2) As Double
- Dim rotatePt2(0 To 2) As Double
- Dim rotateAngle As Double
-
- rotatePt1(0) = 500 * W - 1200 * D / (N + 1): rotatePt1(1) = 500 * H + 500 * d0: rotatePt1(2) = 500 * D - 1000 * D / (N + 1)
- rotatePt2(0) = 500 * W - 1200 * D / (N + 1): rotatePt2(1) = 0: rotatePt2(2) = 500 * D - 1000 * D / (N + 1)
- rotateAngle = 90
- rotateAngle = rotateAngle * 3.141592 / 180
-
-
- ' Rotate the Circle
- circleObj.Rotate3D rotatePt1, rotatePt2, rotateAngle
-
- Dim curves(0 To 1) As AcadEntity
-
- Set curves(0) = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)
- Set curves(1) = ThisDrawing.ModelSpace.AddLine(curves(0).StartPoint, curves(0).EndPoint)
-
- ' Create the region
- Dim regionObj As Variant
- regionObj = ThisDrawing.ModelSpace.AddRegion(curves)
-
-
- ' Define the extrusion path (3DPolyline object)
- Dim polyObj As Acad3DPolyline
- Dim points(0 To 14) As Double
- ' Define the 3D polyline points
- points(0) = 500 * W - 1200 * D / (N + 1): points(1) = 500 * H + 500 * d0: points(2) = 500 * D - 1000 * D / (N + 1)
- points(3) = -500 * W - 500 * d0: points(4) = 500 * H + 500 * d0: points(5) = 500 * D - 1000 * D / (N + 1)
- points(6) = -500 * W - 500 * d0: points(7) = -500 * H - 500 * d0: points(8) = 500 * D - 1000 * D / (N + 1)
- points(9) = 500 * W + 500 * d0: points(10) = -500 * H - 500 * d0: points(11) = 500 * D - 1000 * D / (N + 1)
- points(12) = 500 * W + 500 * d0: points(13) = 500 * H - 1200 * D / (N + 1): points(14) = 500 * D - 1000 * D / (N + 1)
-
- ' Create a 3DPolyline in model space
- Set polyObj = ThisDrawing.ModelSpace.Add3DPoly(points)
- ' Create the solid
-
- Dim solidObj As Acad3DSolid
- Set solidObj = ThisDrawing.ModelSpace.AddExtrudedSolidAlongPath(regionObj(0), polyObj)
- ZoomAll
-
- End Sub
- [/FONT]
|