Active Contributor
Posts: 47
Registered: ‎09-04-2012
Message 1 of 3 (266 Views)

The Mistery Bag - Assigning an Extended Help File

266 Views, 2 Replies
02-14-2013 12:18 PM



I've been able to successfully add Extended help to my Toolbar by creating an .xalm and then manually assigning the .xalm file and then choosing one of the keys AutoCAD detects.

The extended help help displays as it should.


Now, I want to be able do make the toolbar button (or Menumacro to be more precise) have the property, for the extended help, from code. In other words, add the tag to .cui corresponding to the Extended help.


To do this I created a custom class derived from IPropertyBag and passed it as parameter but the MenuGroup.cui inside the .cuix did not change, I should add a <ExtendedContent UriSource="..." SourceKey=""> tag but it doesn't because the addition was not successful.


I'm trying:


public class CustomBag : IPropertyBag

  String UriSource;

  String SourceKey;




MenuMacro newMM1 = new MenuMacro();

CustomBag myBag = new CustomBag();

myBag.AddStuff(source, key);

newMM1.macro.addToolTipProperty((IPropertyBag) myBag);
newMM1.macro.addCommandProperty((IPropertyBag)myBag, false, false);
newMM1.macro.addProperties((IPropertyBag)myBag, false, false);


I don't know exactly which of those macro functions is the one that adds the tag but none of them worked with my bad custom class XD.


I read something about making property bags serializable but I don't know that, really, tried and failed.


The only other option I see is opening up the saved .cuix, unpacking it, opening MenuGroup.cui and then manually adding the text representing the <ExtendedContent> tag.


Help please @.@


Edit: I'm using Ac 2010 and .net 3.5

Active Contributor
Posts: 47
Registered: ‎09-04-2012
Message 2 of 3 (243 Views)

Re: The Mistery Bag - Assigning an Extended Help File

02-14-2013 02:34 PM in reply to: DouceDeux

I've tried the code below but it didn't work, it fails to cast StackPanel as IPropertyBag. :smileysad: (no custom class this time)


public void test2()
  ToolTipContent newTTC = new ToolTipContent();
  newTTC.UriSource = @"D:\User\Lev\Solutions\AutoCAD 2010\Rebars\Extended Help\RLEH.xaml";
  newTTC.SourceKey = "RLEH_CMD_001";
  CustomizationSection newCS = new CustomizationSection();
  newCS.MenuGroupName = "TESTCMD";
  MacroGroup newMG = new MacroGroup("TESTMacros", newCS.MenuGroup);
  MenuMacro newMM1 = new MenuMacro(newMG, "Test Command", "^C^CREGEN", "ID_Test");
  newMM1.macro.HelpString = "Anexar plano original bajo determinadas especificaciones";        
  newMM1.macro.CLICommand = "TESTCMD";
  newMM1.macro.SmallImage = "RCDATA_16_3D_ARRAY";
  newMM1.macro.SmallImage = "RCDATA_32_3D_ARRAY";

  Autodesk.Windows.RibbonToolTip rtt = new Autodesk.Windows.RibbonToolTip();
  System.Windows.Controls.StackPanel newSP = new System.Windows.Controls.StackPanel();
  System.Windows.Controls.TextBlock newTB = new System.Windows.Controls.TextBlock();
  newTB.Background = System.Windows.Media.Brushes.White;
  newTB.TextAlignment = System.Windows.TextAlignment.Justify;
  newTB.Text = "TEXT TEXT TEXT";
  System.Windows.Controls.Image newI = new System.Windows.Controls.Image();        
  BitmapImage bi3 = new BitmapImage();
  bi3.UriSource = new Uri(@"D:\User\Lev\Solutions\AutoCAD 2010\Rebars\Extended Help\Images\EH_RLXREF.png", UriKind.RelativeOrAbsolute);
  newI.Stretch = System.Windows.Media.Stretch.Fill;
  newI.Source = bi3;
  newSP.Background = System.Windows.Media.Brushes.Black;
  rtt.Content = newSP;
  rtt.ExpandedContent = newSP;

  Toolbar newT = new Toolbar("Test Toolbar", newCS.MenuGroup);
  ToolbarButton newButton1 = new ToolbarButton("ID_Test", "Test", newT, 0);

        object oldCmdEcho = Application.GetSystemVariable("CMDECHO");
object oldFileDia = Application.GetSystemVariable("FILEDIA");
Application.SetSystemVariable("CMDECHO", 0);
Application.SetSystemVariable("FILEDIA", 0);

Application.DocumentManager.MdiActiveDocument.SendStringToExecute("_.cuiload " + @"C:\mycui.cuix" + " ", false, false, false);
Application.DocumentManager.MdiActiveDocument.SendStringToExecute("(setvar \"FILEDIA\" " + oldFileDia.ToString() + ")(princ) ", false, false, false);
Application.DocumentManager.MdiActiveDocument.SendStringToExecute("(setvar \"CMDECHO\" " + oldCmdEcho.ToString() + ")(princ) ", false, false, false);


ADN Support Specialist
Posts: 352
Registered: ‎07-24-2007
Message 3 of 3 (204 Views)

Re: The Mistery Bag - Assigning an Extended Help File

02-27-2013 10:28 AM in reply to: DouceDeux
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.