首页 > 编程语言 >Aveva Marine VBNET 编程系列-新建图纸,创建文字

Aveva Marine VBNET 编程系列-新建图纸,创建文字

时间:2023-09-29 14:44:43浏览次数:46  
标签:图纸 End Sub Marine draftApp Aveva Try New VBNET

根据MarApi,创建图形文件,新建文字

Imports Aveva.ApplicationFramework.Presentation
Imports Aveva.Marine.Drafting ' marAPI.dll
Public Class 绘图控制

    <MyAmFunctionAtt(NameOf(绘图控制), NameOf(新建图纸))>
    Public Sub 新建图纸(wm As WindowManager)
        Dim draftApp As New MarDrafting
        Try
            'am是单文档模式。不可以同时开2个文件
            If draftApp.DwgCurrent() Then
                If Not draftApp.DwgIsModified() Then '图纸未改动直接退出
                    draftApp.DwgClose()
                Else
                    If MsgBox("检测到图纸有改动", MsgBoxStyle.Question, "是否保存当前图纸?") = MsgBoxResult.Ok Then
                        draftApp.DwgSave()
                    Else
                        draftApp.DwgClose()
                    End If
                End If
            End If
            draftApp.DwgNew(DateTime.Now.ToString("yyyyMMdd-HHmmss"))
        Catch ex As Exception
            MsgBox(ex.StackTrace)
        Finally
            draftApp.Dispose()
        End Try

    End Sub

    <MyAmFunctionAtt(NameOf(绘图控制), NameOf(新建文字))>
    Public Sub 新建文字(wm As WindowManager)
        Dim draftApp As New MarDrafting
        Try
            If Not draftApp.DwgCurrent() Then
                MsgBox("未开启任何图纸无法创建文字", MsgBoxStyle.Critical, "错误提示")
                Return
            End If
            Dim tstr = InputBox("输入文字内容", "输入", DateTime.Now.ToString("yyyyMMdd-HHmmss"))
            Using t As New MarText(tstr)
                t.Position = New Aveva.Marine.Geometry.MarPointPlanar(0, 0)
                t.Height = 5.0
                t.TextColour = New MarColour("Red")
                draftApp.TextNew(t)
            End Using
        Catch ex As Exception
            MsgBox(ex.StackTrace)
        Finally
            draftApp.Dispose()
        End Try
    End Sub
    <MyAmFunctionAtt(NameOf(绘图控制), NameOf(新建多行文字))>
    Public Sub 新建多行文字(wm As WindowManager)
        Dim draftApp As New MarDrafting
        Try
            If Not draftApp.DwgCurrent() Then
                MsgBox("未开启任何图纸无法创建文字", MsgBoxStyle.Critical, "错误提示")
                Return
            End If
            Dim tstr = InputBox("输入文字内容", "输入", DateTime.Now.ToString("yyyyMMdd-HHmmss") + Environment.NewLine + "我是第二行")
            Using t As New MarText(tstr)
                t.Position = New Aveva.Marine.Geometry.MarPointPlanar(0, 0)
                t.Height = 5.0
                t.TextColour = New MarColour("Red")
                draftApp.TextNew(t)
            End Using
        Catch ex As Exception
            MsgBox(ex.StackTrace)
        Finally
            draftApp.Dispose()
        End Try
    End Sub
End Class

 

标签:图纸,End,Sub,Marine,draftApp,Aveva,Try,New,VBNET
From: https://www.cnblogs.com/NanShengBlogs/p/17736982.html

相关文章

  • Aveva Marine VBNET 编程系列-修改程序快捷键
    修改HullDesign程序的主题以及菜单项的快捷键 引用的dll文件下面的是代码和快捷键配置文件:https://files.cnblogs.com/files/NanShengBlogs/AMShortCut.HullDesign.zip?t=1695908179&download=trueImportsAveva.ApplicationFramework.PresentationImportsAveva.Applic......
  • Aveva Marine VBNET 编程系列-搭建开发框架
    引用的DllAveva.ApplicationFramework.dllAveva.ApplicationFramework.Presentation菜单展示效果创建Attribute,用于反射来动态创建菜单,不用每次都去写commandPublicClassMyAmFunctionAttInheritsAttributePrivate_menuNameAsStringPublicPropertyM......
  • VBNET AUTOCAD 单行文字OBB有向包围盒的计算
    遇到要求单行文字包围和的需求,发现AutoCAD自带的算法仅能求出正交包围盒,如下图所示的粉色矩形我想获取下图下图所示蓝色矩形的部分及OBB计算方法图形示例:下面是完整的代码,其中求D点的坐标p1涉及到向量定比分点公式<CommandMethod(NameOf(TT_SingleTextOBB))>SubTT......
  • Tokio Marine & Nichido Fire Insurance Programming Contest 2020
    A-Nickname直接输出前三个字符。代码:#include<iostream>#include<cstdio>usingnamespacestd;constintN=25;chars[N];intmain(){ scanf("%s",s+1); printf("%c%c%c",s[1],s[2],s[3]); return0;}B-Tag如果\(v\leqw\),则显然不......
  • c# aveva marine link folder
    publicclassLinkWorld{publicstaticDbElementLinkWLD=>Aveva.Pdms.Database.DbType.Design.FindElements(DbElementTypeInstance.LINKWLD).FirstOrDefault();}publicclassLinkDescription{publicDbElementCurElement{g......
  • Submarine Spark Security Plugin介绍(0.6.0版本)
    参考https://submarine.apache.org/zh-cn/docs/0.6.0/userDocs/submarine-security/spark-security/从ranger的github地址https://github.com/apache/ranger中可以发现当......
  • c# aveva marine 批量导出图纸到dxf格式
    获取图纸数据库查看代码publicstaticDictionary<string,List<DbElement>>GetDbElements(DbTypedbtype){Dictionary<string,List<DbElement......
  • C# AVEVA PDMS 修改快捷键
    修改快捷键和提示文件 提取菜单栏按钮publicstaticList<ButtonToolImpl>GetButtonImpls(thisMenuToolImplmtl){List<ButtonT......