Esempio n. 1
0
 private void InputEvents_OnSelectionChange(ref Inventor.AssemblyDocument AssemblyDocument, ref Inventor.ObjectsEnumerator JustSelected)
 {
     if (AssemblyDocument != null || JustSelected != null)
     {
         UIJustSelectedObjects = JustSelected;
         UIAssemblyDocument    = AssemblyDocument;
     }
 }
Esempio n. 2
0
        private void UserInputEvents_OnSelect(Inventor.ObjectsEnumerator JustSelectedEntities, ref Inventor.ObjectCollection MoreSelectedEntities, Inventor.SelectionDeviceEnum SelectionDevice, Inventor.Point ModelPosition, Inventor.Point2d ViewPosition, Inventor.View View)
        {
            if (View.Parent != null)
            {
                Inventor.Document         Document         = (Inventor.Document)View.Parent;
                Inventor.AssemblyDocument AssemblyDocument = (Inventor.AssemblyDocument)Document;

                if (JustSelectedEntities.Count > 0)
                {
                    for (int i = JustSelectedEntities.Count; i >= 1; i--)
                    {
                        GetInventorObjType(JustSelectedEntities[i]);
                    }
                }
            }
        }
Esempio n. 3
0
        private void UserInputEvents_OnSelect(Inventor.ObjectsEnumerator JustSelectedEntities, ref Inventor.ObjectCollection MoreSelectedEntities, Inventor.SelectionDeviceEnum SelectionDevice, Inventor.Point ModelPosition, Inventor.Point2d ViewPosition, Inventor.View View)
        {
            if (View.Parent != null)
            {
                Inventor.Document Document = (Inventor.Document)View.Parent;
                if (Document.DocumentType == Inventor.DocumentTypeEnum.kAssemblyDocumentObject)
                {
                    Inventor.AssemblyDocument AssemblyDocument = (Inventor.AssemblyDocument)Document;

                    OnSelectionChange(ref AssemblyDocument, ref MoreSelectedEntities);
                }
                else
                {
                    Inventor.AssemblyDocument AssemblyDocument = null;
                    JustSelectedEntities = null;
                    OnSelectionChange(ref AssemblyDocument, ref MoreSelectedEntities);
                }
            }
        }
Esempio n. 4
0
        //CGroup Group;
        //String NamedGroup = "GroupObject";
        //String Number = "01";
        public UserGUI()
        {
            InitializeComponent();
            try
            {
                m_InvApplication = (Inventor.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application");
            }
            catch
            {
                if (System.Windows.Forms.MessageBox.Show("Trying to Open a new instance of Autodesk Inventor", "Inventor Error", System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Question) != System.Windows.Forms.DialogResult.OK)
                {
                    return; //To Caller
                }
            }
            if (m_InvApplication == null)
            {
                try
                {
                    Type inventorAppType = System.Type.GetTypeFromProgID("Inventor.Application");
                    m_InvApplication         = System.Activator.CreateInstance(inventorAppType) as Inventor.Application;
                    m_InvApplication.Visible = bInventorVisable;
                    // _started = true;
                }
                catch
                {
                    System.Windows.Forms.MessageBox.Show("Can Not Open Autodesk Inventor " + Environment.NewLine + "See Your Administrator", "Instalation Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Question);
                    //  _started = false;
                    return;
                }
            }
            //_started = true;
            // Group = new CGroup();
            InputEvents = new CInventorInputEvents(m_InvApplication);

            InputEvents.OnSelectionChange += new CInventorInputEvents.CInventorEvents_OnSelect_DelegateHandler(InputEvents_OnSelectionChange);
            UIJustSelectedObjects          = null;
            UIAssemblyDocument             = null;
            GetApplicationHighLightColour();
        }
Esempio n. 5
0
        private static void AddAttributes(ref Inventor.ObjectsEnumerator JustSelected, ref Inventor.AssemblyDocument assemblyDocument)
        {
            int length = JustSelected.Count;

            for (int i = length - 1; i >= 1; i--)
            {
                if (GetInventorObjType(JustSelected[i]) == Inventor.ObjectTypeEnum.kComponentOccurrenceObject)
                {
                    System.Diagnostics.Debug.WriteLine("Just Selected");
                    Inventor.ComponentOccurrence componentOccurrence = JustSelected[i];
                    ColourOccurance(ref assemblyDocument, ref componentOccurrence, "Red");
                }
                else if (GetInventorObjType(JustSelected[i]) == Inventor.ObjectTypeEnum.kRectangularOccurrencePatternObject)
                {
                    Inventor.OccurrencePattern OccurrencePattern = JustSelected[i];
                    int PatternLength = 10;
                    //OccurrencePattern.OccurrencePatternElements.
                    for (int x = PatternLength - 1; x >= 1; x--)
                    {
                    }
                }
            }
        }
Esempio n. 6
0
 private void UserInputEvents_OnUnSelect(Inventor.ObjectsEnumerator UnSelectedEntities, Inventor.SelectionDeviceEnum SelectionDevice, Inventor.Point ModelPosition, Inventor.Point2d ViewPosition, Inventor.View View)
 {
     // MessageBox.Show("On UnSelect");
 }
Esempio n. 7
0
 private void UserInputEvents_OnDoubleClick(Inventor.ObjectsEnumerator SelectedEntities, Inventor.SelectionDeviceEnum SelectionDevice, Inventor.MouseButtonEnum Button, Inventor.ShiftStateEnum ShiftKeys, Inventor.Point ModelPosition, Inventor.Point2d ViewPosition, Inventor.View View, Inventor.NameValueMap AdditionalInfo, out Inventor.HandlingCodeEnum HandlingCode)
 {
     HandlingCode = Inventor.HandlingCodeEnum.kEventHandled;
     //MessageBox.Show("On Double Click");
 }
Esempio n. 8
0
        public static void DrawRangeBoxs(ref Inventor.Application Inv_Application, ref Inventor.AssemblyDocument assemblyDocument, Inventor.ObjectsEnumerator justSelectedEntities)
        {
            //Inventor.ComponentDefinition componentDefinition = (Inventor.ComponentDefinition)assemblyDocument.ComponentDefinition;

            if (justSelectedEntities.Count >= 1)
            {
                if (assemblyDocument.GraphicsDataSetsCollection.Count >= 1)
                {
                    int length = justSelectedEntities.Count;
                    for (int i = length - 1; i >= 0; i--)
                    {
                        if (GetInventorObjType(justSelectedEntities[i]) == Inventor.ObjectTypeEnum.kComponentOccurrenceObject)
                        {
                            Inventor.Box box = null;
                            System.Diagnostics.Debug.WriteLine("Just Selected");
                            Inventor.ComponentOccurrence componentOccurrence = justSelectedEntities[i];
                            box = componentOccurrence.RangeBox;
                        }
                        //else if (GetInventorObjType(justSelectedEntities[i]) == Inventor.ObjectTypeEnum.kRectangularOccurrencePatternObject)
                        //{
                        //    Inventor.OccurrencePattern OccurrencePattern = justSelectedEntities[i];
                        //    int PatternLength = 10;
                        //    for (int x = PatternLength - 1; x >= 1; x--)
                        //    {
                        //    }
                        //} use after idea tested
                    }
                }
                else
                {
                    Inventor.ClientGraphics clientGraphics = assemblyDocument.ComponentDefinition.ClientGraphicsCollection["RangeID"];
                    assemblyDocument.GraphicsDataSetsCollection["RangeID"].Delete();
                    clientGraphics.Delete();
                }
            }
            else
            {
                return;
            }
        }
Esempio n. 9
0
        //public CClientGraphic(ref Inventor.AssemblyDocument assemblyDocument)
        //{
        //   // Inventor.ClientGraphicsCollection clientGraphicsCollection;
        //    //ClientGraphics

        //}

        public static void DrawRangBox(ref Inventor.Application Inv_Application, ref Inventor.AssemblyDocument assemblyDocument, Inventor.ObjectsEnumerator justSelectedEntities)
        {
            //Inventor.ComponentDefinition componentDefinition = (Inventor.ComponentDefinition)assemblyDocument.ComponentDefinition;
            if (justSelectedEntities.Count >= 1)
            {
                if (assemblyDocument.GraphicsDataSetsCollection.Count >= 1)
                {
                }
                else
                {
                    Inventor.ClientGraphics clientGraphics = assemblyDocument.ComponentDefinition.ClientGraphicsCollection["RangeID"];
                    assemblyDocument.GraphicsDataSetsCollection["RangeID"].Delete();
                    clientGraphics.Delete();
                }
            }
            else
            {
                return;
            }
        }