<CommandMethod("cmd2")> _
Public Shared Sub cmd2()
Dim doc As Document = Application.DocumentManager.MdiActiveDocument
Dim db As Database = doc.Database
Using tr As Transaction = db.TransactionManager.StartTransaction()
Dim blockTbl As BlockTable = TryCast(tr.GetObject(db.BlockTableId, OpenMode.ForRead), BlockTable)
Dim modelSpace As BlockTableRecord = TryCast(tr.GetObject(blockTbl(BlockTableRecord.ModelSpace), OpenMode.ForRead), BlockTableRecord)
Dim polyline As New Polyline()
polyline.AddVertexAt(polyline.NumberOfVertices, New Autodesk.AutoCAD.Geometry.Point2d(), 0, 0, 0)
polyline.AddVertexAt(polyline.NumberOfVertices, New Autodesk.AutoCAD.Geometry.Point2d(100, 0), 0, 0, 0)
polyline.AddVertexAt(polyline.NumberOfVertices, New Autodesk.AutoCAD.Geometry.Point2d(100, 100), 0, 0, 0)
polyline.AddVertexAt(polyline.NumberOfVertices, New Autodesk.AutoCAD.Geometry.Point2d(0, 100), 0, 0, 0)
polyline.Closed = True
Dim polyGeomotr As Object = polyline.GeometricExtents
Dim polyGeomotrCopy As Object = polyline.GeometricExtents
Dim polyGeomotrCopy2 As Object = polyline.GeometricExtents
'外轮廓
Dim point3D As New Point3d(50, 50, 0)
polyGeomotrCopy.AddPoint(point3D)
If polyGeomotrCopy = polyGeomotr Then
Application.ShowAlertDialog("点在区域内")
End If
Dim point3D2 As New Point3d(-50, -50, 0)
polyGeomotrCopy2.AddPoint(point3D2)
If polyGeomotrCopy2 = polyGeomotr Then
Application.ShowAlertDialog("点在区域内")
Else
Application.ShowAlertDialog("点在不在区域内")
End If
tr.Commit()
End Using
End Sub
|
暂时没有评论
发表评论 - 不要忘了输入验证码哦! |