Ejemplo n.º 1
0
        public void ContourCommand()
        {
            Editor editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            try
            {
                ObjectId[] objectId_ = CommandLineQuerries.SelectFaces(false);
                ContourLineComputation.string_0 = CommandLineQuerries.SpecifyReferencePlane(ContourLineComputation.string_0);
                CoordinateSystem coordinateSystem = CoordinateSystem.Global();
                if (ContourLineComputation.string_0 == "U")
                {
                    coordinateSystem = Conversions.GetUCS();
                }
                if (ContourLineComputation.string_0 == "3P")
                {
                    coordinateSystem = CommandLineQuerries.Specify3PSystem();
                }
                coordinateSystem.Orthonormalize();
                ContourLineComputation.startElevation = CommandLineQuerries.SpecifyDouble("Specify start elevation", ContourLineComputation.startElevation, false, true, false, true);
                ContourLineComputation.endElevation   = Math.Max(ContourLineComputation.endElevation, ContourLineComputation.startElevation);
                bool flag = false;
                while (!flag)
                {
                    ContourLineComputation.endElevation = CommandLineQuerries.SpecifyDouble("Specify end elevation", ContourLineComputation.endElevation, false, true, false, true);
                    if (ContourLineComputation.startElevation > ContourLineComputation.endElevation)
                    {
                        editor.WriteMessage("\nStart elevation must be less or equal end elevation.");
                    }
                    else
                    {
                        flag = true;
                    }
                }
                ContourLineComputation.spacing     = CommandLineQuerries.SpecifyDouble("Specify spacing", ContourLineComputation.spacing, false, false, false, false);
                ContourLineComputation.whatCADData = CommandLineQuerries.InsertOnLayer_Current_Face_Elevation_Index(ContourLineComputation.whatCADData);
                if (ContourLineComputation.whatCADData != "F" && ContourLineComputation.whatCADData != "C")
                {
                    ContourLineComputation.prefix = CommandLineQuerries.SpecifyPrefixString(ContourLineComputation.prefix);
                }
                this.genContour(objectId_, coordinateSystem);
            }
            catch (System.Exception ex)
            {
                editor.WriteMessage("\n" + ex.Message + "\n");
            }
        }