田草博客

互联网田草博客


网友交流QQ群:11740834 需注明申请加入原因

微信 公众号:ByCAD

邮箱:tiancao1001x126.com
ByCAD,微信公众号
首页 | 普通 | 电脑 | AutoCAD | VB/VB.NET | FLash | 结构 | 建筑 | 电影 | BIM | 规范 | 软件 | ID
-随机-|-分布-
-博客论坛-|-﨣﨤﨧﨨-
-网站导航-|-规范下载-
-BelovedFLash欣赏-

用户登陆
用户:
密码:
 

站点日历
73 2024 - 4 48
 123456
78910111213
14151617181920
21222324252627
282930


站点统计

最新评论



用PL2将PL1线打断后,删除PL2内部部分,保留外部部分 判断点是否在pl线上
未知 IntersectWith   [ 日期:2017-09-13 ]   [ 来自:本站原创 ]  HTML
 <CommandMethod("inters", CommandFlags.UsePickSet)> _
    Public Sub GetInters()
        Dim doc As Document = acadApp.DocumentManager.MdiActiveDocument
        Dim db As Database = doc.Database
        Dim ed As Editor = doc.Editor
        Dim tr As Transaction = db.TransactionManager.StartTransaction
        Try
            Using (tr)
                Dim opt As New PromptEntityOptions(vbLf & "Select line: ")
                opt.SetRejectMessage(vbLf & "Select line only")
                opt.AllowNone = False
                opt.AllowObjectOnLockedLayer = True
                opt.AddAllowedClass(GetType(Line), True)
                Dim res As PromptEntityResult = ed.GetEntity(opt)
                If res.Status <> PromptStatus.OK Then Return
                Dim lid As ObjectId = res.ObjectId
                opt.AddAllowedClass(GetType(Polyline), True)
                opt.SetRejectMessage(vbLf & "Select polyline only")
                opt.Message = vbLf & "Select polyline: "
                res = ed.GetEntity(opt)
                If res.Status <> PromptStatus.OK Then Return
                Dim pid As ObjectId = res.ObjectId
                Dim pts As Point3dCollection = New Point3dCollection()
                ed.WriteMessage(vbLf & "{0} <> {1};", lid, pid)
                Dim enl As Line = CType(tr.GetObject(lid, OpenMode.ForRead), Line)
                Dim enp As Polyline = CType(tr.GetObject(pid, OpenMode.ForRead), Polyline)
                Dim plane As Plane = New Plane(ed.CurrentUserCoordinateSystem.CoordinateSystem3d.Origin, ed.CurrentUserCoordinateSystem.CoordinateSystem3d.Zaxis)
                enl.IntersectWith(enp, Intersect.OnBothOperands, plane, pts, 0, 0)
                ed.WriteMessage(vbLf & "Number of intersections: {0}", pts.Count)
                Dim i As Integer = 1
                For Each pt As Point3d In pts
                    ed.WriteMessage(vbLf & "Point number {0}: ({1}, {2}, {3})", i, pt.X, pt.Y, pt.Z)
                    i += 1
                Next
                tr.Commit()
            End Using
        Catch ex As Autodesk.AutoCAD.Runtime.Exception
            ed.WriteMessage(vbLf & "{0}", ex.Message)
        End Try
    End Sub


Entity entityPointer:与该实体相交的另一个实体

Intersect intersectType:相交的类型,为一枚举

Point3dCollection points:获取所有相交的交点

Int32 thisGraphicSystemMarker:使用该方法实体的下级实体(subentity)的图形系统标记,如果不适用就用缺省值0。

Int32 otherGraphicSystemMarker:其他的下级实体的图形系统标记,如果不适用就用缺省值0。

关于Intersect枚举的成员

成员名

描述

ExtendBoth

两个实体都延伸

ExtendArgument

只延伸作为参数的实体(该方法的第一个参数)

ExtendThis

只延伸原实体(调用该方法的实体)

OnBothOperands

两个实体都不延伸

[本日志由 tiancao1001 于 2022-10-22 12:57 AM 编辑]


暂时没有评论
发表评论 - 不要忘了输入验证码哦!
作者: 用户:  密码:   注册? 验证:  防止恶意留言请输入问题答案:1*6=?  
评论:

禁止表情
禁止UBB
禁止图片
识别链接
识别关键字

字体样式 文字大小 文字颜色
插入粗体文本 插入斜体文本 插入下划线
左对齐 居中对齐 右对齐
插入超级链接 插入邮件地址 插入图像
插入 Flash 插入代码 插入引用
插入列表 插入音频文件 插入视频文件
插入缩进符合
点击下载按钮 下标 上标
水平线 简介分割标记
表  情
 
Tiancao Blog All Rights Reserved 田草博客 版权所有
Copyright ©