[Obsolete]
static public void ExportFuncText()
{
SelectionSet selectionSet = new SelectionSet();
StorableObject[] storableObjects = selectionSet.Selection;
if (storableObjects.Length != 0)
{
foreach (StorableObject storableObject in storableObjects)
{
if (storableObject is Project insideProject)//选择的是项目
{
using (StreamWriter writer = new StreamWriter(@"C:\Users\xxx\Desktop\EasyProgram.csv", false, Encoding.UTF8)) //遍历项目内所有界面
{
writer.WriteLine("ComponentName,Chinese,English,Japanese");
foreach (Page page in insideProject.Pages)
{
foreach (Placement placement in page.AllPlacements) //遍历界面内所有可放置的部件符号等等
{
if (placement is Function function) //如果Placement是逻辑设备(例如端子,断路器等等)
{
string PartCctegory = function.Category.ToString(); //部件类型
if ((PartCctegory == "PLCBox" || PartCctegory == "Blackbox") && function.IsMainFunction)//注意设备还必须是主功能
{
string strComponentType = function.VisibleName; //设备标识符
string chineseText = function.Properties.FUNC_TEXT_COMMON.GetDisplayString().GetString(Language.L_zh_CN);
string englishText = function.Properties.FUNC_TEXT_COMMON.GetDisplayString().GetString(Language.L_en_US);
string japaneseText = function.Properties.FUNC_TEXT_COMMON.GetDisplayString().GetString(Language.L_ja_JP);
writer.WriteLine($"{strComponentType},{chineseText},{englishText},{japaneseText}");
}
}
}
}
}
}
}
}
}
C#EPLAN API开发,导出组件的三种语言到csv文件
最新推荐文章于 2024-06-10 22:20:19 发布