明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 374|回复: 2

求助大佬们,这个运行显示“基本建模失败”是啥原因啊

[复制链接]
发表于 2023-3-16 23:30 来自手机 | 显示全部楼层 |阅读模式
Sub Example_AddExtrudedSolidAlongPath()
    ' 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.
   
    Dim curves(0 To 1) As AcadEntity

    ' Define the arc
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    Dim startAngle As Double
    Dim endAngle As Double
    centerPoint(0) = 5#: centerPoint(1) = 3#: centerPoint(2) = 0#
    radius = 2#
    startAngle = 0
    endAngle = 3.141592
    Set curves(0) = ThisDrawing.ModelSpace.AddArc(centerPoint, radius, startAngle, endAngle)
   
    ' Define the line
    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 (spline object)
    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double
      Dim startPoint(0 To 2) As Double   '定义起点坐标数组
    Dim endPoint(0 To 2) As Double     '定义终点坐标数组
     startPoint(0) = 0#
    startPoint(1) = 0#
    startPoint(2) = 0#

    '设置终点坐标
    endPoint(0) = 10#
    endPoint(1) = 10#
    endPoint(2) = 0#

    '创建直线对象
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    ' Define the Spline Object
   
   
    ' Create the solid
    Dim solidObj As Acad3DSolid
    Set solidObj = ThisDrawing.ModelSpace.AddExtrudedSolidAlongPath(regionObj(0), lineObj)
    ZoomAll
   
End Sub
发表于 2023-3-21 19:44 | 显示全部楼层
看图,我想是因为路径不能用直线吧?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2023-3-21 20:02 | 显示全部楼层
     startPoint(0) = 0#
    startPoint(1) = 0#
    startPoint(2) = 0#

    '设置终点坐标
    endPoint(0) = 10#
    endPoint(1) = 10#
    endPoint(2) = 0#
刚才试了一下这个起点终点坐标都在0#z轴坐标,那么就是一个没有拉伸的平面。所以错误了。应该改一下终点坐标为非零坐标。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-4-26 00:13 , Processed in 0.271738 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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