当前位置: 首页 > news >正文

网站模板尺寸上海哪家seo公司好

网站模板尺寸,上海哪家seo公司好,大气网站首页,厦门网络推广开发过程遇到了一个问题&#xff1a;自制窗口与控件与CAD的交互。 启动类&#xff0c;调用非模式窗口 Imports Autodesk.AutoCAD.Runtime Public Class Class1 //CAD启动界面 <CommandMethod("US")> Public Sub UiStart() Dim myfrom As Form1 New…

开发过程遇到了一个问题:自制窗口与控件与CAD的交互。

启动类,调用非模式窗口

Imports Autodesk.AutoCAD.Runtime

Public Class Class1

    '//CAD启动界面
    <CommandMethod("US")>
    Public Sub UiStart()

        Dim myfrom As Form1 = New Form1()
        'Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(myfrom); //  模态显示
        '; //  非模态显示
        Autodesk.AutoCAD.ApplicationServices.Application.ShowModelessDialog(myfrom)

    End Sub
End Class

非模式窗体

Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Threading.Tasks
Imports System.Windows.Forms


Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Geometry
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.EditorInput
Imports System.Runtime.InteropServices
Imports Application = Autodesk.AutoCAD.ApplicationServices.Application
Public Class Form1

    Dim db As Database = HostApplicationServices.WorkingDatabase
    Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
    Dim doc As Document = Application.DocumentManager.MdiActiveDocument

    Public Property MyDoc() As Document
        Get
            Return doc
        End Get
        Set(ByVal value As Document)
            doc = value
        End Set
    End Property

'调用windows all的命令,两种方法都可以
    ' <DllImport("user32.DLL")> _
    '  Public Shared Function SetFocus(ByVal hWnd As IntPtr) As Integer

    'End Function

    Public Declare Function SetFocus Lib "USER32.DLL" (ByVal hWnd As Integer) As Integer

    Public Sub New()
        InitializeComponent()
        SetFocus(doc.Window.Handle)
    End Sub
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        ed.WriteMessage("欢迎使用批量统计线段长度小工具,请框选线段!\n")

        '在界面开发中,操作图元时,首先进行文档锁定 ,利用using 语句变量作用范围,结束时自动解锁文档
        Using docLock As DocumentLock = doc.LockDocument()
            '过滤删选条件设置 过滤器
            Dim typedValues(0) As TypedValue
            typedValues.SetValue(New TypedValue(0, "*LINE"), 0)

            Dim sSet As SelectionSet = SelectSsGet("GetSelection", Nothing, typedValues)
            Dim sumLen As Double = 0
            ' 判断是否选取了对象
            If sSet IsNot Nothing Then
                '遍历选择集
                For Each sSObj As SelectedObject In sSet
                    ' 确认返回的是合法的SelectedObject对象  
                    If sSObj IsNot Nothing Then

                        '开启事务处理
                        Using trans As Transaction = db.TransactionManager.StartTransaction()
                            Dim curEnt As Curve = trans.GetObject(sSObj.ObjectId, OpenMode.ForRead)
                            ' 调整文字位置点和对齐点
                            Dim endPoint As Point3d = curEnt.EndPoint
                            'GetDisAtPoint 用于返回起点到终点的长度 传入终点坐标
                            Dim lineLength As Double = curEnt.GetDistAtPoint(endPoint)
                            ed.WriteMessage("\n" + lineLength.ToString())
                            sumLen = sumLen + lineLength
                            trans.Commit()
                        End Using
                    End If
                Next
            End If         'using 语句 结束,括号内所有对象自动销毁,不需要手动dispose()去销毁
            ed.WriteMessage("\n 线段总长为: " & (sumLen.ToString()))
        End Using
    End Sub

    Public Function SelectSsGet(ByVal selectStr As String, ByVal point3dCollection As Point3dCollection, ByVal typedValue() As TypedValue) As SelectionSet

        Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
        '将过滤条件赋值给SelectionFilter对象
        Dim selfilter As SelectionFilter = Nothing
        If typedValue IsNot Nothing Then
            selfilter = New SelectionFilter(typedValue)
        End If
        ' 请求在图形区域选择对象

        Dim psr As PromptSelectionResult
        If selectStr = "GetSelection" Then  '提示用户从图形文件中选取对象

            psr = ed.GetSelection(selfilter)

        ElseIf (selectStr = "SelectAll") Then '选择当前空间内所有未锁定及未冻结的对象

            psr = ed.SelectAll(selfilter)

        ElseIf selectStr = "SelectCrossingPolygon" Then '选择由给定点定义的多边形内的所有对象以及与多边形相交的对象。多边形可以是任意形状,但不能与自己交叉或接触。

            psr = ed.SelectCrossingPolygon(point3dCollection, selfilter)

            '选择与选择围栏相交的所有对象。围栏选择与多边形选择类似,所不同的是围栏不是封闭的, 围栏同样不能与自己相交
        ElseIf selectStr = "SelectFence" Then

            psr = ed.SelectFence(point3dCollection, selfilter)

            '选择完全框入由点定义的多边形内的对象。多边形可以是任意形状,但不能与自己交叉或接触
        ElseIf selectStr = "SelectWindowPolygon" Then

            psr = ed.SelectWindowPolygon(point3dCollection, selfilter)

        ElseIf selectStr = "SelectCrossingWindow" Then  '选择由两个点定义的窗口内的对象以及与窗口相交的对象

            Dim point1 As Point3d = point3dCollection(0)
            Dim point2 As Point3d = point3dCollection(1)
            psr = ed.SelectCrossingWindow(point1, point2, selfilter)

        ElseIf selectStr = "SelectWindow" Then '选择完全框入由两个点定义的矩形内的所有对象。

            Dim point1 As Point3d = point3dCollection(0)
            Dim point2 As Point3d = point3dCollection(1)
            psr = ed.SelectCrossingWindow(point1, point2, selfilter)
        Else
            Return Nothing
        End If

        '// 如果提示状态OK,表示对象已选
        If psr.Status = PromptStatus.OK Then
            Dim sSet As SelectionSet = psr.Value
            ed.WriteMessage("Number of objects selected: " + sSet.Count.ToString() + "\n") '打印选择对象数量
            Return sSet
        Else
            ' 打印选择对象数量
            ed.WriteMessage("Number of objects selected 0 \n")
            Return Nothing
        End If


    End Function


End Class

参考文献

https://zhuanlan.zhihu.com/p/138579148

VB.NET自动操作其他程序(2)--声明DLL相关函数 - zs李四 - 博客园

http://www.zhongyajixie.com/news/48370.html

相关文章:

  • 上海地图seo交流论坛
  • 网站开发中安全性的防范百度推广非企代理
  • 手机wap购物网站模板上海网络优化seo
  • 歌手投票网站怎么做网站优化排名软件网
  • 专门做防盗门的网站网络推广的含义
  • 网站开发招标技术规范书成都网络推广外包公司哪家好
  • 珠宝网站dedecms模版一天赚2000加微信
  • 下载网站的表格要钱如何做培训课程有哪些
  • 网站开发必用代码百度公司销售卖什么的
  • 建站abc网站建设网络推广需要花多少钱
  • 东莞网站开发技术公司电话58同城推广
  • 做柜子好的设计网站长春网站建设方案托管
  • 上海中国建设银行招聘信息网站搜易网服务内容
  • 做网站开发要具备什么知识公司营销策划方案案例
  • 个人站长做电音网站四川网站制作
  • 网站建设编写代码问题百度seo和谷歌seo有什么区别
  • 怎样查看网站备案号seo外链招聘
  • 如何把网站上传到网上百度手机助手下载安卓
  • wordpress 登陆插件seo在线推广
  • 谷德设计网官网首页入口seo诊断的网络问题
  • 龙岗做网站哪里找网络营销师证
  • 现在那个网站做视频最赚钱吗重庆网络推广平台
  • 网站备案拍照背景每日精选12条新闻
  • 国外优秀设计公司网站国外推广网站
  • 怎么做盗版视频网站吗百度推广电话销售话术
  • 设备租赁网站建设dy刷粉网站推广马上刷
  • liunx做网站跳转服务器模板网站建设开发
  • 网站推广工具有啥怎么创建网站快捷方式
  • asp动态网站设计模板阳东网站seo
  • 12366纳税服务平台企业seo顾问公司