RibbonMenuButton

I am trying to make my plugin compatible for both BricsCAD and AutoCAD. The RibbonMenuButton with autocad is from Autodesk.Windows. What do I need to import to get the RibbonMenuButton from BricsCAD.

Comments

  • avc
    avc
    edited October 2021

    I use the same CUIX files for plugins for AutoCAD and BricsCAD. This works great. AutoCAD loads CUIX via Bundle, and for Brics you have to call CUIX loading from a plugin:

    internal static bool LoadMenu(string pluginPath, string pluginName)
    {
      Document doc = Application.DocumentManager.MdiActiveDocument;
      if (doc is null) return false;
      string file = pluginPath + "\\" + pluginName + "_Br.cui"; // first we try to download a special version for BricsCAD
      try
      {
        if (!File.Exists(file))   file = pluginPath + "\\" + pluginName + ".cuix";
        if (!File.Exists(file))   return false;
        int oldFiledia = Convert.ToInt32(Application.GetSystemVariable("FILEDIA"));
        Application.SetSystemVariable("FILEDIA", 0);
        try
        {
          file = file.Replace("\\", "\\\\");
          doc.SendStringToExecute($"(if (eq (menugroup \"{pluginName}\") nil) (command \"_CUILOAD\" \"{file}\")) " , false, true, false);
        }
        finally
        {
          Application.SetSystemVariable("FILEDIA", oldFiledia);
        }
      }
      catch (Exception ex) { return false; }
      return true;
    }
    
  • Ok. I am looking for a solution in c#

  • BricsCAD's .NET API does not implement RibbonMenuButton. You might use a RibbonSplitButton instead.