AutoCAD.Net/C#.Net QQ群:193522571 从已有cuix中导入工作经典空间
2021-01-30 07:13
标签:modified auto des mod ons indexof rcu show uname AutoCAD.Net/C#.Net QQ群:193522571 从已有cuix中导入工作经典空间 标签:modified auto des mod ons indexof rcu show uname 原文地址:https://www.cnblogs.com/swtool/p/11669773.html[CommandMethod("cloneWS")]
public void cloneWorkSpace()
{
try
{
string sourceCuiFileName = @"C:\TEST.CUIX";
if (!File.Exists(sourceCuiFileName)) return;
string curCuiFileName = Application.GetSystemVariable("MENUNAME").ToString() + ".cuix";
CustomizationSection curCui = new CustomizationSection(curCuiFileName);
CustomizationSection sourceCui = new CustomizationSection(sourceCuiFileName);
string workspaceName = "test1";
WorkspaceCollection curWorkspaces = curCui.Workspaces;
int curWsIdx = curWorkspaces.IndexOfWorkspaceName(workspaceName);
// test1 already exists, so just return
// cloning overwrites the existing Workspace
if (curWsIdx != -1) return;
Workspace newWs = sourceCui.getWorkspace(workspaceName);
ContainerCloneAction containerClnAction = new ContainerCloneAction();
Workspace ws = curWorkspaces[0];
curWorkspaces.Clone(newWs, ws, ref containerClnAction);
if (curCui.IsModified)
{
curCui.Save();
}
}
catch (Autodesk.AutoCAD.Runtime.Exception e)
{
Application.ShowAlertDialog("AutoCAD exception:\n" + e.Message);
return;
}
}
文章标题:AutoCAD.Net/C#.Net QQ群:193522571 从已有cuix中导入工作经典空间
文章链接:http://soscw.com/index.php/essay/49028.html