private void m_BrowserEvents_OnBrowserNodeGetDisplayObjects(object BrowserNodeDefinition, ref Inventor.ObjectCollection Objects, Inventor.NameValueMap Context, ref Inventor.HandlingCodeEnum HandlingCode)
        {
            PartDocument            oPartDocument = m_inventorApplication.ActiveDocument as PartDocument;
            PartComponentDefinition oPartDef      = oPartDocument.ComponentDefinition;

            if (oHighlight == null)
            {
                oHighlight = oPartDocument.CreateHighlightSet();
            }
            else
            {
                oHighlight.Clear();
            }

            Inventor.Color oColor = default(Inventor.Color);
            oColor = m_inventorApplication.TransientObjects.CreateColor(128, 22, 22);

            // Set the opacity
            oColor.Opacity   = 0.8;
            oHighlight.Color = oColor;

            if (BrowserNodeDefinition is ClientBrowserNodeDefinition)
            {
                ClientBrowserNodeDefinition oClientB = (ClientBrowserNodeDefinition)BrowserNodeDefinition;
                //highlight all ExtrudeFeature
                if (oClientB.Label == "Node2")
                {
                    foreach (ExtrudeFeature oExtrudeF in oPartDef.Features.ExtrudeFeatures)
                    {
                        oHighlight.AddItem(oExtrudeF);
                    }
                    //highlight all RevolveFeature
                }
                else if (oClientB.Label == "Node3")
                {
                    foreach (RevolveFeature oRevolveF in oPartDef.Features.RevolveFeatures)
                    {
                        oHighlight.AddItem(oRevolveF);
                    }
                }
            }
        }
Пример #2
0
        private void m_BrowserEvents_OnBrowserNodeGetDisplayObjects(object BrowserNodeDefinition, ref Inventor.ObjectCollection Objects, Inventor.NameValueMap Context, ref Inventor.HandlingCodeEnum HandlingCode)
        {
             PartDocument oPartDocument = m_inventorApplication.ActiveDocument as PartDocument;
             PartComponentDefinition oPartDef = oPartDocument.ComponentDefinition;

             if (oHighlight == null) {
              oHighlight = oPartDocument.CreateHighlightSet();
             } else {
              oHighlight.Clear();
             }

             Inventor.Color oColor = default(Inventor.Color);
             oColor = m_inventorApplication.TransientObjects.CreateColor(128, 22, 22);

             // Set the opacity
             oColor.Opacity = 0.8;
             oHighlight.Color = oColor;

             if (BrowserNodeDefinition is ClientBrowserNodeDefinition) {
              ClientBrowserNodeDefinition oClientB = (ClientBrowserNodeDefinition)BrowserNodeDefinition;
              //highlight all ExtrudeFeature
              if (oClientB.Label == "Node2") {
       
               foreach ( ExtrudeFeature oExtrudeF in oPartDef.Features.ExtrudeFeatures) {
                oHighlight.AddItem(oExtrudeF);
               }
              //highlight all RevolveFeature
              } else if (oClientB.Label == "Node3") {
         
               foreach ( RevolveFeature oRevolveF in oPartDef.Features.RevolveFeatures) {
                oHighlight.AddItem(oRevolveF);
               }
              }
             }

        }