Ejemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                _InvApplication = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application") as Inventor.Application;
            }

            catch
            {
                Type inventorAppType = System.Type.GetTypeFromProgID("Inventor.Application");
                _InvApplication = System.Activator.CreateInstance(inventorAppType) as Inventor.Application;
            }

            _InvApplication.Visible = true;

            string addInCLSID = "{28e1f9bc-44fb-464c-ba98-e9c14c7eed44}";

            Inventor.ApplicationAddIn addIn = _InvApplication.ApplicationAddIns.get_ItemById(addInCLSID.ToUpper());

            //Make sure addin is activated
            if (!addIn.Activated)
            {
                addIn.Activate();
            }

            _InvAddInInterface = addIn.Automation as HelloWorldCS.AutomationInterface;
        }
Ejemplo n.º 2
0
        private void Setting_Load(object sender, EventArgs e)
        {
            try
            {
                _InvApplication = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application") as Inventor.Application;
            }

            catch
            {
                Type inventorAppType = System.Type.GetTypeFromProgID("Inventor.Application");
                _InvApplication = System.Activator.CreateInstance(inventorAppType) as Inventor.Application;
            }

            _InvApplication.Visible = true;

            string addInCLSID = "{55488e4a-45de-4630-a00c-b31e0eb17ba8}";

            Inventor.ApplicationAddIn addIn = _InvApplication.ApplicationAddIns.get_ItemById(addInCLSID.ToUpper());

            //Make sure addin is activated
            if (!addIn.Activated)
            {
                addIn.Activate();
            }
            // _InvAddInInterface = addIn.Automation as InventorViewsServer.IAutomationInterface;
        }