显现的效果
代码实现:
<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