[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: " + e.Message); return; } }