您可以通过减去、合并或查找区域或 3D 实体的交集来创建复合区域。 然后,可以拉伸或旋转复合区域以创建复杂的实体。若要创建复合区域,请使用该方法。Boolean 当您从一个区域减去另一个区域时,从第一个区域调用该方法。这是您要从中减去的区域。例如,若要计算平面图需要多少地毯,请从楼层空间的外部边界调用该方法,并使用未铺地毯的区域(如柱子和柜台)作为布尔参数列表中的对象。BooleanBoolean 对区域执行的操作由布尔方法的布尔类型参数确定。布尔类型参数可以是以下参数之一:
创建复合区域Sub Ch4_CreateCompositeRegions() ' Create two circles, one representing a room, ' the other a pillar in the center of the room Dim RoomObjects(0 To 1) As AcadCircle Dim center(0 To 2) As Double Dim radius As Double center(0) = 4 center(1) = 4 center(2) = 0 radius = 2# Set RoomObjects(0) = ThisDrawing.ModelSpace.AddCircle(center, radius) radius = 1# Set RoomObjects(1) = ThisDrawing.ModelSpace.AddCircle(center, radius) ' Create a region from the two circles Dim regions As Variant regions = ThisDrawing.ModelSpace.AddRegion(RoomObjects) ' Copy the regions into the region variables for ease of use Dim RoundRoomObj As AcadRegion Dim PillarObj As AcadRegion If regions(0).Area > regions(1).Area Then ' The first region is the room Set RoundRoomObj = regions(0) Set PillarObj = regions(1) Else ' The first region is the pillar Set PillarObj = regions(0) Set RoundRoomObj = regions(1) End If ' Subtract the pillar space from the floor space to ' get a region that represents the total carpet area. RoundRoomObj.Boolean acSubtraction, PillarObj ' Use the Area property to determine the total carpet area MsgBox "The carpet area is: " & RoundRoomObj.Area End Sub 使用属性查找生成的区域的面积。Area |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )
GMT+8, 2024-5-19 13:09
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.