.NET

Reply
Contributor
matinau
Posts: 25
Registered: ‎05-03-2010
Message 1 of 4 (336 Views)
Accepted Solution

Create a workspace from an existing workspace .NET

336 Views, 3 Replies
03-05-2013 11:22 PM

Hi I'm trying to create / copy an existing workspace using c#

 

I couldn't find a direct way to just copy the existing workspace so I tried to add it's properties manually. The only trouble is I can't seem to cover all the settings here's what I have so far... any help would be much appreciated.

 

var userworkspace = new Workspace(cs, acadUser)
 {
  WorkspaceRibbonRoot = wsMaster.WorkspaceRibbonRoot,
  WorkspaceQuickAccessToolbar = wsMaster.WorkspaceQuickAccessToolbar,
  Name = acadUser
 };

foreach (WorkspaceToolbar wst in wsMaster.WorkspaceToolbars)
{
 userworkspace.WorkspaceToolbars.Add(wst);
}

foreach (WorkspacePopMenu wsp in wsMaster.WorkspacePopMenus)
{
 userworkspace.WorkspacePopMenus.Add(wsp);
}

 

Pretty basic I know, how can I get PartialCUI tabs, palettes, etc.. applied?

 

Cheers

Thanks for the reply, unfortunately I needed to reload the main cui file not a partial cui. The following actually worked?

 

Application.LoadMainMenu(csMain.CUIFileName);

 

since there was no "UnloadMainMenu" I called the above code whilst the main cui was loaded which seemed to work? The only annoyance been the number of times the environment reloaded.

 

1st - on initial load

2nd - on "LoadMainMenu"

3rd - on "SetcurrentWorkspace"

 

Can you think of a better / alternative way other than sendstringcommand? Will this approach cause problems since the main cui was never unloaded.

 

If not I'll run with this, thanks

Contributor
matinau
Posts: 25
Registered: ‎05-03-2010
Message 2 of 4 (305 Views)

Re: Create a workspace from an existing workspace .NET

03-06-2013 09:29 PM in reply to: matinau

Ok so I figured out how to create my new workspace from an existing workspace... pretty much what I had previously. The only trouble now is that the newly created workspace isn't full recognised i.e. I can't set it current unless I do it through the cui editor or restart CAD?

 

How do I properly update?

 

Thanks in advance, Matt

Moderator
Alexander.Rivilis
Posts: 1,431
Registered: ‎04-09-2008
Message 3 of 4 (301 Views)

Re: Create a workspace from an existing workspace .NET

03-06-2013 10:36 PM in reply to: matinau

It is look like you have to unload/load cui(x)-file with help of Application.UnloadPartialMenu/Application.LoadPartialMenu and set WORKSPACE system variable with help of Application.SetSystemVariable


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Contributor
matinau
Posts: 25
Registered: ‎05-03-2010
Message 4 of 4 (288 Views)

Re: Create a workspace from an existing workspace .NET

03-07-2013 02:07 PM in reply to: Alexander.Rivilis

Thanks for the reply, unfortunately I needed to reload the main cui file not a partial cui. The following actually worked?

 

Application.LoadMainMenu(csMain.CUIFileName);

 

since there was no "UnloadMainMenu" I called the above code whilst the main cui was loaded which seemed to work? The only annoyance been the number of times the environment reloaded.

 

1st - on initial load

2nd - on "LoadMainMenu"

3rd - on "SetcurrentWorkspace"

 

Can you think of a better / alternative way other than sendstringcommand? Will this approach cause problems since the main cui was never unloaded.

 

If not I'll run with this, thanks

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.