<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to Import and delete workspaces? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-import-and-delete-workspaces/m-p/5087402#M43660</link>
    <description>&lt;P&gt;Check out&lt;A href="https://forums.autodesk.com/t5/NET/Creating-new-customized-menu-and-toolbar-in-Autocad-2010-using/td-p/3027484" target="_self"&gt; this thread,&lt;/A&gt; there's a sample project attached to Wayne Brill's post (&lt;A href="https://forums.autodesk.com/autodesk/attachments/autodesk/152/23567/1/CUISAMP_2010.zip" target="_self"&gt;CUISAMP_2010.zip&lt;/A&gt;) that iterates workspaces, and I think there's also sample code for add and removal of workspaces.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://forums.autodesk.com/t5/NET/Creating-new-customized-menu-and-toolbar-in-Autocad-2010-using/td-p/3027484" target="_blank"&gt;http://forums.autodesk.com/t5/NET/Creating-new-customized-menu-and-toolbar-in-Autocad-2010-using/td-p/3027484&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Paavo&lt;/P&gt;</description>
    <pubDate>Wed, 11 Jun 2014 10:48:06 GMT</pubDate>
    <dc:creator>techsoft3d</dc:creator>
    <dc:date>2014-06-11T10:48:06Z</dc:date>
    <item>
      <title>How to Import and delete workspaces?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-import-and-delete-workspaces/m-p/5087328#M43659</link>
      <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone point me in the right direction?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jun 2014 09:42:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-import-and-delete-workspaces/m-p/5087328#M43659</guid>
      <dc:creator>mobj</dc:creator>
      <dc:date>2014-06-11T09:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to Import and delete workspaces?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-import-and-delete-workspaces/m-p/5087402#M43660</link>
      <description>&lt;P&gt;Check out&lt;A href="https://forums.autodesk.com/t5/NET/Creating-new-customized-menu-and-toolbar-in-Autocad-2010-using/td-p/3027484" target="_self"&gt; this thread,&lt;/A&gt; there's a sample project attached to Wayne Brill's post (&lt;A href="https://forums.autodesk.com/autodesk/attachments/autodesk/152/23567/1/CUISAMP_2010.zip" target="_self"&gt;CUISAMP_2010.zip&lt;/A&gt;) that iterates workspaces, and I think there's also sample code for add and removal of workspaces.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://forums.autodesk.com/t5/NET/Creating-new-customized-menu-and-toolbar-in-Autocad-2010-using/td-p/3027484" target="_blank"&gt;http://forums.autodesk.com/t5/NET/Creating-new-customized-menu-and-toolbar-in-Autocad-2010-using/td-p/3027484&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Paavo&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jun 2014 10:48:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-import-and-delete-workspaces/m-p/5087402#M43660</guid>
      <dc:creator>techsoft3d</dc:creator>
      <dc:date>2014-06-11T10:48:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to Import and delete workspaces?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-import-and-delete-workspaces/m-p/5098130#M43661</link>
      <description>&lt;P&gt;Paavo is correct, this link will show you how to work with Workspaces and CUI elements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This API is only available in .Net.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Philippe.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;[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");
        }
    }
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jun 2014 18:48:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-import-and-delete-workspaces/m-p/5098130#M43661</guid>
      <dc:creator>philippe.leefsma</dc:creator>
      <dc:date>2014-06-16T18:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to Import and delete workspaces?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-import-and-delete-workspaces/m-p/5099070#M43662</link>
      <description>Thanks, this looks very promising. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Tue, 17 Jun 2014 06:51:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-import-and-delete-workspaces/m-p/5099070#M43662</guid>
      <dc:creator>mobj</dc:creator>
      <dc:date>2014-06-17T06:51:52Z</dc:date>
    </item>
  </channel>
</rss>

