672277923 发表于 2020-12-25 20:05:09

求指导,用AddExtrudedSolidAlongPath创建实体失败

我想画一条管道,看是否与其他管道冲突,想用AddExtrudedSolidAlongPath这个方法扫掠路径生成实体,结果看了帮助文件,老是提示创建失败。
我仔细阅读了帮助文件的示例,复制粘贴到CAD VBA编辑器中,运行还是提示创建失败。

提示如下:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASsAAAC9CAYAAADr7FteAAAZB0lEQVR4Ae2dS44cNxKGczOY2Xrpne/Qq+qj1AFy442Ws+sjVN9g6gJeGShYtgy7/YAkSLJl2ZIMl+1B2wN46wN4hoMgGWSQSWaynpms/BsoVD74iPgj+GVkVknVPHjwQKVe77777k7HU2Pseiyec2h/1/HRPh1r6AJdppwDv/32m/rjjz9Uo/AHBaAAFJioAgTRX375Rf3++++A1URjBLOgABRQSt/d/fTTT+r+/h6wQkZAASgwXQWosnr79q369ddfAavphgmWQQEoQLD64Ycf1M8//wxYIR2gABSYrgIEq1evXim6FcQD9unGCZZBgdkrQLB6+fKl+vHHHwGr2WcDBIACE1aAYPXtt9+qN2/eAFYTjhNMgwKzV4Bg9eLFC/X69WvAavbZAAGgwIQVIFg9f/5cff/99yeA1fZWXTfX6nY7JQW26va6UU3TqHZzoF0n9W+j2qZVh5pY7OHevhxRz2JjD2kodN3b58z8xx4vM00th2mNEVxyf3SO2pT+EayePXumH7IX9OLEzAGIEqFRzfWt0nyaYPC2t9eqKaTUpm2SbfUY5ONJ/ROLKhFNbRtpzS/WPNG26NCevuyiZ5EdrpHNtcJYuW6DG0LXPX3OTnHs8bIT1XGCYPS3v/8jCay+cznvCFZPnz5V3333XUllZRLo+vpaXSfKJZ24Ela5WUc8Tovc2278ya6HTauaTnUz0OdovolFlRgz9EOpHFgTXY96KLbjaIPTwqc86+h/6Az9uu42+rlyYTerptQ6BaXUsRKbCVZPnjzRnwgWV1btLd3exbcoFLhrdXvb+sqqxIIztwkX11CyUWJHt4v66hn7fgon+hdV6IdSp6tw+n2L7ehvX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WPHz/WHw/Sv8H5/PPP1WeffaY+/fRTfa9I/zbn4cOH6qOPPsILGiAHkANHzQFiCzGGvqJAzCH23N3daR4RqIhRL1++VP8HguFYZ2AJs4cAAAAASUVORK5CYII=

示例如下:

Sub Example_AddExtrudedSolidAlongPath()
    ' 该示例将面域沿样条曲线所定义的路径拉伸成实体。
    ' 面域是由圆弧和直线创建的。
   
    Dim curves(0 To 1) As AcadEntity

    ' 定义圆弧
    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)
   
    ' 定义线
    Set curves(1) = ThisDrawing.ModelSpace.AddLine(curves(0).startPoint, curves(0).endPoint)
      
    ' 创建面域
    Dim regionObj As Variant
    regionObj = ThisDrawing.ModelSpace.AddRegion(curves)
   
    ' 定义拉伸路径(样条曲线对象)
    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
   
    ' 定义样条曲线对象
    startTan(0) = 10: startTan(1) = 10: startTan(2) = 10
    endTan(0) = 10: endTan(1) = 10: endTan(2) = 10
    fitPoints(0) = 0: fitPoints(1) = 10: fitPoints(2) = 10
    fitPoints(0) = 10: fitPoints(1) = 10: fitPoints(2) = 10
    fitPoints(0) = 15: fitPoints(1) = 10: fitPoints(2) = 10
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
   
    ' 创建实体
    Dim solidObj As Acad3DSolid
    Set solidObj = ThisDrawing.ModelSpace.AddExtrudedSolidAlongPath(regionObj(0), splineObj)
    ZoomAll
   
End Sub

672277923 发表于 2020-12-25 20:16:29

我好像明白了,路径不能与轮廓在同一平面。。。

zzyong00 发表于 2021-1-7 16:34:04

这是自己解决问题了

672277923 发表于 2021-6-17 08:31:57

zzyong00 发表于 2021-1-7 16:34
这是自己解决问题了

用VBA确实功能并不像其他种类的那么强大,写得还是很吃力的

mikewolf2k 发表于 2021-6-17 09:53:23

672277923 发表于 2021-6-17 08:31
用VBA确实功能并不像其他种类的那么强大,写得还是很吃力的

哪个程序支持路径和轮廓在同一平面?
页: [1]
查看完整版本: 求指导,用AddExtrudedSolidAlongPath创建实体失败