RevitAddInManager icon indicating copy to clipboard operation
RevitAddInManager copied to clipboard

AIM not works with Dockable Pane

Open SonaBIMDev opened this issue 4 months ago • 1 comments

Describe the bug I'm using a Dockable pane but I can't access my dockablePane from AIM...

On startup I register a new Dockable with Guid like this :

//register in application with a new guid
UIApplication uiapp = new UIApplication(sender as Application);
_uiApplication = uiapp;

// *** Code pour enregistrer ta nouvelle PanoDockablePane ***
PanoDockablePane panoPane = new PanoDockablePane();
_panoPane = panoPane; // Sauvegarder l'instance

DockablePaneId panoDockablePaneId = new DockablePaneId(new Guid("{3C19FAAC-140C-4B24-A1B3-782EB5E242C4}"));
uiapp.RegisterDockablePane(panoDockablePaneId, "PanoDockablePane", _panoPane as IDockablePaneProvider);

As you can see, I also do PanoDockablePane panoPane = new PanoDockablePane(); _panoPane = panoPane; // Sauvegarder l'instance

in order to call public method I made in my public partial class PanoDockablePane : System.Windows.Controls.UserControl, IDockablePaneProvider like SetupCamera or LoadPanoramaTexture

Then, in my public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) I've got this :

` // GUID de la DockablePane DockablePaneId dockablePaneId = new DockablePaneId(new Guid("{3C19FAAC-140C-4B24-A1B3-782EB5E242C4}"));

        // Récupérer la DockablePane
        DockablePane dockablePane = _uiapp.GetDockablePane(dockablePaneId);

        // Afficher la DockablePane si elle est trouvée
        if (dockablePane != null)
        {
            dockablePane.Show();
        }
        else
        {
            MessageBox.Show("Erreur : Impossible de trouver la DockablePane avec cet ID", "Erreur critique", MessageBoxButtons.OK, MessageBoxIcon.Error);
            return;
        }

#if DEBUG //Do nothing

#else PanoDockablePane panoPane = SettingUpRibbon.GetPanoDockablePane();

#endif

        panoPane.Fov = fov;
        panoPane.SetupCamera();
        panoPane.LoadPanoramaTexture(str_url, scanNamme);`

In Release Mode (using by AddInManager), if I do PanoDockablePane panoPane = SettingUpRibbon.GetPanoDockablePane(); I can do panoPane.SetupCamera(); and it works

BUT, in debug mode I've got an error in this line : PanoDockablePane panoPane = SettingUpRibbon.GetPanoDockablePane(); Wich is normal because AIM can't access to SettingUpRibbon!

But, in Debug mode, nothing happens with those lines:

panoPane.Fov = fov; panoPane.SetupCamera(); panoPane.LoadPanoramaTexture(str_url, scanNamme);

Do you know why?

SonaBIMDev avatar Oct 23 '24 16:10 SonaBIMDev