.NET

Reply
New Member
1 Posts
0 Kudos
Registered: ‎01-20-2013
Post 1 of 3

How to add a toolbar using cui

335 Views, 2 Replies
01-20-2013 03:22 AM

there is a problem with my code,when I load this dll,the toolbar‘s name can be fond in the customization dialog,but never shows in the UI(AutoCAD custom WS)。。。。It crush me up。。

       

[CommandMethod("AddToolBar")]
        public void AddToolBar()
        {
            CustomizationSection cs = new CustomizationSection(
                "C:\\Users\\Administrator\\appdata\\roaming\\autodesk\\autocad 2012 - simplified chinese\\r18.2\\chs\\support\\acad.cuix");
            CAD.Document doc = CAD.Application.DocumentManager.MdiActiveDocument;
            Toolbar newTb = new Toolbar("MyTool", cs.MenuGroup);
            newTb.ToolbarVisible = ToolbarVisible.show;

            foreach (Workspace wk in cs.Workspaces)
            {
                WorkspaceToolbar wkTb = new WorkspaceToolbar(wk, newTb);
                wk.WorkspaceToolbars.Add(wkTb);
                wkTb.Display = 1;
                         
            }
            cs.Save();
        }

 

QQ截图20130120191515.png

 

i dont no y.........need help························

 

i am a chinese,know little english.so it is hard for me to find codes of this aspect at this website,can u get me the link of the code?

thanks。谢谢

 

ADN Support Specialist
762 Posts
100 Kudos
Registered: ‎03-21-2011
Post 2 of 3

Re: How to add a toolbar using cui

01-24-2013 10:48 AM in reply to: yingzi_tj

Hello,

 

Your code look ok to me.

 

Does the toolbar appear after switching workspaces manually in AutoCAD ?

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Moderator
1,465 Posts
277 Kudos
Registered: ‎04-09-2008
Post 3 of 3

Re: How to add a toolbar using cui

01-24-2013 01:40 PM in reply to: yingzi_tj

I do not see that this cui-file was loaded into AutoCAD (with command _CUILOAD). Also there is no any toolbar control created in your's code.


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

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!