路边 发表于 2005-11-10 11:24:00

求助:怎样求面积??

<P>在CAD中画 四条相交的直线,怎样能在相交的四边形中点一点而求出四边形面积??</P>

wyj7485 发表于 2005-11-10 17:47:00

首先获得边界,由该边界多段线的面积属性可得.

路边 发表于 2005-11-11 10:16:00

<P>老兄,怎样获得边界啊??</P>

wyj7485 发表于 2005-11-11 10:27:00

Sub test()<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; ' 当前图纸的实体数目<BR>&nbsp;&nbsp;&nbsp; Dim n As Long<BR>&nbsp;&nbsp;&nbsp; n = ThisDrawing.ModelSpace.Count<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; ' 调用BOUNDARY命令获取某一点处的边界<BR>&nbsp;&nbsp;&nbsp; Dim Pt As Variant<BR>&nbsp;&nbsp;&nbsp; Pt = ThisDrawing.Utility.GetPoint(, "指定内部点: ")<BR>&nbsp;&nbsp;&nbsp; ThisDrawing.SendCommand "_-Boundary" &amp; vbCr &amp; Pt(0) &amp; "," &amp; Pt(1) &amp; vbCr &amp; vbCr<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; ' 如果存在边界,则会生成新的实体<BR>&nbsp;&nbsp;&nbsp; Dim lwpLineObj As AcadLWPolyline<BR>&nbsp;&nbsp;&nbsp; If ThisDrawing.ModelSpace.Count &gt; n Then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set lwpLineObj = ThisDrawing.ModelSpace.Item(ThisDrawing.ModelSpace.Count - 1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MsgBox lwpLineObj.Area<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lwpLineObj.Delete<BR>&nbsp;&nbsp;&nbsp; Else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MsgBox "未发现有效的边界。"<BR>&nbsp;&nbsp;&nbsp; End If<BR>End Sub

路边 发表于 2005-11-11 11:29:00

太感谢老兄了
页: [1]
查看完整版本: 求助:怎样求面积??