cnks 发表于 2004-9-18 16:40:00

请问用什么算法能计算出封闭区域的面积

请问用什么算法能计算出封闭区域的面积

mccad 发表于 2004-9-19 08:36:00

封闭区域如果是<A href="mk:@MSITStore:C:\Program%20Files\AutoCAD%202005%20cn\help\acadauto.chm::/idh_arc_object.htm" target="_blank" >Arc</A>, <A href="mk:@MSITStore:C:\Program%20Files\AutoCAD%202005%20cn\help\acadauto.chm::/idh_circle_object.htm" target="_blank" >Circle</A>, <A href="mk:@MSITStore:C:\Program%20Files\AutoCAD%202005%20cn\help\acadauto.chm::/idh_ellipse_object.htm" target="_blank" >Ellipse</A>, <A href="mk:@MSITStore:C:\Program%20Files\AutoCAD%202005%20cn\help\acadauto.chm::/idh_lightweightpolyline_object.htm" target="_blank" >LightweightPolyline</A>, <A href="mk:@MSITStore:C:\Program%20Files\AutoCAD%202005%20cn\help\acadauto.chm::/idh_polyline_object.htm" target="_blank" >Polyline</A>, <A href="mk:@MSITStore:C:\Program%20Files\AutoCAD%202005%20cn\help\acadauto.chm::/idh_region_object.htm" target="_blank" >Region</A>, <A href="mk:@MSITStore:C:\Program%20Files\AutoCAD%202005%20cn\help\acadauto.chm::/idh_spline_object.htm" target="_blank" >Spline</A>中的一种,则可以直接使用Area属性来取得面积

雪山飞狐_lzh 发表于 2004-9-19 13:58:00

用-boundary命令生成面域

supercorn 发表于 2004-9-27 09:20:00

请问版主:


在VBA中是如何使用-boundary来生成面域的?


希望不要出现如图的窗口。

雪山飞狐_lzh 发表于 2004-9-27 10:14:00

前面加个减号

supercorn 发表于 2004-9-27 11:44:00

这样写行吗?版主能否帮我改一下?


'示例Boundary


Sub Boundary()<BR>                       Dim Pnt2 As Variant<BR>                       Pnt2 = ThisDrawing.Utility.GetPoint(, "选择点:")<BR>                       Dim lspPnt As String<BR>                       lspPnt = axPoint2lspPoint(Pnt2)<BR>                       ThisDrawing.SendCommand "-Boundary" &amp; vbCr &amp; lspPnt &amp; vbCr<BR>End Sub


<BR>'转换双元表的函数


Public Function GetDoubleEntTable(entObj As AcadEntity, Pnt As Variant) As String<BR>                       Dim entHandle As String<BR>                       entHandle = entObj.Handle<BR>                       GetDoubleEntTable = "(list(handent " &amp; Chr(34) &amp; entHandle &amp; Chr(34) &amp; _<BR>                                                                                                                                                               ")(list " &amp; Str(Pnt(0)) &amp; Str(Pnt(1)) &amp; Str(Pnt(2)) &amp; "))"<BR>End Function


'转换点的函数


Public Function axPoint2lspPoint(Pnt As Variant) As String<BR>                       axPoint2lspPoint = Pnt(0) &amp; "," &amp; Pnt(1) &amp; "," &amp; Pnt(2)<BR>End Function


'转换图元函数


Public Function axEnt2lspEnt(entObj As AcadEntity) As String<BR>                       Dim entHandle As String<BR>                       entHandle = entObj.Handle<BR>                       axEnt2lspEnt = "(handent " &amp; Chr(34) &amp; entHandle &amp; Chr(34) &amp; ")"<BR>End Function<BR>

雪山飞狐_lzh 发表于 2004-9-27 18:48:00

Sub GetArea()<BR>                       Dim Pnt2 As Variant<BR>                       Pnt2 = ThisDrawing.Utility.GetPoint(, "选择点:")<BR>                       Dim lspPnt As String<BR>                       m = ThisDrawing.ModelSpace.Count<BR>                       ThisDrawing.SendCommand "-Boundary" &amp; vbCr &amp; "a" &amp; vbCr &amp; "o" &amp; vbCr &amp; "r" &amp; vbCr &amp; vbCr &amp; Pnt2(0) &amp; "," &amp; Pnt2(1) &amp; vbCr &amp; vbCr<BR>                       n = ThisDrawing.ModelSpace.Count<BR>                       If m &lt;&gt; n Then<BR>                                                       MsgBox ThisDrawing.ModelSpace(n - 1).Area<BR>                                                       ThisDrawing.ModelSpace(n - 1).Delete<BR>                       Else<BR>                                                       MsgBox "Err"<BR>                       End If<BR>End Sub<BR>
页: [1]
查看完整版本: 请问用什么算法能计算出封闭区域的面积