.NET

Reply
Valued Contributor
michael.vanhoose
Posts: 71
Registered: ‎09-26-2007
Message 1 of 4 (227 Views)

how to create a toolbar

227 Views, 3 Replies
02-25-2013 08:08 AM

Does anybody have anycode to create a toolbar?  found some samples, but none worked

Active Contributor
DouceDeux
Posts: 46
Registered: ‎09-04-2012
Message 2 of 4 (222 Views)

Re: how to create a toolbar

02-25-2013 08:48 AM in reply to: michael.vanhoose

I'll provide you with the logic since you already have the sample.

 

  • Create a Customization Section (newCS)
  • Give it a name
  • Create a MacroGroup associated to your newCS MenuGroup
  • Add MenuMacro(s) associated to your MacroGroup. These mene macros don't do anything by themselves, you won't see them anywhere so you have to "add them" to toolbars or other objects.
  • Create a ToolBar associated to your newCS MenuGroup.
  • Add ToolbarButton associated to your ToolBar. These toolbar buttons are the ones that have a 'link' to the menu macros and that's how they create an 'action'. You associate menumacros and toolbarbuttons by the menumacro ID.

If you have any doubts or problems, let me know, I'll be here.

Valued Contributor
michael.vanhoose
Posts: 71
Registered: ‎09-26-2007
Message 3 of 4 (185 Views)

Re: how to create a toolbar

02-26-2013 08:07 AM in reply to: DouceDeux

Thanks, got it to work.

 

But, can't seem to update the workspace after.  It say's to use

Dim

flName AsString= cs.CUIFileBaseName

 

Application.DocumentManager.MdiActiveDocument.SendStringToExecute(

"cuiunload " & flName & " ", False, False, False)

Application.DocumentManager.MdiActiveDocument.SendStringToExecute(

"cuiload " & flName & " filedia 1 ", False, False, False)

 

 

Also, what class has the commands with the bitmap images?

 

Active Contributor
DouceDeux
Posts: 46
Registered: ‎09-04-2012
Message 4 of 4 (167 Views)

Re: how to create a toolbar

02-27-2013 05:19 AM in reply to: michael.vanhoose

That's a tricky part >.<
I'll post the C# code for that part.

 

//We save the settings for CMDECHO (command echo) and FILEDIA (file dialog)
object oldCmdEcho = Application.GetSystemVariable("CMDECHO");
object oldFileDia = Application.GetSystemVariable("FILEDIA");
//Set new settings for CMDECHO AND FILEDIA so the partial cuix is seamless Application.SetSystemVariable("CMDECHO", 0); Application.SetSystemVariable("FILEDIA", 0); //At this point I use a bool variable already set lines above to check if the partial cuix was already in the main cuix. newDocument.SendStringToExecute("_.cuiunload " + myCuiName + " ", false, false, false);

//Load the cui newDocument.SendStringToExecute("_.cuiload " + cuiFileToSend + " ", false, false, false); //cuiFileToSend is the full path for the .cuix. If it has spaces it will require double quotes @""C:\My Path is a pretty path\my cui.cuix"" I will always double quote it, you never know.

//Load the old echo and filedia values
newDocument.SendStringToExecute("(setvar \"FILEDIA\" " + oldFileDia.ToString() + ")(princ) ", false, false, false); newDocument.SendStringToExecute("(setvar \"CMDECHO\" " + oldCmdEcho.ToString() + ")(princ) ", false, false, false);
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!