.NET

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

how to create a toolbar

213 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 (208 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 (171 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 (153 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);

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community