AnsweredAssumed Answered

More 7.9.x to VX translations

Question asked by andrew_french on Oct 12, 2015
Latest reply on Aug 15, 2016 by thomasle

I have a few library oriented scripts that run behind the scenes during off hours that I am having issues getting to work correctly in VX.  For example I have a script that finds parts with missing areas in DMS and then goes and calculates an area estimate based on the placement outline and then finally load the data back into dms.  Yeah it jumps around to different tools.

 

So in the background I am running things such as the part editor and the cell editor.  In 7.9.x this was not an issue as all my environment variables were set.  I figured this was going to be an easy fix, just run my script through the mgscript.exe terminal.  Well its not working for me.

 

I am using C#.  I do a simple test at first to verify the passed argument is indeed a valid library.  The library is definitely valid.  the code always fails on the first line in the try statement.  Running outside the mgscript environment I get told I'm missing a registered COM, inside the mgscript environment I get the message that it is not a valid library.  I'm not sure what I am doing wrong here.

 

        /// <summary>

        /// Basic test to see if arguments passed in are valid.  Tests to see if they are actually a recognizeable library

        /// </summary>

        /// <param name="lib">The library cache to test</param>

        /// <returns>

        /// True: library check passed

        /// False: Library check failed

        /// </returns>

        public static bool IsitaLibrary(string lib)

        {

            try

            {

                PartsEditorDlg PedApp = new PartsEditorDlg();

                PartsDB PedDoc = PedApp.OpenDatabaseEx(lib, true);

                PedApp.CloseActiveDatabase();

                PedApp.Quit();

                PedDoc = null;

                PedApp = null;

            }

            catch

            {

                return false;

            }

            return true;

        }

Outcomes