I've tried searching the ObjectARX dokumentation and this forum, but can't find any methods to import/transfer a workspace from one CUIx to the Mail CUIx. Also I need a method to delete an existing workspace in the main CUIx.
Can someone point me in the right direction?
Solved! Go to Solution.
Solved by philippe.leefsma. Go to Solution.
Check out this thread, there's a sample project attached to Wayne Brill's post (CUISAMP_2010.zip) that iterates workspaces, and I think there's also sample code for add and removal of workspaces.
Cheers,
Paavo
Paavo is correct, this link will show you how to work with Workspaces and CUI elements.
This API is only available in .Net.
Regards,
Philippe.
[CommandMethod("CloneWorkSpace")] public void CloneWorkSpace() { try { string sourceCuiFileName = @"C:\TEST.CUIX"; if (!System.IO.File.Exists(sourceCuiFileName)) return; string curCuiFileName = Application.GetSystemVariable("MENUNAME").ToString() + ".cuix"; CustomizationSection curCui = new CustomizationSection(curCuiFileName); CustomizationSection sourceCui = new CustomizationSection(sourceCuiFileName); string workspaceName = "Acme Workspace"; WorkspaceCollection curWorkspaces = curCui.Workspaces; int curWsIdx = curWorkspaces.IndexOfWorkspaceName(workspaceName); // Acme Workspace 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; } } // Command: remws // This command removes a workspace. The name of the workspace to remove is // obtained from the command line. [CommandMethod("remws")] public void remws() { String wsName; PromptResult prs = ed.GetString("Enter name of workspace to remove: "); if (PromptStatus.OK == prs.Status) { wsName = prs.StringResult; // If the workspace exist if (-1 != cs.Workspaces.IndexOfWorkspaceName(wsName)) { cs.deleteWorkspace(wsName); // Remove the workspace saveCui(); // Save and reload the CUI file } else { ed.WriteMessage("No workspace exists with this name"); } } }