Create a workspace from an existing workspace .NET

Create a workspace from an existing workspace .NET

Anonymous
Not applicable
2,141 Views
5 Replies
Message 1 of 6

Create a workspace from an existing workspace .NET

Anonymous
Not applicable

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

0 Likes
Accepted solutions (1)
2,142 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable

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

0 Likes
Message 3 of 6

Alexander.Rivilis
Mentor
Mentor

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

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

0 Likes
Message 4 of 6

Anonymous
Not applicable
Accepted solution

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

0 Likes
Message 5 of 6

swaywood
Collaborator
Collaborator

Hi,

Now i am trying to create a 'Classic workspace' by code for the later version of autocad 2015.

Could you share some code for me?

Thanks

swaywood

0 Likes
Message 6 of 6

GeeHaa
Collaborator
Collaborator

Try typing menubar on the command line and setting it to 1

0 Likes