明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2204|回复: 2

能不能创建一个面沿一个组合曲线路径拉伸成三维实体

[复制链接]
发表于 2005-12-4 09:59:00 | 显示全部楼层 |阅读模式

Private Sub Command3_Click()
Call AutoCAD_Appliaction(Form1, AcadApp, AcadDoc)
    Dim r, h, b, L1, L2, W, baseX, baseY, baseZ As Double
    r = 15
    h = 10
    b = 3
    W = 80
    L1 = 100
    L2 = 100
    baseX = 300
    baseY = 100
    baseZ = 100
    Dim curves(0 To 2) As Object
    Dim curves1(0 To 3) As AcadEntity
   'r :内径, h: 板厚,  b:接逢间隙,l:中心距半长
    Dim basePoint(0 To 2) As Double
    Dim basePoint1(0 To 2) As Double
    Dim basePoint2(0 To 2) As Double
     Dim basePoint3(0 To 2) As Double
    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    Dim point3(0 To 2) As Double
    Dim pi As Double
    Dim startAngle, endAngle As Double
  
    pi = 3.141592
    basePoint(0) = baseX: basePoint(1) = baseY: basePoint(2) = baseZ
    basePoint1(0) = baseX + L1 + L2: basePoint1(1) = baseY: basePoint1(2) = baseZ
    basePoint2(0) = baseX + L1 + L2: basePoint1(1) = baseY: basePoint1(2) = baseZ
    point1(0) = baseX + L1 + L2: point1(1) = baseY - r: point1(2) = baseZ
    point2(0) = baseX + L1 + L2: point2(1) = baseY - r - h: point2(2) = baseZ
    point3(0) = baseX: point3(1) = baseY - r - h: point3(2) = baseZ + 60
   
    startAngle = -(pi / 2 - Atn(Sqr((r + h / 2) * (r + h / 2) - ((r + h / 2) - b) * ((r + h / 2) - b)) / ((r + h / 2) - b))) '计算内圆接头的起始角度
   
    endAngle = (pi * 3) / 2 '计算到切点的角度
   
    Set curves(0) = AcadApp.ActiveDocument.ModelSpace.AddArc(basePoint, (r + h / 2), startAngle, endAngle)
        
    ' Define the line
               
    startAngle = -pi / 2 '计算内圆接头的起始角度
    endAngle = (pi * 3) / 2 - Atn(Sqr(r * r - (r - b) * (r - b)) / (r - b)) '计算到切点的角度
   
   
   Set curves(1) = AcadApp.ActiveDocument.ModelSpace.AddArc(basePoint1, (r + h / 2), startAngle, endAngle)
   Set curves(2) = AcadApp.ActiveDocument.ModelSpace.AddLine(curves(0).EndPoint, curves(1).StartPoint)
  
  
    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))
    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))
    Set curves1(0) = AcadApp.ActiveDocument.ModelSpace.AddArc(basePoint2, h / 2, -pi / 2, pi / 2)
    Set curves1(1) = AcadApp.ActiveDocument.ModelSpace.AddArc(basePoint2, h / 2, pi / 2, (pi * 3) / 2)
    Set curves1(2) = AcadApp.ActiveDocument.ModelSpace.AddLine(curves1(0).EndPoint, curves1(1).StartPoint)
    Set curves1(3) = AcadApp.ActiveDocument.ModelSpace.AddLine(curves1(1).EndPoint, curves1(0).StartPoint)
    ' Create the region
      
    Dim regionObj As Variant
     Dim regionObj1 As Variant
  
   ' regionObj1 = AcadApp.ActiveDocument.ModelSpace.AddRegion(curves1)
  
   
    ' Create the solid
    Dim solidObj, solidObj1 As Acad3DSolid
    Set solidObj = AcadApp.ActiveDocument.ModelSpace.AddExtrudedSolidAlongPath(regionObj1(0), curves(0))
    'Set solidObj1 = AcadApp.ActiveDocument.ModelSpace.AddExtrudedSolid(regionObj1(0), W, 0)
  
   

   Call AutoCAD_3DView(1, 1, -0.5, AcadApp)‘调用模块
   AcadApp.ActiveDocument.SendCommand "shademode" & vbCr & "G" & vbCr
  
  
   AcadApp.ZoomAll
   Dim strPath As String
   strPath = "d:\jpg\jpg1"
   Call Export_Picture(strPath, AcadApp)
End Sub

问题:1、拉伸路径能不能为一个半圆弧加一条直线和另外一个半圆弧组成的曲线,

        2、用addarc命令能能创建一个YZ面上的半圆弧

发表于 2005-12-4 10:07:00 | 显示全部楼层

可以啊,你可以使用系统提供的AddExtrudedSolidAlongPath,第一个参数是要拉伸的截面,第二个参数是拉伸的路径,可以创建出一个实体

 楼主| 发表于 2005-12-4 12:50:00 | 显示全部楼层

问题是第二点怎样画在YZ(相当左视上)面上的半圆弧

 

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-27 08:49 , Processed in 0.150898 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表