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


C# ModelDoc2.ClearSelection2方法代码示例

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


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

示例1: selectComponents

 //Selects components from a list.
 public static void selectComponents(ModelDoc2 model, List<Component2> components, bool clearSelection = true, int mark = -1)
 {
     if (clearSelection)
     {
         model.ClearSelection2(true);
     }
     SelectionMgr manager = model.SelectionManager;
     SelectData data = manager.CreateSelectData();
     data.Mark = mark;
     foreach (Component2 component in components)
     {
         component.Select4(true, data, false);
     }
 }
开发者ID:chlai,项目名称:sw2urdf,代码行数:15,代码来源:Common.cs

示例2: AutoDimensionDrawing2


//.........这里部分代码省略.........
                    element = _cxml.CreateElement("Sheet");
                    element.SetAttribute("Name", vSheetName);
                    _node = rootNode.AppendChild(element);
                    sheetNode = element;
                }

                double vScale = 0;
                var type = new List<string>();
                var listSize = new List<SizeForDim>();
                swDrawing.ActivateSheet(vSheetName);
                swModel.Extension.SelectByID2(vSheetName, "SHEET", 0, 0, 0, true,
                                              (int)swSelectionMarkAction_e.swSelectionMarkAppend, null, 0);
                swModel.ViewZoomToSelection();
                swModel.ClearSelection();
                var swSheet = (Sheet)swDrawing.GetCurrentSheet();
                var swViews = (object[])swSheet.GetViews();
                bool side = shi == 1;
                if (isNeededSheetNumber && listSide.ContainsKey(vSheetName.Substring(vSheetName.Length - 1)))
                    side = listSide[vSheetName.Substring(vSheetName.Length - 1)];
                if (vSheetName.ToUpper().Contains("FACE"))
                    side = true;
                if (vSheetName.ToUpper().Contains("BACK"))
                    side = false;

                if (swViews != null)
                {
                    var rootViewElement = _node;
                    if (Properties.Settings.Default.ViewsBeforeDimen)
                        ReplaceViews(swViews, swDrawing);
                    foreach (var t in swViews)
                    {
                        #region Образмеривание вида
                        var swView = (View) t;
                        swModel.ClearSelection2(true);

                        const string expr = "^F[1-6]$";

                        Match isMatch = Regex.Match(swView.Name, expr, RegexOptions.IgnoreCase);

                        if (_createProgramm && swView.Name.ToLower().Contains("const"))
                        {

                            //Logging.Log.Instance.Fatal(@"На данный чертеж программа не будет создана! " + swModel.GetPathName() + "swView.Name = " + swView.Name);
                            //MessageBox.Show(@"На данный чертеж программа не будет создана!", @"MrDoors",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
                        }

                        if (!(isMatch.Success || swView.Name.Contains("Чертежный вид")) ||
                            swView.Name.ToLower().Contains("const") ||
                            swView.Type == (int)swDrawingViewTypes_e.swDrawingDetailView) continue;

                        if (_createProgramm && !isMatch.Success)
                        {
                            _createProgramm = false;
                            //Logging.Log.Instance.Fatal(@"На данный чертеж программа не будет создана! " + swModel.GetPathName() + "swView.Name = " + swView.Name);
                            //MessageBox.Show(@"На данный чертеж программа не будет создана!", @"MrDoors",
                            //                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }

                        swDrawing.ActivateView(swView.GetName2());
                        swView.UseSheetScale = 0;

                        var list = HideUnusedComponents(swView, dimOnlyNew);

                        try
                        {
                            vScale = ((double[]) swView.ScaleRatio)[1];
开发者ID:digger1985,项目名称:MyCode,代码行数:67,代码来源:DimensionDraft.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: saveSWComponents

        //Converts the SW component references to PIDs
        public static void saveSWComponents(ModelDoc2 model, link Link)
        {
            model.ClearSelection2(true);
            byte[] PID = saveSWComponent(model, Link.SWMainComponent);
            if (PID != null)
            {
                Link.SWMainComponentPID = PID;
            }
            Link.SWComponentPIDs = saveSWComponents(model, Link.SWcomponents);

            foreach (link Child in Link.Children)
            {
                saveSWComponents(model, Child);
            }
        }
开发者ID:chlai,项目名称:sw2urdf,代码行数:16,代码来源:Common.cs


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