Ai
86 Star 327 Fork 253

InspireFunction/IFoxCAD

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
TestLayer.cs 1.96 KB
一键复制 编辑 原始数据 按行查看 历史
vicwjb 提交于 2024-11-25 13:02 +08:00 . 改文件组织形式,添加大量测试函数
namespace Test;
public class TestLayer
{
[CommandMethod(nameof(Test_LayerAdd0))]
public void Test_LayerAdd0()
{
using DBTrans tr = new();
tr.LayerTable.Add("1");
tr.LayerTable.Add("2", lt => {
lt.Color = Color.FromColorIndex(ColorMethod.ByColor, 1);
lt.LineWeight = LineWeight.LineWeight030;
});
tr.LayerTable.Remove("3");
tr.LayerTable.Delete("0");
tr.LayerTable.Change("4", lt => {
lt.Color = Color.FromColorIndex(ColorMethod.ByColor, 2);
});
}
// 添加图层
[CommandMethod(nameof(Test_LayerAdd1))]
public void Test_LayerAdd1()
{
using DBTrans tr = new();
tr.LayerTable.Add("test1", Color.FromColorIndex(ColorMethod.ByColor, 1));
}
// 添加图层
[CommandMethod(nameof(Test_LayerAdd2))]
public void Test_LayerAdd2()
{
using DBTrans tr = new();
tr.LayerTable.Add("test2", 2);
// tr.LayerTable["3"] = new LayerTableRecord();
}
// 删除图层
[CommandMethod(nameof(Test_LayerDel))]
public void Test_LayerDel()
{
using DBTrans tr = new();
tr.LayerTable.Remove("0"); // 删除图层 0
tr.LayerTable.Remove("Defpoints");// 删除图层 Defpoints
tr.LayerTable.Remove("1"); // 删除不存在的图层 1
tr.LayerTable.Remove("2"); // 删除有图元的图层 2
tr.LayerTable.Remove("3"); // 删除图层 3 // 删除图层 3
tr.LayerTable.Remove("2"); // 测试是否能强制删除
}
[CommandMethod(nameof(Test_PrintLayerName))]
public void Test_PrintLayerName()
{
using DBTrans tr = new();
foreach (var layerRecord in tr.LayerTable.GetRecords())
{
Env.Printl(layerRecord.Name);
}
foreach (var layerRecord in tr.LayerTable.GetRecords())
{
Env.Printl(layerRecord.Name);
break;
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/inspirefunction/ifoxcad.git
git@gitee.com:inspirefunction/ifoxcad.git
inspirefunction
ifoxcad
IFoxCAD
v0.9

搜索帮助