Пример #1
0
        public void ProjectPointsCommand()
        {
            Editor editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            try
            {
                //LicenseManager.CheckValid("FULL");
                ObjectId[] objectId_ = CommandLineQuerries.SelectFaces(true);
                PointProjection.string_0 = CommandLineQuerries.SpecifyRasterBySelectionOrByLayer(PointProjection.string_0);
                ObjectId[] array = null;
                if (PointProjection.string_0 == "S")
                {
                    array = CommandLineQuerries.SelectPoints(true);
                }
                else if (PointProjection.string_0 == "L")
                {
                    PointProjection.string_1 = CommandLineQuerries.SpecifyLayerName(PointProjection.string_1);
                    if (!DBManager.ExistsLayer(PointProjection.string_1))
                    {
                        throw new ArgumentException("Layer does not exist.");
                    }
                    array = DBManager.GetPointsOnLayer(PointProjection.string_1);
                    if (array == null)
                    {
                        throw new ArgumentException("No points selected.");
                    }
                    editor.WriteMessage(Environment.NewLine + array.Length + " points selected.");
                }
                PointProjection.string_4 = CommandLineQuerries.SpecifyProjectionDirection(PointProjection.string_4);
                ngeometry.VectorGeometry.Vector3d normalVector = new ngeometry.VectorGeometry.Vector3d(0.0, 0.0, 1.0);
                string a;
                if ((a = PointProjection.string_4.ToUpper()) != null)
                {
                    if (!(a == "X"))
                    {
                        if (!(a == "Y"))
                        {
                            if (!(a == "Z"))
                            {
                                if (!(a == "U"))
                                {
                                    if (!(a == "2P"))
                                    {
                                        goto IL_1E6;
                                    }
                                    normalVector = CommandLineQuerries.Specify2PDirection().BasisVector[2].Normalize();
                                }
                                else
                                {
                                    normalVector = Conversions.GetUCS().BasisVector[2].Normalize();
                                }
                            }
                            else
                            {
                                normalVector = new ngeometry.VectorGeometry.Vector3d(0.0, 0.0, 1.0);
                            }
                        }
                        else
                        {
                            normalVector = new ngeometry.VectorGeometry.Vector3d(0.0, 1.0, 0.0);
                        }
                    }
                    else
                    {
                        normalVector = new ngeometry.VectorGeometry.Vector3d(1.0, 0.0, 0.0);
                    }
                    Point point = new Point(0.0, 0.0, 0.0);
                    ngeometry.VectorGeometry.Plane plane = new ngeometry.VectorGeometry.Plane(point, normalVector);
                    CoordinateSystem coordinateSystem_   = new CoordinateSystem(plane);
                    PointProjection.string_3 = CommandLineQuerries.InsertOnLayer_Current_Face_Point(PointProjection.string_3);
                    PointProjection.string_2 = CommandLineQuerries.KeywordYesNo("Delete original points", PointProjection.string_2, false, false);
                    PointProjection.string_5 = CommandLineQuerries.KeepIfMultiple(PointProjection.string_5);
                    this.method_0(array, objectId_, coordinateSystem_);
                    return;
                }
IL_1E6:
                throw new System.Exception("Invalid option keyword.");
            }
            catch (System.Exception ex)
            {
                editor.WriteMessage("\n" + ex.Message + "\n");
            }
        }