コード例 #1
0
ファイル: AC_Entity.cs プロジェクト: 15831944/autocad-arx
 public FullSubentityPath[] GetSubentityPathsAtGraphicsMarker(SubentityType type, long gsMark, Point3d pickPoint, Matrix3d viewTransform, int numInserts, ObjectId[] entityAndInsertStack)
 {
     createInstance();
     FullSubentityPath[] GetSubentityPathsAtG = BaseEntity.GetSubentityPathsAtGraphicsMarker(type, gsMark, pickPoint, viewTransform, numInserts, entityAndInsertStack);
     tr.Dispose();
     return(GetSubentityPathsAtG);
 }
コード例 #2
0
ファイル: AC_Entity.cs プロジェクト: darkimage/utility_funcs
 public FullSubentityPath[] GetSubentityPathsAtGraphicsMarker(SubentityType type, long gsMark, Point3d pickPoint, Matrix3d viewTransform, int numInserts, ObjectId[] entityAndInsertStack)
 {
     createInstance();
     FullSubentityPath[] GetSubentityPathsAtG = BaseEntity.GetSubentityPathsAtGraphicsMarker(type, gsMark, pickPoint, viewTransform, numInserts, entityAndInsertStack);
     tr.Dispose();
     return GetSubentityPathsAtG;
 }
コード例 #3
0
 public static bool IsSubentity(SubentityType subentType)
 {
     return(subentType == SubentityType.Edge || subentType == SubentityType.Face || subentType == SubentityType.Vertex);
 }
コード例 #4
0
        public static List <FullSubentityPath> SelectEntity(SubentityType subentType, SelectionFilter selectionFilter, bool multiple)
        {
            var                    editor  = Application.DocumentManager.MdiActiveDocument.Editor;
            const string           selMode = "SELECTIONMODES";
            PromptSelectionOptions pso     = null;
            var                    oldVal  = Application.GetSystemVariable(selMode);

            if (DatabaseUtils.IsSubentity(subentType))
            {
                pso = new PromptSelectionOptions();
                switch (subentType)
                {
                case SubentityType.Face:
                    Application.SetSystemVariable(selMode, 2);
                    break;

                case SubentityType.Edge:
                    Application.SetSystemVariable(selMode, 1);
                    break;

                case SubentityType.Vertex:
                    Application.SetSystemVariable(selMode, 3);
                    break;
                }
                pso.ForceSubSelections = true;
            }
            else
            {
                Application.SetSystemVariable(selMode, 0);
            }

            if (!multiple)
            {
                if (pso == null)
                {
                    pso = new PromptSelectionOptions();
                }
                pso.SingleOnly        = true;
                pso.SinglePickInSpace = true;
            }
            var selFiler = selectionFilter;
            PromptSelectionResult selection = null;

            if (pso != null && selFiler != null)
            {
                selection = editor.GetSelection(pso, selFiler);
            }
            else if (pso != null)
            {
                selection = editor.GetSelection(pso);
            }
            else if (selFiler != null)
            {
                selection = editor.GetSelection(selFiler);
            }
            else
            {
                selection = editor.GetSelection();
            }

            Application.SetSystemVariable("SELECTIONMODES", oldVal);
            if (selection.Status != PromptStatus.OK)
            {
                return(null);
            }

            List <FullSubentityPath> selectedSubents = null;

            for (int i = 0; i < selection.Value.Count; ++i)
            {
                if (DatabaseUtils.IsSubentity(subentType))
                {
                    var subents = selection.Value[i].GetSubentities();
                    if (subents == null)
                    {
                        continue;
                    }

                    foreach (var subent in subents)
                    {
                        if (subent.FullSubentityPath.SubentId.Type != subentType)
                        {
                            continue;
                        }

                        if (selectedSubents == null)
                        {
                            selectedSubents = new List <FullSubentityPath>();
                        }
                        selectedSubents.Add(subent.FullSubentityPath);
                    }
                }
                else
                {
                    selectedSubents = selection.Value.GetObjectIds().Select(objId =>
                                                                            new FullSubentityPath(new ObjectId[] { objId },
                                                                                                  new SubentityId(SubentityType.Null, 0))).ToList();
                }
            }
            return(selectedSubents);
        }