CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

AddExtrudedSolidAlongPath Method (ActiveX)

2023-1-4 13:03| 发布者: admin| 查看: 690| 评论: 0|来自: AutoCAD

摘要: 在给定轮廓和拉伸路径的情况下创建拉伸实体。

在给定轮廓和拉伸路径的情况下创建拉伸实体。

支持的平台:仅窗口

签名

工 务 局:

RetVal = object.AddExtrudedSolidAlongPath(Profile, Path)
对象

类型:模型空间,图纸空间

此方法适用的对象。

轮廓

访问:仅输入

类型:区域

配置文件只能是对象。Region

路径

访问:仅输入

类型:椭圆折线样条曲线

路径只能是,,,,或对象。PolylineCircleEllipseSplineArc

返回值(RetVal)

类型:3DSolid

拉伸对象。3DSolid

言论

只能拉伸 2D 平面区域。

路径不应与轮廓位于同一平面上,也不应具有高曲率区域。

例子

工 务 局:

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
    
    ' Define the Spline Object
    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)
    
    ' Create the solid
    Dim solidObj As Acad3DSolid
    Set solidObj = ThisDrawing.ModelSpace.AddExtrudedSolidAlongPath(regionObj(0), splineObj)
    ZoomAll
    
End Sub

Visual LISP:

(vl-load-com)
(defun c: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.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))
  
    ;; Define the arc
    (setq centerPoint (vlax-3d-point 5 3 0)
          radius 2
          startAngle 0
          endAngle 3.141592)
    (setq arc (vla-AddArc modelSpace centerPoint radius startAngle endAngle))

    ;; Define the line
    (setq line (vla-AddLine modelSpace (vla-get-StartPoint arc) (vla-get-EndPoint arc)))

    (setq curves (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element curves 0 arc)
    (vlax-safearray-put-element curves 1 line)
        
    ;; Create the region
    ;(setq regionObj (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (setq regionObj (vla-AddRegion modelSpace curves))
    
    ;; Define the extrusion path (spline object)
    (setq startTan (vlax-3d-point 10 10 10)
          endTan (vlax-3d-point 10 10 10))
    (setq fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(0 10 10
				                                 10 10 10
				                                 15 10 10
				                                )
    )
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    
    ;; Create the solid
    (setq solidObj (vla-AddExtrudedSolidAlongPath modelSpace (vlax-safearray-get-element (vlax-variant-value regionObj) 0) splineObj))
 
    (vla-ZoomAll acadObj)
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-12 06:36

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部