Exemple #1
1
		public Form1(Inventor.Application oApp)
		{
			
			// This call is required by the Windows Form Designer.
			InitializeComponent();
			
			// Add any initialization after the InitializeComponent() call.
			_macros = new Macros(oApp);
			
			MemberInfo[] methods = _macros.GetType().GetMembers();
			
			foreach (MemberInfo member in methods)
			{
				if (member.DeclaringType.Name == "Macros" && member.MemberType == MemberTypes.Method)
				{
					ComboBoxMacros.Items.Add(member.Name);
				}
			}
			
			if (ComboBoxMacros.Items.Count > 0)
			{
				ComboBoxMacros.SelectedIndex = 0;
				Button1.Enabled = true;
			}
			
		}
Exemple #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                _InvApplication = (Inventor.Application)Marshal.GetActiveObject("Inventor.Application");
            }
            catch(Exception ex)
            {
                MessageBox.Show("make sure an Inventor instance is launched!");
                return;
            }

            // Add any initialization after the InitializeComponent() call.
            _macros = new Macros(_InvApplication);

            MemberInfo[] methods = _macros.GetType().GetMembers();

            foreach (MemberInfo member in methods)
            {
                if ((member.DeclaringType.Name == "Macros" & member.MemberType == MemberTypes.Method))
                {
                    ComboBoxMacros.Items.Add(member.Name);
                }
            }

            if (ComboBoxMacros.Items.Count > 0)
            {
                ComboBoxMacros.SelectedIndex = 0;
                button1.Enabled = true;
            }


            //=======================================================
            //Service provided by Telerik (www.telerik.com)
            //Conversion powered by NRefactory.
            //Built and maintained by Todd Anglin and Telerik
            //=======================================================

        }