Example #1
0
        public IMate(Inventor.Document oDoc, string name = "", string typ = "", string offset = "")
        {
            invApp = (Inventor.Application)oDoc.Parent;
            Doc    = (Document)oDoc.ActivatedObject;
            if (Doc == null)
            {
                Doc = oDoc;
            }
            CmdMgr = invApp.CommandManager;
            objs   = invApp.TransientObjects.CreateObjectCollection();
            InitializeComponent();
            XML    n;
            string filePath = @"C:\ProgramData\Autodesk\Inventor Addins\Imate.xml";

            if (!System.IO.File.Exists(filePath))
            {
                MessageBox.Show("Отсутствует файл " + filePath);
            }
            n    = new InvDoc.XML(filePath);
            data = new List <XMLData>();
            data = n.ReadXML("Imates");
            foreach (XMLData s in data)
            {
                this.comboBox3.Items.Add(s.val);
            }
            this.comboBox2.Text = offset;
            this.comboBox1.Text = typ;
            this.comboBox3.Text = name;
            //this.Deactivate += (sender, e) => MessageBox.Show("Deactivated!");
        }
Example #2
0
 public Settings()
 {
     try
     {
         InitializeComponent();
         reader = new XML(@"C:\ProgramData\Autodesk\Inventor Addins\Modules.xml");
         strs   = new System.Collections.Generic.List <string>();
         attr   = new List <string>();
         strs   = reader.ReadXML("Spec", ref attr);
         string[] names = attr.ToArray();
         lstbox.Items.AddRange(names);
         lstbox.CheckOnClick = true;
         bool check;
         for (int i = 0; i < lstbox.Items.Count; i++)
         {
             if (strs[i] == "1")
             {
                 check = true;
             }
             else
             {
                 check = false;
             }
             lstbox.SetItemChecked(i, check);
         }
         reader.Save();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }