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


C# ModelDoc2.GetActiveConfiguration方法代码示例

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


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

示例1: HideCompAndShowCross

        private bool HideCompAndShowCross(ModelDoc2 swModel, string f1, string f2, out string comp1Name, out string comp2Name,
            out List<Component2> list)
        {
            bool ret = false;
            Component2 swComp1, swComp2;
            list = new List<Component2>();
            comp1Name = " ";
            comp2Name = " ";
            if (GetComponentByName(swModel, f1, false, out swComp1) &&
                GetComponentByName(swModel, f2, false, out swComp2))
            {
                var swComponents = new LinkedList<Component2>();
                comp1Name = swComp1.Name;
                comp2Name = swComp2.Name;
                if (comp1Name != comp2Name)
                {
                    var swConfig = (Configuration)swModel.GetActiveConfiguration();
                    if (swConfig != null)
                    {
                        var swRootComponent = (Component2)swConfig.GetRootComponent();

                        if (GetComponents(swRootComponent,
                                          swComponents, false, false))
                        {
                            foreach (var component in swComponents)
                            {
                                if ((component.Name != swComp1.Name) && (component.Name != swComp2.Name) &&
                                    (component.Visible == 1))
                                {
                                    component.Select(false);
                                    swModel.HideComponent2();
                                    swModel.ClearSelection();
                                    list.Add(component);
                                    ret = true;
                                }
                            }
                            return ret;
                        }
                    }
                }
            }
            return false;
        }
开发者ID:digger1985,项目名称:MyCode,代码行数:43,代码来源:SwAddin.cs

示例2: GetSymilarComponentByName

        private bool GetSymilarComponentByName(ModelDoc2 inModel, string inName, out Component2 outComponent)
        {
            var swComponents = new LinkedList<Component2>();
            bool ret = false;

            outComponent = null;

            var swConfig = (Configuration)inModel.GetActiveConfiguration();

            if (swConfig != null)
            {
                var swRootComponent = (Component2)swConfig.GetRootComponent();
                if (GetComponents(swRootComponent, swComponents, false, false))
                {
                    foreach (Component2 comp in swComponents)
                    {
                        string compName = comp.Name2;
                        if (compName.ToLower().Contains(inName.ToLower()))
                        {
                            outComponent = comp;
                            ret = true;
                            break;
                        }
                    }
                }
            }
            return ret;
        }
开发者ID:digger1985,项目名称:MyCode,代码行数:28,代码来源:SwAddin.cs

示例3: GetCutComponents

        private bool GetCutComponents(ModelDoc2 swModel,
            out LinkedList<Component2> outCutComponents, out LinkedList<Component2> outShelfComponents, out bool delete)
        {
            delete = false;
            var swComponents = new LinkedList<Component2>();
            ModelDoc2 swCompModel;

            outCutComponents = new LinkedList<Component2>();
            outCutComponents.Clear();

            outShelfComponents = new LinkedList<Component2>();
            outShelfComponents.Clear();

            var swConfig = (Configuration)swModel.GetActiveConfiguration();
            if (swConfig != null)
            {
                var swRootComponent = (Component2)swConfig.GetRootComponent();

                if (GetComponents(swRootComponent, swComponents, true, false))
                {
                    foreach (Component2 comp in swComponents)
                    {
                        swCompModel = (ModelDoc2)comp.GetModelDoc();
                        if (swCompModel != null)
                        {
                            if (swCompModel.get_CustomInfo2("", "swrfIsCut") == "Yes")
                            {
                                outCutComponents.AddLast(comp);
                            }
                            if (swCompModel.get_CustomInfo2("", "swrfIsShelf") == "Yes")
                            {
                                if (swCompModel.GetType() == (int)swDocumentTypes_e.swDocASSEMBLY)
                                    swCompModel.DeleteCustomInfo2("", "swrfIsShelf");
                                else
                                {
                                    if (comp.GetTexture("") != null)
                                        swCompModel.Save();
                                    outShelfComponents.AddLast(comp);
                                }

                                #region �������� ������ �������� ���������
                                var swFeat = comp.FirstFeature();
                                while (swFeat != null)
                                {
                                    if (swFeat.GetTypeName2() == "Cavity")
                                    {
                                        if (swFeat.Name.Contains("#swrf"))
                                        {
                                            swFeat.Select(true);
                                            delete = true;
                                        }
                                    }
                                    swFeat = swFeat.IGetNextFeature();
                                }
                                if (delete)
                                {
                                    swModel.DeleteSelection(true);
                                    swModel.ClearSelection2(true);
                                    GC.Collect();
                                }
                                #endregion
                            }
                        }
                    }
                }
            }
            return true;
        }
开发者ID:digger1985,项目名称:MyCode,代码行数:68,代码来源:SwAddin.cs

示例4: GetComponentByName

        private bool GetComponentByName(ModelDoc2 inModel, string inName, bool isDropSuffix, out Component2 outComponent, bool isGetSubComponents)
        {
            var swComponents = new LinkedList<Component2>();
            bool ret = false;

            outComponent = null;

            var swConfig = (Configuration)inModel.GetActiveConfiguration();

            if (swConfig != null)
            {
                var swRootComponent = (Component2)swConfig.GetRootComponent();
                if (GetComponents(swRootComponent, swComponents, isGetSubComponents, false))
                {
                    foreach (Component2 comp in swComponents)
                    {
                        string compName = isDropSuffix ? GetComponentNameWithoutSuffix(comp.Name2) : comp.Name2;
                        if (compName.ToLower() == inName.ToLower())
                        {
                            outComponent = comp;
                            ret = true;
                            break;
                        }
                    }
                }
            }
            return ret;
        }
开发者ID:digger1985,项目名称:MyCode,代码行数:28,代码来源:SwAddin.cs

示例5: SetAsmUnit

        public bool SetAsmUnit(ModelDoc2 model, out LinkedList<Component2> swComps)
        {
            bool ret = false;
            Configuration swConfig;
            swComps = new LinkedList<Component2>();

            try
            {
                SetModelProperty(model, "AsmUnit", "", swCustomInfoType_e.swCustomInfoText, model.GetPathName());
                swConfig = (Configuration)model.GetActiveConfiguration();
                if (swConfig != null)
                {
                    var swRootComponent = (Component2)swConfig.GetRootComponent();
                    if (GetComponents(swRootComponent, swComps, true, false))
                    {
                        foreach (var component2 in swComps)
                        {
                            var mod = component2.IGetModelDoc();
                            if (mod != null)
                            {
                                bool isIndependent = (!string.IsNullOrEmpty(mod.GetCustomInfoValue("", "IsIndependent") as string) && mod.GetCustomInfoValue("", "IsIndependent") == "Yes");
                                if (isIndependent)
                                {
                                    SetModelProperty(mod, "AsmUnit", "", swCustomInfoType_e.swCustomInfoText, RootModel.GetPathName());
                                }
                                else
                                {
                                    var swParentComp = component2.GetParent();
                                    string val = swParentComp == null ? model.GetPathName() : swParentComp.GetPathName();
                                    SetModelProperty(mod, "AsmUnit", "", swCustomInfoType_e.swCustomInfoText, val);
                                }
                            }
                        }
                        ret = true;
                    }
                }
            }
            catch { }
            return ret;
        }
开发者ID:digger1985,项目名称:MyCode,代码行数:40,代码来源:SwAddin.cs

示例6: GetAllUniqueModels

        public bool GetAllUniqueModels(ModelDoc2 inModel, out LinkedList<ModelDoc2> outModels)
        {
            Configuration swConfig;
            var swComponents = new LinkedList<Component2>();
            bool ret = false;

            outModels = new LinkedList<ModelDoc2>();
            try
            {
                outModels.AddLast(inModel);
                swConfig = (Configuration)inModel.GetActiveConfiguration();

                if (swConfig != null)
                {
                    var swRootComponent = (Component2)swConfig.GetRootComponent();

                    if (GetComponents(swRootComponent, swComponents, true, false))
                    {
                        foreach (Component2 comp in swComponents)
                        {
                            var swCompModel = (ModelDoc2)comp.GetModelDoc();

                            if (swCompModel != null)
                            {
                                ModelDoc2 model = swCompModel;
                                bool isModelAlreadyAdded = outModels.Any(mdoc => mdoc.GetPathName() == model.GetPathName());

                                if (!isModelAlreadyAdded)
                                    outModels.AddLast(swCompModel);
                            }
                        }
                    }
                }
                ret = true;
            }
            catch { }
            return ret;
        }
开发者ID:digger1985,项目名称:MyCode,代码行数:38,代码来源:SwAddin.cs


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