添加项目文件。

This commit is contained in:
GG Z
2026-02-28 21:04:12 +08:00
parent e30d1be28b
commit f5893778a3
64 changed files with 3313 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
using System.Collections.Generic;
using System.Windows.Forms;
using Bentley.DgnPlatformNET.Elements;
using Bentley.GeometryNET;
using Bentley.MstnPlatformNET;
using MSAddinTest.Interfaces;
using MSUtils;
namespace TestAddinPlugin
{
/// <summary>
/// 测试静态方法
/// 1. 类继承接口 IMSTest_StaticMethod
/// 2. 静态方法添加特性 MSTest
/// 3. 静态方法有且仅有一个IMSTestArg参数
/// </summary>
public class TestStaticMethodExecutor : IMSTest_StaticMethod
{
[MSTest("static", Description = "通过 mstest test static 来调用")]
public static object Execute(string arg)
{
MessageBox.Show("IStaticMethodPlugin 被调用了4!");
return true;
}
[MSTest("element")]
public static object NewElement(string arg)
{
// 绘制一个元素
CurvePrimitive line = CurvePrimitive.CreateLineString(new List<DPoint3d>()
{
new DPoint3d(0,0,0),
new DPoint3d(100000,0,0),
});
var instance = Session.Instance;
if (instance == null) return false;
var dgnm = instance.GetActiveDgnModel();
Element et = DraftingElementSchema.ToElement(dgnm, line, null);
if (et != null) et.AddToModel();
MessageBox.Show("绘制元素成功!");
return true;
}
[MSTest("exception")]
public static object TestReference(string arg)
{
TestClass.NullException();
return false;
}
}
}