Aveva Marine VBNET 编程系列-创建曲线

aveva,marine,vbnet,编程,系列,创建,曲线 · 浏览次数 : 7

小编点评

```vbscript Sub 新建曲线(wm As WindowManager) Dim draftApp As New MarDrafting Dim ui As New MarUi 'Imports Aveva.Marine.UI Dim utily As New MarUtil 'Imports Aveva.Marine.Utility Try If Not draftApp.DwgCurrent() Then MsgBox("未开启任何图纸无法新建曲线", MsgBoxStyle.Critical, "错误提示") Return End If Dim str As New MarStringlist("绘直线", "绘制圆", "绘制矩形") Dim rtns = ui.ChoiceSelect("选择操作", "选择曲线类型", str) If rtns(0) = utily.Ok() Then Dim hd As MarElementHandle = Nothing Select Case rtns(1) Case 1 hd = draftApp.LineNew(New Aveva.Marine.Geometry.MarRlinePlanar( New Aveva.Marine.Geometry.MarPointPlanar(10, 20), New Aveva.Marine.Geometry.MarPointPlanar(100, 50) )) Case 2 hd = draftApp.CircleNew( New Aveva.Marine.Geometry.MarCirclePlanar( New Aveva.Marine.Geometry.MarPointPlanar(10, 20), 500 ) Case 3 hd = draftApp.RectangleNew( New Aveva.Marine.Geometry.MarRectanglePlanar( New Aveva.Marine.Geometry.MarPointPlanar(10, 20), New Aveva.Marine.Geometry.MarPointPlanar(100, 50) ) End Select draftApp.ElementColourSet(hd, New MarColour("Cyan")) End If Catch ex As Exception MsgBox(ex.StackTrace) Finally draftApp.Dispose() ui.Dispose() utily.Dispose() End Try End Sub ```

正文

显现的效果

 

代码实现:

<MyAmFunctionAtt(NameOf(绘图控制), NameOf(新建曲线))>
    Public Sub 新建曲线(wm As WindowManager)
        Dim draftApp As New MarDrafting
        Dim ui As New MarUi 'Imports Aveva.Marine.UI
        Dim utily As New MarUtil 'Imports Aveva.Marine.Utility
        Try
            If Not draftApp.DwgCurrent() Then
                MsgBox("未开启任何图纸无法新建曲线", MsgBoxStyle.Critical, "错误提示")
                Return
            End If
            Dim str As New MarStringlist("绘直线")
            str.AddString("绘制圆")
            str.AddString("绘制矩形")
            Dim rtns = ui.ChoiceSelect("选择操作", "选择曲线类型", str)
            If rtns(0) = utily.Ok() Then
                Dim hd As MarElementHandle = Nothing
                Select Case rtns(1)
                    Case 1
                        hd = draftApp.LineNew(New Aveva.Marine.Geometry.MarRlinePlanar(
                            New Aveva.Marine.Geometry.MarPointPlanar(10, 20),
                             New Aveva.Marine.Geometry.MarPointPlanar(100, 50)
                                         ))
                    Case 2
                        hd = draftApp.CircleNew(
                            New Aveva.Marine.Geometry.MarCirclePlanar(
                            New Aveva.Marine.Geometry.MarPointPlanar(10, 20), 500
                                         ))
                    Case 3
                        hd = draftApp.RectangleNew(
                            New Aveva.Marine.Geometry.MarRectanglePlanar(
                            New Aveva.Marine.Geometry.MarPointPlanar(10, 20), New Aveva.Marine.Geometry.MarPointPlanar(100, 50)
                                         ))
                End Select
                draftApp.ElementColourSet(hd, New MarColour("Cyan"))
            End If
        Catch ex As Exception
            MsgBox(ex.StackTrace)
        Finally
            draftApp.Dispose()
            ui.Dispose()
            utily.Dispose()
        End Try
    End Sub

 

与Aveva Marine VBNET 编程系列-创建曲线相似的内容:

Aveva Marine VBNET 编程系列-创建曲线

显现的效果 代码实现: Public Sub 新建曲线(wm As WindowManager) Dim draftApp As New MarDrafting Dim ui As New MarUi 'Im

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

根据MarApi,创建图形文件,新建文字 Imports Aveva.ApplicationFramework.Presentation Imports Aveva.Marine.Drafting ' marAPI.dll Public Class 绘图控制

Aveva Marine VBNET 编程系列-搭建开发框架

引用的Dll Aveva.ApplicationFramework.dll Aveva.ApplicationFramework.Presentation 菜单展示效果 创建Attribute,用于反射来动态创建菜单,不用每次都去写command Public Class MyAmFunctionA

Aveva Marine VBNET 编程系列-修改程序快捷键

修改HullDesign程序的主题以及菜单项的快捷键 引用的dll文件 下面的是代码和快捷键配置文件: https://files.cnblogs.com/files/NanShengBlogs/AMShortCut.HullDesign.zip?t=1695908179&download=true

Aveva Marine VBNET 编程系列-封装一个类

由于AM的marapi的大部分类实现了IDisposable接口,所有避免内存过大,用了一般需要dispose下 微软官方的解释: https://learn.microsoft.com/zh-cn/dotnet/api/system.idisposable?view=net-7.0 以下是MarD

Aveva Marine VBNET 编程系列===>读取drawing explorer的第一层级 view

今天我们研究下读取drawing expolrer的第一层级:view 下面的图纸的层级目录示意图,我们今天需要获取所有的view 主要用到2个方法: 1# 获取第一个元素 MarDrafting.ElementChildFirstGet Method () 2# 获取相邻的元素 MarDrafti

Aveva Marine VBNET 编程系列====>读取drawing explorer的第2层级 Sub views

接上期的内容,此次读取view的下一层几subview 主要用到下面的方法获取view的第一个子级 一个封装的类 Public Class DrawingExpolrerEx Public Shared Function DrawingHasViews(draftApp As MarDrafting

Aveva Marine VBNET 编程系列   获取文字

此系列的教程,暂时不更新,因为没多少人愿意加入一起学习的行列,有需要学习的可以加我微信或者QQ讨论 电话:17607170146(微信同号) QQ:442024898 提取图纸中的文字, Public S

C# AVEVA MARINE 二次开发 读取分段

快速读取和筛选分段元素 [MyAmFunctionAtt(nameof(测试功能), nameof(读取分段))] public void 读取分段(WindowManager wm) { try { foreach (var item in wm.Windows) { if (item is Do

c# aveva marine 批量导出图纸到dxf格式

获取图纸数据库 查看代码 public static Dictionary