ADNExplodeGeometry.ADN_Utility.ClearProgressControl C# (CSharp) Method

ClearProgressControl() public static method

Cleanup progress control
public static ClearProgressControl ( ExplodeGeomUserControl1 ctrlProgress ) : void
ctrlProgress ExplodeGeomUserControl1 Input the progress control to clear.
return void
        public static void ClearProgressControl(ExplodeGeomUserControl1 ctrlProgress)
        {
            m_bUsingProgress = false;
            m_ctrlProgress = null;
        }

Usage Example

Example #1
0
        private void m_btnExplodeIt_Click(object sender, RoutedEventArgs e)
        {
            //
            IGlobal      global = Autodesk.Max.GlobalInterface.Instance;
            IInterface14 ip     = global.COREInterface14;

            this.m_pnlProgressPanel.Visibility = System.Windows.Visibility.Visible;

            try
            {
                global.TheHold.Begin();

                ADN_Utility.SetProgressControl(this);

                bool convertPoly = EI_ConvertTypePoly; // true = poly, false = tri
                bool attemptConvert;
                if (convertPoly)
                {
                    attemptConvert = EI_AttemptConvertToPoly;
                }
                else
                {
                    attemptConvert = EI_AttemptConvertToTri;
                }
                bool  addShell      = EI_AddShellModifier;
                float shellAmount   = EI_ShellAmount;
                bool  addEditMesh   = EI_AddEditMeshModifier;
                bool  collapseStack = EI_CollapseStack;
                bool  deleteNode    = EI_DeleteOriginal;

                //ip.DisableSceneRedraw();
                int stat         = 0;
                int nNumSelNodes = ip.SelNodeCount;
                m_lblTotNode.Content = nNumSelNodes.ToString();

                for (int i = 0; i < nNumSelNodes; i++)
                {
                    IINode nodeCur = ip.GetSelNode(i);
                    m_lblNodeName.Content = nodeCur.Name;
                    m_lblCurrNode.Content = i + 1;
                    if (convertPoly)
                    {
                        stat = ADN_Utility.ConvertToPolygonFaces(nodeCur.Handle, attemptConvert, addShell, shellAmount, addEditMesh, collapseStack);
                        if (stat < 0)
                        {
                            break;
                        }
                    }
                    else
                    {
                        stat = ADN_Utility.ConvertToTriangleFaces(nodeCur.Handle, attemptConvert, addShell, shellAmount, addEditMesh, collapseStack);
                        if (stat < 0)
                        {
                            break;
                        }
                    }
                }


                if (stat < 0)
                {
                    global.TheHold.Cancel();
                }
                else
                {
                    // now we need to start at the top to delete the original nodes.
                    if (deleteNode)
                    {
                        IINodeTab tabNodes = global.INodeTabNS.Create();
                        ip.GetSelNodeTab(tabNodes);
                        if (tabNodes != null)
                        {
                            ip.DeleteNodes(tabNodes, true, true, false);
                        }
                    }
                    global.TheHold.Accept("ADN-PolygonExplode");
                }

                ip.RedrawViews(0, RedrawFlags.Normal, null);
            }
            catch
            {
                global.TheHold.Cancel();
            }

            this.m_pnlProgressPanel.Visibility = System.Windows.Visibility.Hidden;
            ADN_Utility.ClearProgressControl(this);

            m_winParent.Close();
            m_bOk = true;
        }