当前位置: 首页>>代码示例>>C#>>正文


C# ModelDoc2.IGetActiveConfiguration方法代码示例

本文整理汇总了C#中ModelDoc2.IGetActiveConfiguration方法的典型用法代码示例。如果您正苦于以下问题:C# ModelDoc2.IGetActiveConfiguration方法的具体用法?C# ModelDoc2.IGetActiveConfiguration怎么用?C# ModelDoc2.IGetActiveConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ModelDoc2的用法示例。


在下文中一共展示了ModelDoc2.IGetActiveConfiguration方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReloadAllSetParameters


//.........这里部分代码省略.........

                            #region Если есть objects

                            if (oleSchem.Rows.Cast<DataRow>().Any(
                                row => (string)row["TABLE_NAME"] == "objects"))
                            {
                                _chkMeasure = new CheckBox
                                {
                                    Appearance = Appearance.Button,
                                    Location = new Point(133, 12),
                                    Name = @"chkMeasure",
                                    Size = new Size(80, 24),
                                    Text = @"Измерить",
                                    TextAlign = ContentAlignment.MiddleCenter,
                                    UseVisualStyleBackColor = true
                                };
                                tbpParams.Controls.Add(_chkMeasure);
                                _chkMeasure.CheckedChanged += StartMeasure;

                                i = 0;

                                bool isNumber = false, isIdSlave = false, isAsmConfig = false, isFixedValues = false;

                                #region Dimension Configuration

                                if (
                                    oleSchem.Rows.Cast<DataRow>().Any(
                                        row => (string)row["TABLE_NAME"] == "dimension_conf"))
                                {
                                    cm = new OleDbCommand("SELECT * FROM dimension_conf ORDER BY id", oleDb);
                                    rd = cm.ExecuteReader();
                                    var outComps = new LinkedList<Component2>();
                                    if (_mSwAddin.GetComponents(
                                        _swSelModel.IGetActiveConfiguration().IGetRootComponent2(),
                                        outComps, true, false))
                                    {
                                        _dimensionConfig = Decors.GetListComponentForDimension(_mSwAddin, rd,
                                                                                               outComps);
                                        _dimensionConfig.Sort((x, y) => x.Number.CompareTo(y.Number));
                                        rd.Close();
                                    }
                                }
                                #endregion

                                var thisDataSet = new DataSet();
                                var testAdapter = new OleDbDataAdapter("SELECT * FROM objects", oleDb);
                                testAdapter.Fill(thisDataSet, "objects");
                                testAdapter.Dispose();
                                bool captConfigBool = thisDataSet.Tables["objects"].Columns.Contains("captConf");
                                foreach (var v in thisDataSet.Tables["objects"].Columns)
                                {
                                    var vc = (DataColumn)v;
                                    if (vc.ColumnName == "number")
                                        isNumber = true;
                                    if (vc.ColumnName == "idslave")
                                    {
                                        if (vc.DataType.Name != "String")
                                            MessageBox.Show(
                                                @"Неверно указан тип данных в столбце 'ismaster'",
                                                _mSwAddin.MyTitle, MessageBoxButtons.OK,
                                                MessageBoxIcon.Information);
                                        isIdSlave = true;
                                    }
                                    if (vc.ColumnName == "mainasmconf" &&
                                        _swSelModel.GetConfigurationCount() > 1)
                                        isAsmConfig = true;
开发者ID:digger1985,项目名称:MyCode,代码行数:67,代码来源:frmSetParameters.cs

示例2: execQueryNonProduct

        private decimal execQueryNonProduct(string sql, ModelDoc2 swSelModel)
        {
            string currentConfig = swSelModel.IGetActiveConfiguration().Name;
            if (currentConfig.ToLower().Contains("по умолчани") || currentConfig.ToLower().Contains("default"))
                currentConfig = string.Empty;
            string articul = swSelModel.GetCustomInfoValue(currentConfig, "Articul");
            if (string.IsNullOrEmpty(articul))
            {
                articul = swSelModel.GetCustomInfoValue(string.Empty, "Articul");
                if (string.IsNullOrEmpty(articul))
                    throw new ArticleNotFoundException("Отсутствует артикул!", swSelModel);
            }
            int size1Work = 0, size2Work = 0, size1 = 0, size2 = 0;
            string idColor1 = string.Empty, idColor2 = string.Empty, idColor3 = string.Empty, faner11 = string.Empty, faner12 = string.Empty, faner21 = string.Empty, faner22 = string.Empty, colorfaner11 = string.Empty, colorfaner12 = string.Empty, colorfaner21 = string.Empty, colorfaner22 = string.Empty;
            FillForNonProductQuery(swSelModel, string.Empty, ref size1, ref size2, ref size1Work, ref size2Work, ref idColor1, ref idColor2, ref idColor3, ref faner11, ref faner12, ref faner21, ref faner22, ref colorfaner11, ref colorfaner12, ref colorfaner21, ref colorfaner22);
            if (currentConfig != string.Empty)
                FillForNonProductQuery(swSelModel, currentConfig, ref size1, ref size2, ref size1Work, ref size2Work, ref idColor1, ref idColor2, ref idColor3, ref faner11, ref faner12, ref faner21, ref faner22, ref colorfaner11, ref colorfaner12, ref colorfaner21, ref colorfaner22);

            using (OracleCommand cmd = new OracleCommand(sql))
            {
                cmd.Connection = Connection;
                cmd.CommandType = CommandType.Text;
                cmd.BindByName = true;
                cmd.Parameters.Add(new OracleParameter("P_NUMAGREE", _orderNumber));//"040714-1255-0101"));
                cmd.Parameters.Add(new OracleParameter("P_IDCOMPONENT", articul));
                cmd.Parameters.Add(new OracleParameter("P_SIZE1", size1));
                cmd.Parameters.Add(new OracleParameter("P_SIZE2", size2));
                var curPrm = new OracleParameter("P_SIZE1WORK", OracleDbType.Int32, ParameterDirection.Input);
                curPrm.Value = size1Work;
                cmd.Parameters.Add(curPrm);
                curPrm = new OracleParameter("P_SIZE2WORK", OracleDbType.Int32, ParameterDirection.Input);
                curPrm.Value = size2Work;
                cmd.Parameters.Add(curPrm);
                cmd.Parameters.Add(new OracleParameter("P_IDCOLOR1", idColor1));
                cmd.Parameters.Add(new OracleParameter("P_IDCOLOR2", idColor2));
                cmd.Parameters.Add(new OracleParameter("P_IDCOLOR3", idColor3));
                cmd.Parameters.Add(new OracleParameter("P_IDFANER11", faner11));
                cmd.Parameters.Add(new OracleParameter("P_IDFANER12", faner12));
                cmd.Parameters.Add(new OracleParameter("P_IDCOLORFANER11", colorfaner11));
                cmd.Parameters.Add(new OracleParameter("P_IDCOLORFANER12", colorfaner12));
                cmd.Parameters.Add(new OracleParameter("P_IDFANER21", faner21));
                cmd.Parameters.Add(new OracleParameter("P_IDFANER22", faner22));
                cmd.Parameters.Add(new OracleParameter("P_IDCOLORFANER21", colorfaner21));
                cmd.Parameters.Add(new OracleParameter("P_IDCOLORFANER22", colorfaner22));
                cmd.Parameters.Add(new OracleParameter("P_ITPRODCALCPARENT", DBNull.Value));
                OracleDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    if (reader["PRICE"] is decimal)
                        return (decimal)reader["PRICE"];
                    else
                        return 0;
                }
                else
                    throw new Exception("Ошибка соединения с БД.");
            }
        }
开发者ID:digger1985,项目名称:MyCode,代码行数:57,代码来源:Repository.cs

示例3: execQueryProduct

        //через открытое соединение
        private decimal execQueryProduct(string sql, ModelDoc2 swSelModel)
        {
            string currentConfig = swSelModel.IGetActiveConfiguration().Name;
            if (currentConfig.ToLower().Contains("по умолчани") || currentConfig.ToLower().Contains("default"))
                currentConfig = string.Empty;
            string articul = swSelModel.GetCustomInfoValue(currentConfig, "Articul");
            if (string.IsNullOrEmpty(articul))
            {
                articul = swSelModel.GetCustomInfoValue(string.Empty, "Articul");
                if (string.IsNullOrEmpty(articul))
                    throw new ArticleNotFoundException("Отсутствует артикул!", swSelModel);
            }
            int size1 = 0, size2 = 0, size3 = 0, size4 = 0, size5 = 0, size6 = 0, size7 = 0, size8 = 0;
            string idColor1 = string.Empty, idColor2 = string.Empty, idColor3 = string.Empty, idColor4 = string.Empty, idColor5 = string.Empty;
            FillForProductQuery(swSelModel, string.Empty, ref size1, ref size2, ref size3, ref size4, ref size5, ref size6, ref size7, ref size8, ref idColor1, ref idColor2, ref idColor3, ref idColor4, ref idColor5);
            if (currentConfig != string.Empty)
                FillForProductQuery(swSelModel, currentConfig, ref size1, ref size2, ref size3, ref size4, ref size5, ref size6, ref size7, ref size8, ref idColor1, ref idColor2, ref idColor3, ref idColor4, ref idColor5);

            using (OracleCommand cmd = new OracleCommand(sql))
            {
                cmd.Connection = Connection;
                cmd.CommandType = CommandType.Text;
                cmd.BindByName = true;
                cmd.Parameters.Add(new OracleParameter("P_NUMAGREE", _orderNumber));//"040714-1255-0101"));
                cmd.Parameters.Add(new OracleParameter("P_IDCOMPONENT", articul));
                cmd.Parameters.Add(new OracleParameter("P_SIZE1", size1));
                cmd.Parameters.Add(new OracleParameter("P_SIZE2", size2));
                cmd.Parameters.Add(new OracleParameter("P_SIZE3", size3));
                cmd.Parameters.Add(new OracleParameter("P_SIZE4", size4));
                cmd.Parameters.Add(new OracleParameter("P_SIZE5", size5));
                cmd.Parameters.Add(new OracleParameter("P_SIZE6", size6));
                cmd.Parameters.Add(new OracleParameter("P_SIZE7", size7));
                cmd.Parameters.Add(new OracleParameter("P_SIZE8", size8));

                cmd.Parameters.Add(new OracleParameter("P_IDCOLOR1", idColor1));
                cmd.Parameters.Add(new OracleParameter("P_IDCOLOR2", idColor2));
                cmd.Parameters.Add(new OracleParameter("P_IDCOLOR3", idColor3));
                cmd.Parameters.Add(new OracleParameter("P_IDCOLOR4", idColor4));
                cmd.Parameters.Add(new OracleParameter("P_IDCOLOR5", idColor5));

                OracleDataReader reader = cmd.ExecuteReader();

                if (reader.Read())
                {
                    if (reader["PRICE"] is decimal)
                        return (decimal)reader["PRICE"];
                    else
                        throw new Exception("Неправильный результат цены:" + reader["PRICE"]);
                }
                else
                    throw new Exception("Ошибка соединения с БД.");
            }
        }
开发者ID:digger1985,项目名称:MyCode,代码行数:54,代码来源:Repository.cs

示例4: FixColorForEachComponent

        private void FixColorForEachComponent(ModelDoc2 model, Component2 component, string file,
                                              LinkedList<ModelDoc2> models)
        {
            try
            {
                var swConfig = model.IGetActiveConfiguration();
                object displayStateNames = swConfig.GetDisplayStates();
                var dispNames = (string[])displayStateNames;

                var mod = component.IGetModelDoc();
                if (mod != null && mod.GetType() == (int)swDocumentTypes_e.swDocASSEMBLY && models.Contains(mod))
                {
                    if (component.SetTextureByDisplayState(dispNames[0], mod.Extension.CreateTexture(file, 1, 0, false)))
                        component.RemoveTextureByDisplayState(dispNames[0]);

                    var assembly = (AssemblyDoc)mod;
                    var oComps = assembly.GetComponents(true);
                    foreach (var oComp in oComps)
                    {
                        var comp = (Component2)oComp;
                        FixColorForEachComponent(mod, comp, file, models);
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
开发者ID:digger1985,项目名称:MyCode,代码行数:29,代码来源:SwAddin.cs

示例5: getPriceForComponent

        private void getPriceForComponent(ModelDoc2 model, bool ParentCalcStruct, Action<decimal> nextPrice, Action<Exception, string> nextError)
        {
            string currentConfig = model.IGetActiveConfiguration().Name;

            if (currentConfig.ToLower().Contains("по умолчани") || currentConfig.ToLower().Contains("default"))
                currentConfig = string.Empty;

            string isProduct = model.GetCustomInfoValue(currentConfig, "IsProduct");
            if (string.IsNullOrEmpty(isProduct))
            {
                isProduct = model.GetCustomInfoValue(string.Empty, "IsProduct");
                if (string.IsNullOrEmpty(isProduct))
                    isProduct = "No";
            }

            if (isProduct == "Yes")
            {
                //изделие

                //Проверка существования артикула для компонента в случает отсутствия, расчет цены на сам компонент не производится
                string articul = model.GetCustomInfoValue(string.Empty, "Articul");
                if (string.IsNullOrEmpty(articul))
                    articul = model.GetCustomInfoValue(currentConfig, "Articul");

                if (!string.IsNullOrEmpty(articul))
                {
                    try
                    {
                        nextPrice(сalculatePriceForModel(model));
                    }
                    catch (Exception e)
                    {
                        if (checkError(e))
                            nextError(e, Path.GetFileName(model.GetPathName()));
                    }
                }

                string s = model.GetPathName();
                AssemblyDoc model_assembly = model as AssemblyDoc;
                if (model_assembly != null)
                {
                    bool calcStruct = true;
                    if (!string.IsNullOrEmpty(articul))
                    {
                        string calcStructStr = model.get_CustomInfo2(string.Empty, "CalcStruct");
                        if (calcStructStr.ToLower() == "no")
                            calcStruct = false;
                    }

                    var components = (object[])((AssemblyDoc)model).GetComponents(true);
                    foreach (var component in components)
                    {
                        var comp = (Component2)component;
                        ModelDoc2 _model = comp.IGetModelDoc();
                        if (_model != null)
                        {
                            getPriceForComponent(_model, calcStruct, nextPrice, nextError);
                        }
                    }
                }
            }
            else
            {
                //не изделие

                string articul = model.GetCustomInfoValue(string.Empty, "Articul");
                if (string.IsNullOrEmpty(articul))
                    articul = model.GetCustomInfoValue(currentConfig, "Articul");

                string isIndependentStr = model.get_CustomInfo2(string.Empty, "IsIndependent");
                bool isIndependent = true;
                if (string.IsNullOrEmpty(isIndependentStr) || isIndependentStr.ToLower() == "no")
                    isIndependent = false;

                if (isIndependent)
                {
                    bool calcStruct = true;
                    if (!string.IsNullOrEmpty(articul))
                    {
                        //независимый и с артикулом
                        try
                        {
                            nextPrice(сalculatePriceForModel(model));
                        }
                        catch (Exception e)
                        {
                            if (checkError(e))
                                nextError(e, Path.GetFileName(model.GetPathName()));
                        }
                        string calcStructStr = model.get_CustomInfo2(string.Empty, "CalcStruct");

                        if (calcStructStr.ToLower() == "no")
                            calcStruct = false;
                    }

                    if (calcStruct)
                    {
                        AssemblyDoc model_assembly = model as AssemblyDoc;
                        if (model_assembly != null)
                        {
//.........这里部分代码省略.........
开发者ID:digger1985,项目名称:MyCode,代码行数:101,代码来源:Repository.cs

示例6: CheckPropForArticul

 private bool CheckPropForArticul(ModelDoc2 model)
 {
     bool ret = false;
     var commonPropNames = (string[])model.GetCustomInfoNames();
     foreach (var commonPropName in commonPropNames)
     {
         if (commonPropName.ToLower() == "articul" && model.GetCustomInfoValue("", commonPropName) != "")
             ret = true;
     }
     if (model.GetConfigurationCount() >= 1)
     {
         string confName = model.IGetActiveConfiguration().Name;
         var confPropNames = (string[])model.GetCustomInfoNames2(confName);
         foreach (var confPropName in confPropNames)
         {
             if (confPropName.ToLower() == "articul" && model.GetCustomInfoValue(confName, confPropName) != "")
                 ret = true;
         }
     }
     return ret;
 }
开发者ID:digger1985,项目名称:MyCode,代码行数:21,代码来源:SwAddin.cs

示例7: SetObjectValue

        public bool SetObjectValue(ModelDoc2 inModel, string inName, int inType, double inVal, bool noArtIfSuppressed = false)
        {
            object swObj;
            Dimension swDim;
            Feature swFeature;
            Component2 swComp;
            bool ret = false;

            if (GetObjectByName(inModel, inName, inType, out swObj))
            {
                double dTestVal;
                switch (inType)
                {
                    case 14:
                        swDim = (Dimension)swObj;
                        dTestVal = swDim.GetSystemValue2("") * 1000;

                        if (dTestVal != inVal)
                        {
                            ret = (swDim.SetSystemValue2(inVal / 1000,
                                                         (int)
                                                         swSetValueInConfiguration_e.swSetValue_InAllConfigurations) ==
                                   (int)swSetValueReturnStatus_e.swSetValue_Successful);
                        }
                        else
                            ret = true;
                        break;

                    case 22:
                        swFeature = (Feature)swObj;
                        dTestVal = (swFeature.IsSuppressed() ? 0 : 1);

                        if (dTestVal != inVal)
                        {
                            //ret = swFeature.SetSuppression(inVal == 0 ? (int) swFeatureSuppressionAction_e.swSuppressFeature : (int)swFeatureSuppressionAction_e.swUnSuppressFeature);
                            ret =
                                swFeature.SetSuppression2(
                                    inVal == 0
                                        ? (int)swFeatureSuppressionAction_e.swSuppressFeature
                                        : (int)swFeatureSuppressionAction_e.swUnSuppressFeature,
                                    (int)swInConfigurationOpts_e.swAllConfiguration, inModel.GetConfigurationNames());

                            #region ������ ��������

                            Component2 newComp = null;

                            var config = inModel.IGetActiveConfiguration();
                            if (config != null)
                            {
                                swComp = config.IGetRootComponent2();
                                if (swComp != null)
                                {
                                    var outComps = new LinkedList<Component2>();
                                    if (GetComponents(swComp, outComps, false, false))
                                    {
                                        foreach (var component2 in outComps)
                                        {
                                            var mod = component2.IGetModelDoc();
                                            if (mod != null)
                                            {
                                                var texture = component2.GetTexture("");
                                                if (mod.GetType() == (int)swDocumentTypes_e.swDocPART &&
                                                    texture != null)
                                                {
                                                    newComp = component2;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            if (newComp != null)
                            {
                                inModel.Save();
                                if (newComp.Select(false))
                                    ((AssemblyDoc)inModel).ComponentReload();
                            }

                            #endregion
                        }
                        else
                            ret = true;
                        break;

                    case 20:
                        swComp = (Component2)swObj;
                        try
                        {
                            if ((swComp.IsSuppressed() ? 0 : 1) == inVal)
                            {
                                ret = true;
                            }
                            else
                            {
                                int k = inVal == 0
                                            ? (int)swComponentSuppressionState_e.swComponentSuppressed
                                            : (int)swComponentSuppressionState_e.swComponentFullyResolved;

                                bool isCavity = false;
                                if (inVal == 0)
//.........这里部分代码省略.........
开发者ID:digger1985,项目名称:MyCode,代码行数:101,代码来源:SwAddin.cs

示例8: GetComponentsNamesOnConfiguration

        private static List<string> GetComponentsNamesOnConfiguration(SwAddin _mSwAddin, ModelDoc2 parentModel, int configNumber)
        {
            List<string> elems = new List<string>();

            OleDbConnection oleDb;
            if (_mSwAddin.OpenModelDatabase(parentModel, out oleDb))
            {
                using (oleDb)
                {
                    OleDbCommand cm = new OleDbCommand("SELECT * FROM decors WHERE Number = " + configNumber, oleDb);
                    OleDbDataReader rd = cm.ExecuteReader();
                    while (rd.Read())
                    {
                        elems.Add((string)rd["Element"]);
                    }
                    rd.Close();
                }
            }

            AssemblyDoc pmAssembly = parentModel as AssemblyDoc;
            if (pmAssembly != null)
            {
                var comps = new LinkedList<Component2>();
                _mSwAddin.GetComponents(parentModel.IGetActiveConfiguration().IGetRootComponent2(), comps, true, false);
                foreach (Component2 comp in comps)
                {
                    ModelDoc2 model = comp.IGetModelDoc();
                    AssemblyDoc aDoc = model as AssemblyDoc;
                    if (aDoc != null)
                        elems.AddRange(GetComponentsNamesOnConfiguration(_mSwAddin, model, configNumber));
                }
            }
            return elems;
        }
开发者ID:digger1985,项目名称:MyCode,代码行数:34,代码来源:Decors.cs

示例9: GetConfigComponents

        internal static List<Component2> GetConfigComponents(SwAddin swAddin, ModelDoc2 model, int configNumber)
        {
            List<Component2> outComps = new List<Component2>();

            List<string> compsNames = GetComponentsNamesOnConfiguration(swAddin, model, configNumber);

            LinkedList<Component2> modelComponents = new LinkedList<Component2>();
            swAddin.GetComponents(model.IGetActiveConfiguration().IGetRootComponent2(), modelComponents, true, false);

            foreach (var component in modelComponents)
            {
                if (component.IsSuppressed()) continue;
                string compName = Path.GetFileNameWithoutExtension(swAddin.GetModelNameWithoutSuffix(component.GetPathName()));

                foreach (string name in compsNames)
                {
                    if (compName.Contains(name))
                    {
                        outComps.Add(component);
                        break;
                    }
                }
            }
            return outComps;
        }
开发者ID:digger1985,项目名称:MyCode,代码行数:25,代码来源:Decors.cs

示例10: GetAllModelsWithMdb

        internal static List<ModelDoc2> GetAllModelsWithMdb(SwAddin mSwAddin, ModelDoc2 swModel)
        {
            UserProgressBar pb;
            mSwAddin.SwApp.GetUserProgressBar(out pb);
            var list = new List<ModelDoc2>();
            var outComps = new LinkedList<Component2>();
            var faulsMod = new List<ModelDoc2>();

            if (mSwAddin.GetComponents(swModel.IGetActiveConfiguration().IGetRootComponent2(),
                                        outComps, true, false))
            {
                pb.Start(0, outComps.Count, "Перебор деталей");
                int i = 0;
                foreach (var component in outComps)
                {
                    if (component.IsSuppressed())
                    {
                        i++;
                        pb.UpdateProgress(i);
                        continue;
                    }
                    var inModel = component.IGetModelDoc();
                    if (list.Contains(inModel))
                    {
                        i++;
                        pb.UpdateProgress(i);
                        continue;
                    }
                    var comp = component;

                    int errCount = 0;
                    while ((inModel == null || mSwAddin.GetModelDatabaseFileName(inModel) == "") && errCount < 10)
                    {
                        if (comp != null)
                        {
                            comp = comp.GetParent();
                            if (comp != null && !comp.IsSuppressed())
                            {
                                inModel = comp.IGetModelDoc();
                            }
                        }
                        errCount++;
                    }
                    if (errCount == 10 && inModel != null)
                    {
                        i++;
                        pb.UpdateProgress(i);
                        continue;
                    }

                    if (inModel != null &&
                        Path.GetFileNameWithoutExtension(inModel.GetPathName()).Contains("#"/* +
                                                                                         mSwAddin.GetXNameForAssembly()*/) &&
                        !list.Contains(inModel) && !faulsMod.Contains(inModel))
                        CheckMdbForDecors(mSwAddin, inModel, list, comp, faulsMod);

                    i++;
                    pb.UpdateProgress(i);
                }
                pb.End();
            }
            return list;
        }
开发者ID:digger1985,项目名称:MyCode,代码行数:63,代码来源:Decors.cs


注:本文中的ModelDoc2.IGetActiveConfiguration方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。