public void Activate(ApplicationAddInSite AddInSiteObject, bool FirstTime)
        {
            Trace.TraceInformation("Update Param Plugin: initializing... ");

            // Initialize AddIn members.
            m_inventorServer = AddInSiteObject.InventorServer;
            m_automation     = new SampleAutomation(m_inventorServer);
        }
        public void Activate(ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            Trace.TraceInformation(": UpdateParametersPlugin (" + Assembly.GetExecutingAssembly().GetName().Version.ToString(4) + "): initializing... ");

            // Initialize AddIn members.
            _inventorServer = addInSiteObject.InventorServer;
            Automation      = new UpdateParametersAutomation(_inventorServer);
        }
Пример #3
0
        public void Deactivate()
        {
            Marshal.ReleaseComObject(m_InventorServer);
            m_InventorServer = null;

            GC.Collect();
            GC.WaitForPendingFinalizers();
        }
Пример #4
0
        /// <summary>
        /// Opens box.ipt and runs SamplePlugin
        /// </summary>
        /// <param name="app"></param>
        private static void DebugSamplePlugin(InventorServer app)
        {
            // create an instance of ShrinkWrapPlugin
            ShrinkWrapPlugin.SampleAutomation plugin = new ShrinkWrapPlugin.SampleAutomation(app);

            // run the plugin
            plugin.RunWithArguments(null, null);
        }
 public void Deactivate()
 {
     Trace.TraceInformation(": CreateThumbnailPlugin: deactivating... ");
     // Release objects.
     Marshal.ReleaseComObject(_inventorServer);
     _inventorServer = null;
     GC.Collect();
     GC.WaitForPendingFinalizers();
 }
        public void Deactivate()
        {
            Trace.TraceInformation(": DA4I_BasicInfoPlugin: deactivating... ");

            // Release objects.
            Marshal.ReleaseComObject(m_inventorServer);
            m_inventorServer = null;

            GC.Collect();
            GC.WaitForPendingFinalizers();
        }
Пример #7
0
 public void Activate(ApplicationAddInSite addInSiteObject, bool firstTime)
 {
     // This method is called by Inventor when it loads the addin.
     // The AddInSiteObject provides access to the Inventor Application object.
     // The FirstTime flag indicates if the addin is loaded for the first time.
     Trace.TraceInformation("Activate IPT Param");
     // Initialize AddIn members.
     m_server     = addInSiteObject.InventorServer;
     m_automation = new Commands(m_server);
     // TODO: Add ApplicationAddInServer.Activate implementation.
     // e.g. event initialization, command creation etc.
 }
Пример #8
0
        public void Deactivate()
        {
            // This method is called by Inventor when the AddIn is unloaded.
            // The AddIn will be unloaded either manually by the user or
            // when the Inventor session is terminated

            // TODO: Add ApplicationAddInServer.Deactivate implementation

            // Release objects.
            Marshal.ReleaseComObject(m_server);
            m_server = null;

            GC.Collect();
            GC.WaitForPendingFinalizers();
        }
Пример #9
0
        /// <summary>
        /// Opens box.ipt and runs SamplePlugin
        /// </summary>
        /// <param name="app"></param>
        private static void DebugSamplePlugin(InventorServer app)
        {
            Document doc = null;

            // create a name value map
            Inventor.NameValueMap map = app.TransientObjects.CreateNameValueMap();

            // add parameters into the map, do not change "_1". You may add more parameters "_2", "_3"...
            //map.Add("_1", paramsPath);

            // create an instance of InventorIpartMakerDAPlugin
            InventorIpartMakerDAPlugin.SampleAutomation plugin = new InventorIpartMakerDAPlugin.SampleAutomation(app);

            // run the plugin
            plugin.RunWithArguments(doc, map);
        }
        /// <summary>
        /// Opens box.ipt and runs samplePlugin
        /// </summary>
        /// <param name="app"></param>
        private static void DebugSamplePlugin(InventorServer app)
        {
            // get solution directory
            string solutiondir        = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName;
            string inputFilesDir      = System.IO.Path.Combine(solutiondir, @"clientApp\inputFiles\");
            string inputFilesLocalDir = System.IO.Path.Combine(solutiondir, @"debugPluginLocally\inputFiles\");

            // get box.ipt absolute path
            string boxPath     = System.IO.Path.Combine(inputFilesDir, "box.ipt");
            string boxPathCopy = System.IO.Path.Combine(inputFilesLocalDir, "boxcopy.ipt");

            try
            {
                // delete an existing file
                System.IO.File.Delete(boxPathCopy);
            }
            catch (IOException)
            {
                Console.WriteLine("The specified file is in use. It might be open by Inventor");
                return;
            }

            // create a copy
            System.IO.File.Copy(boxPath, boxPathCopy);

            // open box.ipt by Inventor
            Document doc = app.Documents.Open(boxPathCopy);

            // get paramsSmall.json absolute path
            string paramsPathSmall = System.IO.Path.Combine(inputFilesDir, "paramsSmall.json");

            // get paramsLarge.json absolute path
            string paramsPathLarge = System.IO.Path.Combine(inputFilesDir, "paramsLarge.json");

            // create a name value map
            Inventor.NameValueMap map = app.TransientObjects.CreateNameValueMap();

            // add parameters into the map, do not change "_1". You may add more parameters "_2", "_3"...
            map.Add("_1", paramsPathSmall);
            map.Add("_2", paramsPathLarge);

            // create an instance of samplePlugin
            samplePlugin.SampleAutomation plugin = new samplePlugin.SampleAutomation(app);

            // run the plugin
            plugin.RunWithArguments(doc, map);
        }
Пример #11
0
        /// <summary>
        /// Opens box.ipt and runs SamplePlugin
        /// </summary>
        /// <param name="app"></param>
        private static void DebugSamplePlugin(InventorServer app)
        {
            //// get project directory
            //string projectdir = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName;

            //// get box.ipt absolute path
            //string boxPath = System.IO.Path.Combine(projectdir, @"Files\Workspaces\Workspace\Assemblies\Suspension", "Suspension.iam");

            //string boxPathCopy = System.IO.Path.Combine(projectdir, @"Files\Workspaces\Workspace\Assemblies\Suspension", "Suspension_copy.iam");

            //try
            //{
            //    // delete an existing file
            //    System.IO.File.Delete(boxPathCopy);
            //}
            //catch (IOException)
            //{
            //    Console.WriteLine("The specified file is in use. It might be open by Inventor");
            //    return;
            //}

            //// create a copy
            //System.IO.File.Copy(boxPath, boxPathCopy);

            //// open box.ipt by Inventor
            //Document doc = app.Documents.Open(boxPathCopy);

            //// get params.json absolute path
            //string paramsPath = System.IO.Path.Combine(projectdir, @"inputFiles\", "params.json");

            //// create a name value map
            //Inventor.NameValueMap map = app.TransientObjects.CreateNameValueMap();

            //// add parameters into the map, do not change "_1". You may add more parameters "_2", "_3"...
            //map.Add("_1", paramsPath);

            // create an instance of UpdateBomPlugin
            UpdateBomPlugin.SampleAutomation plugin = new UpdateBomPlugin.SampleAutomation(app);

            /// IMPORTANT ///
            /// You need to copy your dataset to this loocation: .\UpdateBom\DebugPluginLocally\bin\Debug
            /// All Inventor documents must be closed before this action
            ///

            // run the plugin
            plugin.Run(null, "Suspension");
        }
Пример #12
0
        /// <param name="app"></param>
        private static void DebugSamplePlugin(InventorServer app)
        {
            //NOTE:Posible enhancement: Create a copy of the main ipt file first and work with that

            // open rail-layout-copy.ipt by Inventor
            //Document doc = app.Documents.Open(sketchPath);

            // create a name value map
            Inventor.NameValueMap map = app.TransientObjects.CreateNameValueMap();
            //map.Add("_1", inputParamsPath);

            // create an instance of LayoutSketchServicePlugin
            LayoutSketchServicePlugin.SampleAutomation plugin = new LayoutSketchServicePlugin.SampleAutomation(app);

            // run the plugin
            plugin.RunWithArguments(null, map);
        }
Пример #13
0
        /// <summary>
        /// Opens box.ipt and runs SamplePlugin
        /// </summary>
        /// <param name="app"></param>
        private static void DebugSamplePlugin(InventorServer app)
        {
            // get project directory
            string projectdir = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName;

            //// get box.ipt absolute path
            //string boxPath = System.IO.Path.Combine(projectdir, @"inputFiles\", "box.ipt");

            //string boxPathCopy = System.IO.Path.Combine(projectdir, @"inputFiles\", "boxcopy.ipt");

            //try
            //{
            //    // delete an existing file
            //    System.IO.File.Delete(boxPathCopy);
            //}
            //catch (IOException)
            //{
            //    Console.WriteLine("The specified file is in use. It might be open by Inventor");
            //    return;
            //}

            //// create a copy
            //System.IO.File.Copy(boxPath, boxPathCopy);

            // open the top level assmebly in Inventor
            string   assemblyPath = System.IO.Path.Combine(projectdir, @"inputFiles\", "Wrench.iam");
            Document doc          = app.Documents.Open(assemblyPath);

            // get params.json absolute path
            string paramsPath = System.IO.Path.Combine(projectdir, @"inputFiles\", "params.json");

            // create a name value map
            Inventor.NameValueMap map = app.TransientObjects.CreateNameValueMap();

            // add parameters into the map, do not change "_1". You may add more parameters "_2", "_3"...
            map.Add("_1", paramsPath);

            // create an instance of DaWrenchConfigPlugin
            DaWrenchConfigPlugin.SampleAutomation plugin = new DaWrenchConfigPlugin.SampleAutomation(app);

            // run the plugin
            plugin.RunWithArguments(doc, map);
        }
Пример #14
0
        /// <summary>
        /// Opens box.ipt and runs SamplePlugin
        /// </summary>
        /// <param name="app"></param>
        private static void DebugSamplePlugin(InventorServer app)
        {
            // get project directory
            //string projectdir = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName;

            // get box.ipt absolute path
            //string boxPath = System.IO.Path.Combine(projectdir, @"inputFiles\", "box.ipt");

            //string boxPathCopy = System.IO.Path.Combine(projectdir, @"inputFiles\", "boxcopy.ipt");

            try
            {
                // delete an existing file
                //System.IO.File.Delete(boxPathCopy);
            }
            catch (IOException)
            {
                Console.WriteLine("The specified file is in use. It might be open by Inventor");
                return;
            }

            // create a copy
            //System.IO.File.Copy(boxPath, boxPathCopy);

            // open box.ipt by Inventor
            //Document doc = app.Documents.Open(boxPathCopy);

            // get params.json absolute path
            //string paramsPath = System.IO.Path.Combine(projectdir, @"inputFiles\", "params.json");

            // create a name value map
            Inventor.NameValueMap map = app.TransientObjects.CreateNameValueMap();

            // add parameters into the map, do not change "_1". You may add more parameters "_2", "_3"...
            //map.Add("_1", paramsPath);

            // create an instance of ExtractParamsPlugin
            ExtractParamsPlugin.SampleAutomation plugin = new ExtractParamsPlugin.SampleAutomation(app);

            // run the plugin
            plugin.IsLocalDebug = true;
            plugin.Run(app.Documents[1]);
        }
        static void Main(string[] args)
        {
            using (var inv = new InventorConnector())
            {
                InventorServer server = inv.GetInventorServer();

                try
                {
                    Console.WriteLine(DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss.ffff"));
                    Console.WriteLine("Running locally...");
                    // run the plugin
                    //inv.GetInventorApplication().SilentOperation = true;
                    DebugSamplePlugin(server);
                }
                catch (Exception e)
                {
                    string message = $"Exception: {e.Message}";
                    if (e.InnerException != null)
                    {
                        message += $"{System.Environment.NewLine}    Inner exception: {e.InnerException.Message}";
                    }

                    Console.WriteLine(message);
                }
                finally
                {
                    //inv.GetInventorApplication().SilentOperation = false;
                    if (System.Diagnostics.Debugger.IsAttached)
                    {
                        Console.WriteLine(DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss.ffff"));
                        Console.WriteLine("Press any key to exit. All documents will be closed.");
                        Console.ReadKey();
                    }
                }
            }
        }
Пример #16
0
 public UpdateDrawingsAutomation(InventorServer inventorApp)
 {
     inventorApplication = inventorApp;
 }
 public CreateThumbnailAutomation(InventorServer inventorApp) : base(inventorApp)
 {
 }
Пример #18
0
 public AutomationBase(InventorServer inventorApp)
 {
     _inventorApplication = inventorApp;
 }
Пример #19
0
 public Commands(InventorServer app)
 {
     m_server = app;
 }
Пример #20
0
 public SampleAutomation(InventorServer inventorServer)
 {
     Trace.TraceInformation("Starting sample plugin.");
     m_inventorServer = inventorServer;
 }
Пример #21
0
 public SampleAutomation(InventorServer app)
 {
     m_server = app;
 }
Пример #22
0
 public ExportBOMAutomation(InventorServer inventorApp) : base(inventorApp)
 {
 }
Пример #23
0
 protected AutomationBase(InventorServer inventorApp)
 {
     _inventorApplication = inventorApp;
 }
Пример #24
0
 public CreateThumbnailAutomation(InventorServer inventorApp)
 {
     inventorApplication = inventorApp;
 }
Пример #25
0
 public SatExportAutomation(InventorServer inventorApp) : base(inventorApp)
 {
 }
 public ExtractParametersAutomation(InventorServer inventorApp)
 {
     _inventorApplication = inventorApp;
 }
 public RFAExportRCEAutomation(InventorServer inventorApp) : base(inventorApp)
 {
 }
 public DataCheckerAutomation(InventorServer inventorApp) : base(inventorApp)
 {
 }
Пример #29
0
 public SampleAutomation(InventorServer inventorApp)
 {
     inventorApplication = inventorApp;
 }
 public Automation(InventorServer inventorApp) : base(inventorApp)
 {
 }