CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

区域属性 (ActiveX)

2023-1-3 22:40| 发布者: admin| 查看: 475| 评论: 0|来自: AutoCAD

摘要: 指定圆弧、圆、椭圆、填充、轻量多段线、折线、区域或平面闭合样条的封闭区域。

指定圆弧、圆、椭圆、填充、轻量多段线、折线、区域或平面闭合样条的封闭区域。

支持的平台:仅窗口

签名

工 务 局:

object.Area
对象

类型:椭圆影线LWPolyline折线区域样条曲线

此属性适用的对象。

属性值

只读:不,对象;是,对于所有其他对象Circle

类型:

以方形绘图单位指定的对象的面积。

言论

填充对象:

填充的组合区域的总面积。

宽折线:

该区域由宽度的中心定义。

地区:

面积等于区域中所有对象的组合面积。

打开对象,例如圆弧、样条曲线和开放多段线:

计算面积时,就好像一条直线连接起点和终点一样。





例子

工 务 局:

Sub Example_Area()
    ' This example creates a polyline object and
    ' then uses the area property to find the
    ' area of that polyline.
    
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 5) As Double
    Dim plineArea As Double

    ' Establish the points for the Polyline
    points(0) = 3: points(1) = 7
    points(2) = 9: points(3) = 2
    points(4) = 3: points(5) = 5
    
    ' Create the polyline in model space
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    
    ' Close the polyline and update display of it
    plineObj.Closed = True
    plineObj.Update
    ZoomAll
    
    ' Get the area of the polyline
    plineArea = plineObj.Area
    
    MsgBox "The area of the new Polyline is: " & plineArea, vbInformation, "Area Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Area()
    ;; This example creates a polyline object and
    ;; then uses the area property to find the
    ;; area of that polyline.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))  

    ;; Establish the points for the Polyline
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(3 7
				  9 2
				  3 5
				 )
    )
    
    ;; Create the polyline in model space
    (setq modelSpace (vla-get-ModelSpace doc))  
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    
    ;; Close the polyline and update display of it
    (vla-put-Closed plineObj :vlax-true)
    (vla-Update plineObj)
    (vla-ZoomAll acadObj)
    
    ;; Get the area of the polyline
    (setq plineArea (vla-get-Area plineObj))
    
    (alert (strcat "The area of the new Polyline is: " (rtos plineArea 2)))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-19 13:59

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部