예제 #1
0
        public string DetermineConfig(IEdmFile5 Part, IEdmVault7 vault, EdmCmdData file)
        {
            string retval = "@";

            EdmStrLst5 list = Part.GetConfigurations();

            IEdmPos5 pos = list.GetHeadPosition();

            Config_Select config = new Config_Select(vault, file);

            pos = list.GetHeadPosition();

            for (int i = 0; i < list.Count; i++)
            {

                config.config_cbo.Items.Add(list.GetNext(pos));

            }

            config.config_cbo.SelectedIndex = 0;

            config.ShowDialog();

            if (config.DialogResult == System.Windows.Forms.DialogResult.Cancel)
                return "";

            return retval;
        }
예제 #2
0
        public string DetermineConfig(IEdmFile5 Part, IEdmVault7 vault, string partnumber)
        {
            string retval = "@";

            EdmStrLst5 list = Part.GetConfigurations();

            IEdmPos5 pos = list.GetHeadPosition();

            Config_Select config = new Config_Select(vault, Part, partnumber);

            pos = list.GetHeadPosition();

            for (int i = 0; i < list.Count; i++)
            {
                string itemtoadd = list.GetNext(pos);

                if (itemtoadd != "@")
                    config.config_cbo.Items.Add(itemtoadd);
            }

            config.config_cbo.SelectedIndex = 0;

            config.ShowDialog();

            retval = config.SelectedConfig;

            if (config.DialogResult == System.Windows.Forms.DialogResult.Cancel)
                return "";

            return retval;
        }
예제 #3
0
        private static bool TryGetConfigurations(IEdmFile5 file, out List <string> cfgs)
        {
            cfgs = new List <string>();

            try
            {
                EdmStrLst5 cfgList = file.GetConfigurations();
                IEdmPos5   pos     = cfgList.GetHeadPosition();
                while (!pos.IsNull)
                {
                    string cfgName = cfgList.GetNext(pos);
                    cfgs.Add(cfgName);
                }

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
예제 #4
0
        public string DetermineConfig(IEdmFile5 Part, IEdmVault7 vault,EdmCmdData file, string SearchTerm)
        {
            string retval = "@";

            EdmStrLst5 list = Part.GetConfigurations();

            IEdmPos5 pos = list.GetHeadPosition();

            Config_Select config;

            if (SearchTerm != "")
                config = new Config_Select(vault, Part, SearchTerm);
            else
                config = new Config_Select(vault, file);

            for (int i = 0; i < list.Count; i++)
            {
                string name = list.GetNext(pos);

                    if (name != "@")
                    {
                        object number;

                        object area;

                        object mass;

                        IEdmEnumeratorVariable5 var = Part.GetEnumeratorVariable();

                        var.GetVar("Number", name, out number);

                        var.GetVar("NetWeight", name, out mass);

                        var.GetVar("SurfaceArea", name, out area);

                        if (number != null && mass != null && area != null)
                        {
                            config.config_cbo.Items.Add(name);
                        }
                    }
            }

            config.config_cbo.SelectedIndex = 0;

            config.ShowDialog();

            retval = config.SelectedConfig;

            if (config.DialogResult == System.Windows.Forms.DialogResult.Cancel)
                return "";

            return retval;
        }
예제 #5
0
        public SldAsm GetAsmIndoFromFile(IEdmVault5 poVault, string filePath)
        {
            IEdmFolder5 opParentFolder;
            IEdmFile5   poFile = poVault.GetFileFromPath(filePath, out opParentFolder);

            if (poFile == null)
            {
                return(null);
            }
            IEdmVariableMgr5 varMgr = (IEdmVariableMgr5)poVault;

            if (varMgr == null)
            {
                return(null);
            }

            IEdmEnumeratorVariable5 enumVar = poFile.GetEnumeratorVariable();

            if (enumVar == null)
            {
                return(null);
            }
            if (filePath == "")
            {
                return(null);
            }
            EdmStrLst5 cfgList = poFile.GetConfigurations();

            SldAsm asmPrd = new SldAsm();

            asmPrd.path  = filePath;
            asmPrd.amout = 1;


            if (varMgr.GetVariable("代号") != null)
            {
                object   tmpVar  = null;
                IEdmPos5 pos     = cfgList.GetHeadPosition();
                string   cfgName = null;
                while (!pos.IsNull)
                {
                    cfgName = cfgList.GetNext(pos);
                    enumVar.GetVar("代号", cfgName, out tmpVar);
                    if (tmpVar == null)
                    {
                        continue;
                    }
                    if (!tmpVar.ToString().Equals(""))
                    {
                        break;
                    }
                }
                if (tmpVar != null)
                {
                    asmPrd.number = tmpVar.ToString();
                }
                if (asmPrd.number.IndexOf(".") > 0 && asmPrd.number.IndexOf(".") < asmPrd.number.Length)
                {
                    asmPrd.ztdm = asmPrd.number.Substring(0, asmPrd.number.IndexOf("."));
                    asmPrd.zjdm = asmPrd.number.Substring(asmPrd.number.IndexOf(".") + 1);
                }
                else
                {
                    asmPrd.ztdm = asmPrd.zjdm = asmPrd.number;
                }
            }
            if (varMgr.GetVariable("名称") != null)
            {
                object   tmpVar  = null;
                IEdmPos5 pos     = cfgList.GetHeadPosition();
                string   cfgName = null;
                while (!pos.IsNull)
                {
                    cfgName = cfgList.GetNext(pos);
                    enumVar.GetVar("名称", cfgName, out tmpVar);
                    if (tmpVar == null)
                    {
                        continue;
                    }
                    if (!tmpVar.ToString().Equals(""))
                    {
                        break;
                    }
                }
                if (tmpVar != null)
                {
                    asmPrd.name = tmpVar.ToString();
                }
            }
            if (varMgr.GetVariable("设计") != null)
            {
                object   tmpVar  = null;
                IEdmPos5 pos     = cfgList.GetHeadPosition();
                string   cfgName = null;
                while (!pos.IsNull)
                {
                    cfgName = cfgList.GetNext(pos);
                    enumVar.GetVar("设计", cfgName, out tmpVar);
                    if (tmpVar == null)
                    {
                        continue;
                    }
                    if (!tmpVar.ToString().Equals(""))
                    {
                        break;
                    }
                }
                if (tmpVar != null)
                {
                    asmPrd.bzr = tmpVar.ToString();
                }
            }
            if (varMgr.GetVariable("设计日期") != null)
            {
                object   tmpVar  = null;
                IEdmPos5 pos     = cfgList.GetHeadPosition();
                string   cfgName = null;
                while (!pos.IsNull)
                {
                    cfgName = cfgList.GetNext(pos);
                    enumVar.GetVar("设计日期", cfgName, out tmpVar);
                    if (tmpVar == null)
                    {
                        continue;
                    }
                    if (!tmpVar.ToString().Equals(""))
                    {
                        break;
                    }
                }
                if (tmpVar != null)
                {
                    asmPrd.bzsj = tmpVar.ToString();
                }
                if (asmPrd.bzsj.IndexOf(" ") >= 0)
                {
                    asmPrd.bzsj = asmPrd.bzsj.Substring(0, asmPrd.bzsj.IndexOf(" "));
                }
            }
            if (varMgr.GetVariable("批准") != null)
            {
                object   tmpVar  = null;
                IEdmPos5 pos     = cfgList.GetHeadPosition();
                string   cfgName = null;
                while (!pos.IsNull)
                {
                    cfgName = cfgList.GetNext(pos);
                    enumVar.GetVar("批准", cfgName, out tmpVar);
                    if (tmpVar == null)
                    {
                        continue;
                    }
                    if (!tmpVar.ToString().Equals(""))
                    {
                        break;
                    }
                }
                if (tmpVar != null)
                {
                    asmPrd.pzr = tmpVar.ToString();
                }
            }
            if (varMgr.GetVariable("批准日期") != null)
            {
                object   tmpVar  = null;
                IEdmPos5 pos     = cfgList.GetHeadPosition();
                string   cfgName = null;
                while (!pos.IsNull)
                {
                    cfgName = cfgList.GetNext(pos);
                    enumVar.GetVar("批准日期", cfgName, out tmpVar);
                    if (tmpVar == null)
                    {
                        continue;
                    }
                    if (!tmpVar.ToString().Equals(""))
                    {
                        break;
                    }
                }
                if (tmpVar != null)
                {
                    asmPrd.pzsj = tmpVar.ToString();
                }
                if (asmPrd.pzsj.IndexOf(" ") >= 0)
                {
                    asmPrd.pzsj = asmPrd.pzsj.Substring(0, asmPrd.pzsj.IndexOf(" "));
                }
            }
            if (varMgr.GetVariable("阶段标记") != null)
            {
                object   tmpVar  = null;
                IEdmPos5 pos     = cfgList.GetHeadPosition();
                string   cfgName = null;
                while (!pos.IsNull)
                {
                    cfgName = cfgList.GetNext(pos);
                    enumVar.GetVar("阶段标记", cfgName, out tmpVar);
                    if (tmpVar == null)
                    {
                        continue;
                    }
                    if (!tmpVar.ToString().Equals(""))
                    {
                        break;
                    }
                }
                if (tmpVar != null)
                {
                    asmPrd.jdbj = tmpVar.ToString();
                }
            }

            if (varMgr.GetVariable("设备型号") != null)
            {
                object   tmpVar  = null;
                IEdmPos5 pos     = cfgList.GetHeadPosition();
                string   cfgName = null;
                while (!pos.IsNull)
                {
                    cfgName = cfgList.GetNext(pos);
                    enumVar.GetVar("设备型号", cfgName, out tmpVar);
                    if (tmpVar == null)
                    {
                        continue;
                    }
                    if (!tmpVar.ToString().Equals(""))
                    {
                        break;
                    }
                }
                if (tmpVar != null)
                {
                    asmPrd.sbxh = tmpVar.ToString();
                }
            }
            if (varMgr.GetVariable("Project Name") != null)
            {
                object   tmpVar  = null;
                IEdmPos5 pos     = cfgList.GetHeadPosition();
                string   cfgName = null;
                while (!pos.IsNull)
                {
                    cfgName = cfgList.GetNext(pos);
                    enumVar.GetVar("Project Name", cfgName, out tmpVar);
                    if (tmpVar == null)
                    {
                        continue;
                    }
                    if (!tmpVar.ToString().Equals(""))
                    {
                        break;
                    }
                }
                if (tmpVar != null)
                {
                    asmPrd.projName = tmpVar.ToString();
                }
            }
            return(asmPrd);
        }