2 Replies Latest reply on Apr 9, 2014 2:52 PM by Marcin Pilat

    GUI similar to Simulation Addin

    Marcin Pilat

      How is it possible to create GUI components that are similar to the Simulation Addin as described below?


      When a new study is created using the Simulation Addin, a new tab is added to the model view. When this tab is selected, the model view stays the same (with some possible graphical modifications to it showing the simulation features) and a new view/control is added at the bottom of the feature manager view showing a tree.


      Adding a tab can be done using the DisplayWindowFromHandle Method of IModelViewManager but that has to take in a control and it will either show the control full screen (replacing the model view) or at the bottom splitting the whole window (as with the Motion Study) - this is controlled using the splitwindow boolean parameter. There doesn't seem to be an option to not show the control at all (or not have a control, just a tab) or to have the tab shown just under the feature manager view as is the case of the simulation addin's study.


      Any idea how this kind of GUI functionality can be done using the API?

        • Re: GUI similar to Simulation Addin
          Jesse Seger

          I believe you are looking for IModelViewManager::CreateFeatureMgrWindowFromHandle.


          Here is an example of loading a .net control from the documentation.



          public void WinFormInFeatureMgr()
                      IModelDoc2 pDoc;
                      pDoc = (IModelDoc2)iSwApp.ActiveDoc;
                      IModelViewManager swModelViewMgr;
                      swModelViewMgr = pDoc.ModelViewManager;
                      IFeatMgrView swFeatMgrTabTop;
                      FeatureMgrControl = new Form1();
                      swFeatMgrTabTop = swModelViewMgr.CreateFeatureMgrWindowFromHandle(cmdGroup.SmallIconList, (int)FeatureMgrControl.Handle.ToInt64(), "MyDotNetControl", (int)swFeatMgrPane_e.swFeatMgrPaneTop);
                      pDoc.FeatureManagerSplitterPosition = 0.5;
            • Re: GUI similar to Simulation Addin
              Marcin Pilat

              Thanks for the suggestion. I've already played with that and can successfully create feature manager tabs but that doesn't seem to be tied in any way to the model control tabs (at the bottom). None of the examples or API that I've seen is able to reproduce the behavior of the Simulation plugin.


              The desired behavior is as follows (note the "Static 1" control tab at the bottom and its corresponding window (with a tree) right under the feature manager windows - the splitter position is 0.0 in this case but it can be changed so that you would see two feature manager trees above the simulation specific window):


              And what the DisplayWindowFromHandle functionality produces is something like this (note the added control takes up a large part of the window at the bottom and there doesn't seem to be a way to adjust the splitter off that window using the API - this is a different splitter from the one between the freature manager trees):