能不能创建一个面沿一个组合曲线路径拉伸成三维实体
<P>Private Sub Command3_Click()<BR>Call AutoCAD_Appliaction(Form1, AcadApp, AcadDoc)<BR> Dim r, h, b, L1, L2, W, baseX, baseY, baseZ As Double<BR> r = 15<BR> h = 10<BR> b = 3<BR> W = 80<BR> L1 = 100<BR> L2 = 100<BR> baseX = 300<BR> baseY = 100<BR> baseZ = 100<BR> Dim curves(0 To 2) As Object<BR> Dim curves1(0 To 3) As AcadEntity<BR> 'r :内径, h: 板厚, b:接逢间隙,l:中心距半长<BR> Dim basePoint(0 To 2) As Double<BR> Dim basePoint1(0 To 2) As Double<BR> Dim basePoint2(0 To 2) As Double<BR> Dim basePoint3(0 To 2) As Double<BR> Dim point1(0 To 2) As Double<BR> Dim point2(0 To 2) As Double<BR> Dim point3(0 To 2) As Double<BR> Dim pi As Double<BR> Dim startAngle, endAngle As Double<BR> <BR> pi = 3.141592<BR> basePoint(0) = baseX: basePoint(1) = baseY: basePoint(2) = baseZ<BR> basePoint1(0) = baseX + L1 + L2: basePoint1(1) = baseY: basePoint1(2) = baseZ<BR> basePoint2(0) = baseX + L1 + L2: basePoint1(1) = baseY: basePoint1(2) = baseZ<BR> point1(0) = baseX + L1 + L2: point1(1) = baseY - r: point1(2) = baseZ<BR> point2(0) = baseX + L1 + L2: point2(1) = baseY - r - h: point2(2) = baseZ<BR> point3(0) = baseX: point3(1) = baseY - r - h: point3(2) = baseZ + 60<BR> <BR> startAngle = -(pi / 2 - Atn(Sqr((r + h / 2) * (r + h / 2) - ((r + h / 2) - b) * ((r + h / 2) - b)) / ((r + h / 2) - b))) '计算内圆接头的起始角度<BR> <BR> endAngle = (pi * 3) / 2 '计算到切点的角度<BR> <BR> Set curves(0) = AcadApp.ActiveDocument.ModelSpace.AddArc(basePoint, (r + h / 2), startAngle, endAngle)<BR> <BR> ' Define the line<BR> <BR> startAngle = -pi / 2 '计算内圆接头的起始角度<BR> endAngle = (pi * 3) / 2 - Atn(Sqr(r * r - (r - b) * (r - b)) / (r - b)) '计算到切点的角度<BR> <BR> <BR> Set curves(1) = AcadApp.ActiveDocument.ModelSpace.AddArc(basePoint1, (r + h / 2), startAngle, endAngle)<BR> Set curves(2) = AcadApp.ActiveDocument.ModelSpace.AddLine(curves(0).EndPoint, curves(1).StartPoint)<BR> <BR> <BR> basePoint2(0) = baseX - W - h / 2: basePoint2(1) = baseY - r - h / 2 + b: basePoint2(2) = baseZ '+ Sqr((r + h / 2) * (r + h / 2) - (r + h / 2 - b) * (r + h / 2 - b))<BR> basePoint3(0) = baseX + W + h / 2: basePoint3(1) = baseY - r - h / 2 + b: basePoint3(2) = baseZ '+ Sqr((r + h / 2) * (r + h / 2) - (r + h / 2 - b) * (r + h / 2 - b))<BR> Set curves1(0) = AcadApp.ActiveDocument.ModelSpace.AddArc(basePoint2, h / 2, -pi / 2, pi / 2)<BR> Set curves1(1) = AcadApp.ActiveDocument.ModelSpace.AddArc(basePoint2, h / 2, pi / 2, (pi * 3) / 2)<BR> Set curves1(2) = AcadApp.ActiveDocument.ModelSpace.AddLine(curves1(0).EndPoint, curves1(1).StartPoint)<BR> Set curves1(3) = AcadApp.ActiveDocument.ModelSpace.AddLine(curves1(1).EndPoint, curves1(0).StartPoint)<BR> ' Create the region<BR> <BR> Dim regionObj As Variant<BR> Dim regionObj1 As Variant<BR> <BR> ' regionObj1 = AcadApp.ActiveDocument.ModelSpace.AddRegion(curves1)<BR> <BR> <BR> ' Create the solid<BR> Dim solidObj, solidObj1 As Acad3DSolid<BR> Set solidObj = AcadApp.ActiveDocument.ModelSpace.AddExtrudedSolidAlongPath(regionObj1(0), curves(0))<BR> 'Set solidObj1 = AcadApp.ActiveDocument.ModelSpace.AddExtrudedSolid(regionObj1(0), W, 0)<BR> <BR> </P><P> Call AutoCAD_3DView(1, 1, -0.5, AcadApp)‘调用模块<BR> AcadApp.ActiveDocument.SendCommand "shademode" & vbCr & "G" & vbCr<BR> <BR> <BR> AcadApp.ZoomAll<BR> Dim strPath As String<BR> strPath = "d:\jpg\jpg1"<BR> Call Export_Picture(strPath, AcadApp)<BR>End Sub</P>
<P>问题:1、拉伸路径能不能为一个半圆弧加一条直线和另外一个半圆弧组成的曲线,</P>
<P> 2、用addarc命令能能创建一个YZ面上的半圆弧</P> <P>可以啊,你可以使用系统提供的AddExtrudedSolidAlongPath,第一个参数是要拉伸的截面,第二个参数是拉伸的路径,可以创建出一个实体</P> <P>问题是第二点怎样画在YZ(相当左视上)面上的半圆弧</P>
<P> </P>
页:
[1]