从一组实体创建一个区域。给定的图元必须形成一个封闭的共面区域。 支持的平台:仅窗口 签名工 务 局: RetVal = object.AddRegion(ObjectList) 言论此方法将从曲线输入数组形成的每个闭环中创建一个区域。AutoCAD 将闭合的二维和平面三维多段线转换为单独的区域,然后转换形成闭合平面环的多段线、直线和曲线。如果两条以上的曲线共享一个端点,则生成的区域可能是任意的。 您可以使用该方法将区域分解为各个循环。该方法允许您从实体或区域与另一个实体或区域的交点、并集或减法来创建复合 3D 实体或区域。ExplodeBoolean 创建的对象总数为 。RegionUbound(objRegions) - Lbound(objRegions) + 1 例子工 务 局: Sub Example_AddRegion() ' This example creates a region 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) ZoomAll End Sub Visual LISP: (vl-load-com) (defun c:Example_AddRegion() ;; This example creates a region 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 (vla-AddRegion modelSpace curves)) (vla-ZoomAll acadObj) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:03
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.