Exemplo n.º 1
0
        public void DrawOnTop()
        {
            Transaction      trans     = _document.TransactionManager.TopTransaction;
            BlockTableRecord btr       = _document.Database.GetModelSpace(false);
            DrawOrderTable   drawOrder = trans.GetObject(btr.DrawOrderTableId, OpenMode.ForWrite) as DrawOrderTable;

            ObjectIdCollection ids = new ObjectIdCollection();

            ids.Add(BaseObject);

            drawOrder.MoveToTop(ids);
        }
Exemplo n.º 2
0
        ///// <summary>
        ///// 设置动态块属性
        ///// </summary>
        ///// <param name="br">要设置属性的动态块参照</param>
        ///// <param name="Properties">属性数组</param>
        //public static void SetDynamicValue(BlockReference br, Property[] properties)
        //{
        //    try
        //    {
        //        if (br.IsDynamicBlock)
        //        {
        //            foreach (DynamicBlockReferenceProperty dbrp in br.DynamicBlockReferencePropertyCollection)
        //            {
        //                for (int i = 0; i < properties.Length; i++)
        //                {
        //                    if (dbrp.PropertyName == properties[i].PropertyName)
        //                    {
        //                        dbrp.Value = properties[i].Value;
        //                    }
        //                }
        //            }
        //        }
        //    }
        //    catch
        //    { }
        //}
        ///// <summary>
        ///// 动态块属性
        ///// </summary>
        //public class Property
        //{
        //    private string propertyname;
        //    private double value;
        //    public string PropertyName
        //    {
        //        get { return propertyname; }
        //    }
        //    public double Value
        //    {
        //        get { return value; }
        //    }
        //    public Property(string PropertyName, double Value)
        //    {
        //        propertyname = PropertyName;
        //        value = Value;
        //    }
        //}

        /// <summary>
        /// 改变对象的绘图次序到顶层
        /// </summary>
        /// <param name="ent"></param>
        /// <param name="db"></param>
        public static void MoveTop(this Entity ent, Database db)
        {
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                ObjectIdCollection idc = new ObjectIdCollection();
                idc.Add(ent.ObjectId);
                BlockTable       bt  = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForWrite, false);
                BlockTableRecord btr = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.ModelSpace],
                                                                      OpenMode.ForWrite, false);
                DrawOrderTable orderTable = tr.GetObject(btr.DrawOrderTableId, OpenMode.ForWrite) as
                                            DrawOrderTable;
                orderTable.MoveToTop(idc);
                tr.Commit();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 􁬍􀦬􁇍􄈵􂱘􃒬􀳒􂃵􁑣􀠄􄹊􁈖
        /// </summary>
        /// <param name="ent"></param>
        /// <param name="db"></param>
        public bool MoveTop(bool istop)
        {
            DocumentLock doclock = null;

            try
            {
                Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
                doclock = doc.LockDocument();

                Database db = HostApplicationServices.WorkingDatabase;

                using (Transaction tr = db.TransactionManager.StartTransaction())
                {
                    try
                    {
                        ObjectIdCollection idc = new ObjectIdCollection();
                        idc.Add(parEntityId);

                        BlockTable       bt         = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForWrite, false);
                        BlockTableRecord btr        = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite, false);
                        DrawOrderTable   orderTable = tr.GetObject(btr.DrawOrderTableId, OpenMode.ForWrite) as DrawOrderTable;
                        if (istop)
                        {
                            orderTable.MoveToTop(idc);
                        }
                        else
                        {
                            orderTable.MoveToBottom(idc);
                        }
                    }
                    catch (Autodesk.AutoCAD.Runtime.Exception eex)
                    { }
                    catch (System.Exception ex) { }
                    tr.Commit();
                }
            }
            catch (Autodesk.AutoCAD.Runtime.Exception eex)
            { return(false); }
            catch (System.Exception ex) { return(false); }
            finally
            {
                doclock.Dispose();
            }


            return(true);
        }
Exemplo n.º 4
0
        public static void makeImageBottom()
        {
            using (DocumentLock docLock = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument())
            {
                Document activeDoc
                    = Application.DocumentManager.MdiActiveDocument;
                Database db = activeDoc.Database;
                Editor   ed = activeDoc.Editor;

                ObjectId oid = HeatSourceLayoutApp.globalProperty.RasterImageID;
                if (oid == ObjectId.Null)
                {
                    return;
                }

                using (Transaction tr = db.TransactionManager.StartTransaction())
                {
                    BlockTable bt = tr.GetObject(
                        db.BlockTableId,
                        OpenMode.ForRead
                        ) as BlockTable;
                    BlockTableRecord btrModelSpace =
                        tr.GetObject(
                            bt[BlockTableRecord.ModelSpace],
                            OpenMode.ForRead
                            ) as BlockTableRecord;

                    DrawOrderTable dot =
                        tr.GetObject(
                            btrModelSpace.DrawOrderTableId,
                            OpenMode.ForWrite
                            ) as DrawOrderTable;

                    ObjectIdCollection objToMove = new ObjectIdCollection();
                    objToMove.Add(oid);
                    dot.MoveToBottom(objToMove);
                    tr.Commit();
                }
            }
        }
        public void SendBehind()
        {
            Document parentDocument = this.ParentDataset.ParentDocument;

            using (parentDocument.LockDocument())
            {
                var transactionManager = parentDocument.TransactionManager;
                using (Transaction transaction = transactionManager.StartTransaction())
                {
                    BlockTable         blockTable         = (BlockTable)transaction.GetObject(parentDocument.Database.BlockTableId, 0);
                    BlockTableRecord   blockTableRecord   = (BlockTableRecord)transaction.GetObject(blockTable[(BlockTableRecord.ModelSpace)], (OpenMode)1);
                    DrawOrderTable     drawOrderTable     = (DrawOrderTable)transaction.GetObject(blockTableRecord.DrawOrderTableId, (OpenMode)1);
                    ObjectIdCollection objectIdCollection = new ObjectIdCollection();
                    objectIdCollection.Add(this.RasterObjectId);
                    drawOrderTable.MoveToBottom(objectIdCollection);
                    parentDocument.TransactionManager.QueueForGraphicsFlush();
                    parentDocument.TransactionManager.FlushGraphics();
                    parentDocument.Editor.UpdateScreen();
                    transaction.Commit();
                }
            }
            PaletteUtils.ActivateEditor();
        }
Exemplo n.º 6
0
        public ObjectId DefineRasterImage(Document doc, string url, Point3d basePoint, Vector3d v1, Vector3d v2, string suggestedName, byte transparency)
        {
            ObjectId result;

            try
            {
                System.Drawing.Image.FromStream(new WebClient().OpenRead(url));
            }
            catch
            {
                result = ObjectId.Null;
                return(result);
            }
            Database database = doc.Database;
            Editor   editor   = doc.Editor;
            ObjectId objectId = ObjectId.Null;
            ObjectId arg_39_0 = ObjectId.Null;

            try
            {
                using (doc.LockDocument(DocumentLockMode.ProtectedAutoWrite, null, null, false))
                {
                    Autodesk.AutoCAD.ApplicationServices.TransactionManager transactionManager = doc.TransactionManager;
                    doc.TransactionManager.EnableGraphicsFlush(true);
                    using (Transaction transaction = transactionManager.StartTransaction())
                    {
                        string.IsNullOrEmpty(suggestedName);
                        ObjectId objectId2 = RasterImageDef.GetImageDictionary(database);
                        if (objectId2.IsNull)
                        {
                            objectId2 = RasterImageDef.CreateImageDictionary(database);
                        }
                        RasterImageDef rasterImageDef = new RasterImageDef();
                        rasterImageDef.SourceFileName = (url);
                        rasterImageDef.Load();
                        bool         arg_A4_0     = rasterImageDef.IsLoaded;
                        DBDictionary dBDictionary = (DBDictionary)transaction.GetObject(objectId2, OpenMode.ForWrite);
                        string       text         = RasterImageDef.SuggestName(dBDictionary, url);
                        if (!string.IsNullOrEmpty(suggestedName))
                        {
                            text = suggestedName;
                            int num = 0;
                            while (dBDictionary.Contains(text))
                            {
                                num++;
                                text = suggestedName + num;
                            }
                        }
                        ObjectId arg_F8_0 = ObjectId.Null;
                        if (dBDictionary.Contains(text))
                        {
                            //editor.WriteMessage(AfaStrings.ImageAlreadyExits);
                            result = ObjectId.Null;
                            return(result);
                        }
                        dBDictionary.SetAt(text, rasterImageDef);
                        transaction.AddNewlyCreatedDBObject(rasterImageDef, true);
                        dBDictionary.Contains(text);
                        ObjectId    layer       = GetLayer(database, transaction, ref text);
                        RasterImage rasterImage = new RasterImage();
                        rasterImage.ImageDefId = (rasterImageDef.ObjectId);
                        rasterImage.SetLayerId(layer, false);
                        byte         b             = Convert.ToByte(Math.Floor((100.0 - (double)transparency) / 100.0 * 254.0));
                        Transparency transparency2 = new Transparency(b);
                        rasterImage.Transparency = transparency2;
                        ;                       rasterImage.Orientation = new CoordinateSystem3d(basePoint, v1, v2);
                        BlockTable       blockTable       = (BlockTable)transactionManager.GetObject(database.BlockTableId, 0, false);
                        BlockTableRecord blockTableRecord = (BlockTableRecord)transactionManager.GetObject(blockTable[BlockTableRecord.ModelSpace], OpenMode.ForWrite, false);
                        int num2 = 0;
                        try
                        {
                            num2 = blockTableRecord.Cast <object>().Count <object>();
                        }
                        catch
                        {
                        }
                        rasterImage.ColorIndex = (256);
                        objectId = blockTableRecord.AppendEntity(rasterImage);
                        transactionManager.AddNewlyCreatedDBObject(rasterImage, true);
                        rasterImage.AssociateRasterDef(rasterImageDef);
                        RasterImage.EnableReactors(true);
                        rasterImageDef.UpdateEntities();
                        DrawOrderTable     drawOrderTable     = (DrawOrderTable)transaction.GetObject(blockTableRecord.DrawOrderTableId, OpenMode.ForWrite);
                        ObjectIdCollection objectIdCollection = new ObjectIdCollection();
                        objectIdCollection.Add(objectId);
                        drawOrderTable.MoveToBottom(objectIdCollection);
                        try
                        {
                            rasterImageDef.UpdateEntities();
                            if (num2 == 0)
                            {
                                ZoomExtents(rasterImage.GeometricExtents.MinPoint, rasterImage.GeometricExtents.MaxPoint);
                                editor.WriteMessage(rasterImage.Orientation.Origin.ToString());
                            }
                        }
                        catch
                        {
                        }
                        transaction.Commit();
                    }
                }
                result = objectId;
            }
            catch (System.Exception ex)
            {
                result = ObjectId.Null;
            }
            catch
            {
                //rrorReport.ShowErrorMessage(AfaStrings.UnexpectedErrorInAddingRasterImage);
                result = ObjectId.Null;
            }
            return(result);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Sets the display order.
        /// </summary>
        /// <param name="transaction">The transaction.</param>
        /// <param name="oids">The object ids.</param>
        /// <param name="sendToTop">The draw order.</param>
        public static void SetDisplayOrder(Transaction transaction, ObjectIdCollection oids, bool sendToTop)
        {
            //_logger.Debug("Start SetDisplayOrder");
            if (oids == null)
            {
                throw new NullReferenceException("oids is null");
            }

            // verify the arguments
            //
            if (oids.Count == 0)
            {
                return;
            }

            // get the database from the the first objectId
            //
            Autodesk.AutoCAD.DatabaseServices.Database db = oids[0].Database;

            // create a transaction if needed
            //
            Transaction trans = null;

            if (transaction == null)
            {
                trans = db.TransactionManager.StartTransaction();
            }
            else
            {
                trans = transaction;
            }

            // now get the draworder table and set accordingly
            //
            using (BlockTable blockTable = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead))
            {
                using (BlockTableRecord btr = (BlockTableRecord)trans.GetObject(blockTable[BlockTableRecord.ModelSpace], OpenMode.ForWrite))
                {
                    using (DrawOrderTable drawOrderTable = trans.GetObject(btr.DrawOrderTableId, OpenMode.ForWrite) as DrawOrderTable)
                    {
                        if (drawOrderTable != null)
                        {
                            if (sendToTop)
                            {
                                drawOrderTable.MoveToTop(oids);
                            }
                            else
                            {
                                drawOrderTable.MoveToBottom(oids);
                            }
                        }
                    }
                }
            }

            // cleanup transaction if needed
            //
            if (transaction == null)
            {
                trans.Commit();
                trans.Dispose();
            }
            //_logger.Debug("End SetDisplayOrder");
        }
Exemplo n.º 8
0
        private void CreateProfile(object arg)
        {
            try
            {
                if (doc != null)
                {
                    using (doc.LockDocument())
                    {
                        Editor   ed = doc.Editor;
                        Database db = doc.Database;


                        using (Transaction tr = db.TransactionManager.StartTransaction())
                        {
                            //выбрать базовую точку снизу слева
                            double          minx        = double.PositiveInfinity;
                            double          miny        = double.PositiveInfinity;
                            List <ObjectId> allSelected = new List <ObjectId>(soilHatchIds);
                            allSelected.Add(groundSurfPolyId);
                            foreach (ObjectId id in allSelected)
                            {
                                Entity ent = null;
                                try
                                {
                                    ent = (Entity)tr.GetObject(id, OpenMode.ForRead);
                                }
                                catch (Autodesk.AutoCAD.Runtime.Exception) { continue; }
                                Extents3d?ext = ent.Bounds;
                                if (ext != null)
                                {
                                    Point3d minPt = ext.Value.MinPoint;
                                    if (minx > minPt.X)
                                    {
                                        minx = minPt.X;
                                    }
                                    if (miny > minPt.Y)
                                    {
                                        miny = minPt.Y;
                                    }
                                }
                            }
                            Point2d basePt = new Point2d(minx, miny);


                            //для трансформации координат
                            //Vector2d baseVector = new Vector2d(minx, miny);
                            Matrix2d transform =
                                new Matrix2d(new double[]
                            {
                                StartHorScaling, 0, 0,
                                0, StartVertScaling, 0,
                                0, 0, 1
                            })
                                * Matrix2d.Displacement(new Vector2d(-minx, -miny));

                            //полилиния поверхности земли
                            //???????координаты точек полилинии расчитываются относительно базовой точки (и пересчитываются в метры согласно введенным коэффициентам?)
                            //отсортировать список сточек по координате X.
                            //ПОИСК ПО ДИАПАЗОНУ:
                            //Использовать бинарный поиск (https://www.baeldung.com/java-binary-search) для нахождения хотябы одной точки в заданном диапазоне
                            //затем проверять соседние точки на нахождение в диапазоне
                            Polyline poly = null;
                            try
                            {
                                poly = (Polyline)tr.GetObject(groundSurfPolyId, OpenMode.ForRead);
                            }
                            catch (Autodesk.AutoCAD.Runtime.Exception)
                            {
                                return;
                            }
                            ObjectId       groundSurfLayerId = poly.LayerId;
                            List <Point2d> polyPts           = new List <Point2d>();
                            for (int i = 0; i < poly.NumberOfVertices; i++)
                            {
                                Point2d pt = poly.GetPoint2dAt(i);
                                pt = transform * pt;
                                //pt = pt - baseVector;
                                //pt = new Point2d(pt.X * StartHorScaling, pt.Y * StartVertScaling);
                                polyPts.Add(pt);
                            }
                            polyPts.Sort((a, b) =>
                            {
                                return(a.X.CompareTo(b.X));
                            });



                            double depthMultipier = StartVertSoilScaling / StartVertScaling;
                            //для каждой штриховки получить все контуры
                            //любые контуры должны быть переведены в полигоны без кривизны
                            //???????координаты точек полигонов расчитываются относительно базовой точки (и пересчитываются в метры согласно введенным коэффициентам?)
                            //для каждой точки полигона должно быть расчитано заглубление относительно поверхности земли
                            //если между двумя точками полигона по гоизонтали есть точки перелома поверхности земли,
                            //то для этих точек должны быть добавлены соответствующие точки полигона
                            List <HatchData> hatchData = new List <HatchData>();
                            foreach (ObjectId id in soilHatchIds)
                            {
                                Hatch hatch = null;
                                try
                                {
                                    hatch = (Hatch)tr.GetObject(id, OpenMode.ForRead);
                                }
                                catch (Autodesk.AutoCAD.Runtime.Exception) { continue; }
                                HatchData hd = new HatchData(hatch);
                                hatchData.Add(hd);
                                for (int i = 0; i < hatch.NumberOfLoops; i++)
                                {
                                    HatchLoop hl = hatch.GetLoopAt(i);

                                    if (!hl.LoopType.HasFlag(HatchLoopTypes.SelfIntersecting) &&
                                        !hl.LoopType.HasFlag(HatchLoopTypes.Textbox) &&
                                        !hl.LoopType.HasFlag(HatchLoopTypes.TextIsland) &&
                                        !hl.LoopType.HasFlag(HatchLoopTypes.NotClosed))
                                    {
                                        List <Point2d> polygon = new List <Point2d>();
                                        hd.Polygons.Add(polygon);

                                        List <Curve2d> curves = Utils.GetHatchLoopCurves(hl);


                                        foreach (Curve2d c in curves)
                                        {
                                            if (!(c is LineSegment2d))
                                            {
                                                Interval         interval  = c.GetInterval();
                                                PointOnCurve2d[] samplePts = c.GetSamplePoints(interval.LowerBound, interval.UpperBound, 0.02);
                                                for (int n = 0; n < samplePts.Length - 1; n++)
                                                {
                                                    ProcessLineSegmentOfHatch(samplePts[n].Point, samplePts[n + 1].Point,
                                                                              polygon, polyPts, transform, /*baseVector, StartHorScaling, StartVertScaling,*/ depthMultipier);
                                                }
                                            }
                                            else
                                            {
                                                ProcessLineSegmentOfHatch(c.StartPoint, c.EndPoint,
                                                                          polygon, polyPts, transform, /*baseVector, StartHorScaling, StartVertScaling,*/ depthMultipier);
                                            }
                                        }
                                    }
                                }
                            }


                            //указание пользователем точки вставки нового профиля
                            //создание полилиний
                            //координаты точек пересчитываются заданным масштабным коэффициентам
                            //
                            PromptPointOptions pPtOpts = new PromptPointOptions("\nУкажите точку вставки");
                            PromptPointResult  pPtRes  = doc.Editor.GetPoint(pPtOpts);
                            if (pPtRes.Status == PromptStatus.OK)
                            {
                                BlockTable       bt = tr.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable;
                                BlockTableRecord ms
                                    = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);

                                DrawOrderTable drawOrder = tr.GetObject(ms.DrawOrderTableId, OpenMode.ForWrite) as DrawOrderTable;

                                ObjectId continLtId = Utils.GetContinuousLinetype(db);

                                Point2d insertPt = Utils.Point2DBy3D(pPtRes.Value);
                                //Vector2d insertVec = new Vector2d(insertPt.X, insertPt.Y);

                                Matrix2d insertTransform =
                                    Matrix2d.Displacement(new Vector2d(insertPt.X, insertPt.Y))
                                    * new Matrix2d(new double[]
                                {
                                    1 / EndHorScaling, 0, 0,
                                    0, 1 / EndVertScaling, 0,
                                    0, 0, 1
                                });

                                //полилиния поверхности земли
                                using (Polyline surfGroundPoly = new Polyline())
                                {
                                    surfGroundPoly.LayerId    = groundSurfLayerId;
                                    surfGroundPoly.ColorIndex = 256;
                                    surfGroundPoly.LinetypeId = continLtId;
                                    for (int i = 0; i < polyPts.Count; i++)
                                    {
                                        Point2d pt = polyPts[i];
                                        //Point2d convertedPt = new Point2d(pt.X / EndHorScaling, pt.Y / EndVertScaling);
                                        //convertedPt = convertedPt + insertVec;
                                        Point2d convertedPt = insertTransform * pt;

                                        surfGroundPoly.AddVertexAt(i, convertedPt, 0, 0, 0);
                                    }
                                    ms.AppendEntity(surfGroundPoly);
                                    tr.AddNewlyCreatedDBObject(surfGroundPoly, true);
                                }

                                //полилинии штриховок
                                //HashSet<ObjectId> createdLayers = new HashSet<ObjectId>();
                                ObjectIdCollection hatchIds = new ObjectIdCollection();
                                foreach (HatchData hd in hatchData)
                                {
                                    /*
                                     * double patternScale = hd.Hatch.PatternScale;
                                     *
                                     * string layerName = patternScale != 1 ? hd.Hatch.PatternName + "_" + patternScale.ToString("f2") : hd.Hatch.PatternName;
                                     *
                                     * ObjectId hatchLayerId = Utils.CreateLayerIfNotExists(layerName, db, tr,
                                     *      lineWeight: LineWeight.LineWeight030);
                                     * createdLayers.Add(hatchLayerId);
                                     */

                                    ObjectIdCollection polyIds = new ObjectIdCollection();
                                    foreach (List <Point2d> polygon in hd.Polygons)
                                    {
                                        if (polygon.Count > 0)
                                        {
                                            using (Polyline geologPoly = new Polyline())
                                            {
                                                geologPoly.LayerId    = hd.Hatch.LayerId; //hatchLayerId;
                                                geologPoly.ColorIndex = 256;
                                                geologPoly.LinetypeId = continLtId;

                                                for (int i = 0; i < polygon.Count; i++)
                                                {
                                                    Point2d pt = polygon[i];
                                                    //Point2d convertedPt = new Point2d(pt.X / EndHorScaling, pt.Y / EndVertScaling);
                                                    //convertedPt = convertedPt + insertVec;
                                                    Point2d convertedPt = insertTransform * pt;

                                                    geologPoly.AddVertexAt(i, convertedPt, 0, 0, 0);
                                                }

                                                geologPoly.Closed = true;

                                                ObjectId id = ms.AppendEntity(geologPoly);
                                                tr.AddNewlyCreatedDBObject(geologPoly, true);

                                                if (!id.IsNull && id.IsValid)
                                                {
                                                    polyIds.Add(id);
                                                }
                                            }
                                        }
                                    }

                                    if (polyIds.Count > 0)
                                    {
                                        try
                                        {
                                            using (Hatch oHatch = /*(Hatch)hd.Hatch.Clone()*/ new Hatch())
                                            {
                                                oHatch.LayerId = hd.Hatch.LayerId; //hatchLayerId;


                                                Vector3d normal = new Vector3d(0.0, 0.0, 1.0);

                                                oHatch.Normal    = normal;
                                                oHatch.Elevation = 0.0;

                                                oHatch.PatternScale = hd.Hatch.PatternScale;
                                                //oHatch.SetHatchPattern(hd.Hatch.PatternType, hd.Hatch.PatternName);
                                                oHatch.SetHatchPattern(HatchPatternType.PreDefined, "SOLID");
                                                oHatch.ColorIndex = 256;

                                                //while (oHatch.NumberOfLoops>0)
                                                //{
                                                //    oHatch.RemoveLoopAt(0);
                                                //}

                                                ObjectId hatchId = ms.AppendEntity(oHatch);
                                                tr.AddNewlyCreatedDBObject(oHatch, true);

                                                oHatch.Associative = true;


                                                foreach (ObjectId polyId in polyIds)
                                                {
                                                    oHatch.AppendLoop(HatchLoopTypes.Default, new ObjectIdCollection()
                                                    {
                                                        polyId
                                                    });
                                                }

                                                oHatch.EvaluateHatch(true);

                                                if (!hatchId.IsNull && hatchId.IsValid)
                                                {
                                                    hatchIds.Add(hatchId);
                                                }
                                            }
                                        }
                                        catch { }
                                    }
                                }

                                /*
                                 * short colorIndex = 1;
                                 * foreach (ObjectId layerId in createdLayers)
                                 * {
                                 *  LayerTableRecord ltr = (LayerTableRecord)tr.GetObject(layerId, OpenMode.ForWrite);
                                 *  ltr.Color = Color.FromColorIndex(ColorMethod.ByAci, colorIndex);
                                 *
                                 *  colorIndex = Convert.ToByte((colorIndex + 1) % 256);
                                 * }
                                 */

                                drawOrder.MoveToBottom(hatchIds);


                                //GeologyConvertationCommand.ClosePalette(null, null);
                                ps.Visible = false;
                            }
                            tr.Commit();
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                GeologyConvertationCommand.ClosePalette(null, null);
                CommonException(ex, "Ошибка при переводе масштаба профиля геологии");
            }
        }