Exemple #1
0
        public ExGripDataSubent GetSubentGripData(ExGripDataExt ext, FullSubentityPath entPath)
        {
            int i = 0;

            foreach (ExGripDataSubent subData in ext.DataSub)
            {
                if (subData.EntPath == entPath)
                {
                    return(ext.DataSub[i]);
                }
                ++i;
            }
            return(ext.DataSub[0]);
        }
Exemple #2
0
        void updateEntityGrips(ObjectId id)
        {
            using (Entity ent = (Entity)id.GetObject(OpenMode.ForRead))
            {
                removeEntityGrips(ent, id, false);
                try // grip points are implemented not for all entities
                {
                    ExGripDataCollection exGrDataColl;
                    GripDataCollection   grips = new GripDataCollection();
                    if (ent.GetGripPoints(grips, activeViewUnitSize(), GRIPSIZE, activeViewDirection(), GetGripPointsFlags.GripPointsOnly))
                    {
                        exGrDataColl = new ExGripDataCollection();
                        foreach (GripData gr in grips)
                        {
                            exGrDataColl.Add(new ExGripData(id, gr, gr.GripPoint, this));
                        }
                    }
                    else
                    {
                        exGrDataColl = new ExGripDataCollection();
                        Point3dCollection gripsPts = new Point3dCollection();
                        ent.GetGripPoints(gripsPts, null, null);
                        foreach (Point3d pt in gripsPts)
                        {
                            exGrDataColl.Add(new ExGripData(id, pt, this));
                        }
                    }

                    if (null != exGrDataColl)
                    {
                        ExGripDataExt dExt = new ExGripDataExt();
                        foreach (ExGripData grDat in exGrDataColl)
                        {
                            FullSubentityPath entPath;
                            if (grDat.entPath(out entPath))
                            {
                                bool bFound = false;
                                ExGripDataSubentCollection grSubColl = dExt.DataSub;
                                for (int j = 0; j < grSubColl.Count; j++)
                                {
                                    if (grSubColl[j].EntPath == entPath)
                                    {
                                        bFound = true;
                                        grSubColl[j].SubData.Add(grDat);
                                        break;
                                    }
                                }
                                if (!bFound)
                                {
                                    ExGripDataSubent se = new ExGripDataSubent();
                                    se.EntPath = entPath;
                                    se.SubData.Add(grDat);
                                    dExt.DataSub.Add(se);
                                }
                            }
                            else
                            {
                                if (dExt.DataArray == null)
                                {
                                    dExt.DataArray = new ExGripDataCollection();
                                }
                                dExt.DataArray.Add(grDat);
                            }
                        }

                        m_gripDataDict.Add(id, dExt);

                        foreach (ExGripData grData in exGrDataColl)
                        {
                            showGrip(grData);
                        }
                    }
                }
                catch (System.Exception)
                {
                    // just skip non-supported entities
                }
                ent.Highlight();
            }
        }