您的位置:首页 > 其它

EPLAN API 入门系列- 提高篇(How to Add/Remove GraphicalLayer?)

2013-03-24 15:12 633 查看

Add GraphicalLayer:

GraphicalLayer oGpl = null;
GraphicalLayerTable layerTable = oPage.Project.LayerTable;

if (oGpl == null)
{
oGpl = new GraphicalLayer();
MultiLangString description = new MultiLangString();
description.AddString(ISOCode.Language.L___, "Graphic.General");
oGpl.Pen.ColorId = 1;
oGpl.Create(layerTable, "Epl" + cnt.ToString(), description);
}

foreach (GraphicalLayer layer2 in layerTable.Layers)
{
if (layer2.Name == "Epl0" || layer2.Name == "Epl1")
{
oGpl = layer2;
if (!oGpl.isVisible)
{
oGpl.isVisible = true;
}
oGpl.Pen.ColorId = 1;
oGpl.Store();
}
}


Remove GraphicalLayer:

GraphicalLayer layer = null;
GraphicalLayerTable layerTable = currentProject.LayerTable;
GraphicalLayer[] layers = layerTable.Layers;
for (int num = 0; num < layers.Length; num++)
{
GraphicalLayer layer2 = layers[num];
if (layer2.Name == "Epl0" || layer2.Name == "Epl1")
{
layerTable.RemoveLayer(layers[num]);
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: