示例#1
0
        public static void GetInsObjects(string file, Action <Entity> action)
        {
            var doc   = GetDocumentOrOpen(file);
            var dbIns = doc.Database;

            using (doc.LockDocument())
                using (var t = dbIns.TransactionManager.StartTransaction())
                {
                    var ms = SymbolUtilityServices.GetBlockModelSpaceId(dbIns).GetObject(OpenMode.ForRead) as BlockTableRecord;
                    foreach (var idEnt in ms)
                    {
                        if (!idEnt.IsValidEx())
                        {
                            continue;
                        }

                        var ent = idEnt.GetObject(OpenMode.ForRead) as Entity;

                        if (!InsObjects.IsInsObject(ent) ||
                            ent is Circle || ent is DBPoint || ent is DBText || ent is MText || ent is Dimension)
                        {
                            continue;
                        }

                        action(ent);
                    }
                    t.Commit();
                }
        }
示例#2
0
        public void Compare()
        {
            // Объекты инсоляции correct
            var ins1 = new InsObjects(); GetInsObjects(file1, a => ins1.Add(a));
            var ins2 = new InsObjects(); GetInsObjects(file2, a => ins2.Add(a));

            ins1.Difference(ins2, $"Отличие объекта в файле {Path.GetFileNameWithoutExtension(file1)}", System.Drawing.SystemIcons.Exclamation);
            ins2.Difference(ins1, $"Отличие объекта в файле {Path.GetFileNameWithoutExtension(file2)}", System.Drawing.SystemIcons.Error);
        }
示例#3
0
        public void Difference(InsObjects ins, string objectDiffsMsg, System.Drawing.Icon icon)
        {
            var diffs = ents.Except(ins.ents);

            foreach (var item in diffs)
            {
                Inspector.AddError($"{objectDiffsMsg} - {item.ToString()}", item.Extents, Matrix3d.Identity, icon);
            }
        }