Ejemplo n.º 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");
            }
        }
        public void MinAreaEnclosingRectnagleCommand()
        {
            Editor editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            try
            {
                //LicenseManager.CheckValid("FULL");
                ObjectId[] idArray = CommandLineQuerries.SelectPoints(false);
                CMD_MinAreaEnclosingRectangle.string_0 = CommandLineQuerries.SpecifyProjectionDirection(CMD_MinAreaEnclosingRectangle.string_0);
                ngeometry.VectorGeometry.Vector3d vector3d = new ngeometry.VectorGeometry.Vector3d(0.0, 0.0, 1.0);
                string a;
                if ((a = CMD_MinAreaEnclosingRectangle.string_0.ToUpper()) != null)
                {
                    if (!(a == "X"))
                    {
                        if (!(a == "Y"))
                        {
                            if (!(a == "Z"))
                            {
                                if (!(a == "U"))
                                {
                                    if (!(a == "2P"))
                                    {
                                        goto IL_150;
                                    }
                                    vector3d = CommandLineQuerries.Specify2PDirection().BasisVector[2];
                                    vector3d = vector3d.Normalize();
                                }
                                else
                                {
                                    vector3d = Conversions.GetUCS().BasisVector[2].Normalize();
                                }
                            }
                            else
                            {
                                vector3d = new ngeometry.VectorGeometry.Vector3d(0.0, 0.0, 1.0);
                            }
                        }
                        else
                        {
                            vector3d = new ngeometry.VectorGeometry.Vector3d(0.0, 1.0, 0.0);
                        }
                    }
                    else
                    {
                        vector3d = 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, vector3d);
                    CoordinateSystem actualCS            = new CoordinateSystem(plane);
                    CMD_MinAreaEnclosingRectangle.ComputeMinAreaEnclosingRectangle(idArray, actualCS);
                    return;
                }
IL_150:
                throw new System.Exception("Invalid option keyword.");
            }
            catch (System.Exception ex)
            {
                editor.WriteMessage("\n" + ex.Message);
            }
        }
Ejemplo n.º 3
0
    public void method_0()
    {
        Editor editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

        try
        {
            //TCPlugin.LicenseManager.CheckValid("FULL");
            ObjectId[] objectId_ = CommandLineQuerries.SelectPoints(false);
            Class1.string_0 = CommandLineQuerries.SpecifyProjectionDirection(Class1.string_0);
            ngeometry.VectorGeometry.Vector3d vector3d = new ngeometry.VectorGeometry.Vector3d(0.0, 0.0, 1.0);
            string a;
            if ((a = Class1.string_0.ToUpper()) != null)
            {
                if (!(a == "X"))
                {
                    if (!(a == "Y"))
                    {
                        if (!(a == "Z"))
                        {
                            if (!(a == "U"))
                            {
                                if (!(a == "2P"))
                                {
                                    goto IL_150;
                                }
                                vector3d = CommandLineQuerries.Specify2PDirection().BasisVector[2];
                                vector3d = vector3d.Normalize();
                            }
                            else
                            {
                                vector3d = Conversions.GetUCS().BasisVector[2].Normalize();
                            }
                        }
                        else
                        {
                            vector3d = new ngeometry.VectorGeometry.Vector3d(0.0, 0.0, 1.0);
                        }
                    }
                    else
                    {
                        vector3d = new ngeometry.VectorGeometry.Vector3d(0.0, 1.0, 0.0);
                    }
                }
                else
                {
                    vector3d = 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, vector3d);
                CoordinateSystem coordinateSystem_   = new CoordinateSystem(plane);
                Class1.smethod_0(objectId_, coordinateSystem_);
                return;
            }
IL_150:
            throw new System.Exception("Invalid option keyword.");
        }
        catch (System.Exception ex)
        {
            editor.WriteMessage("\n" + ex.Message);
        }
    }
Ejemplo n.º 4
0
        public void ProjectLinesCommand()
        {
            Editor editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            try
            {
                //LicenseManager.CheckValid("FULL");
                ObjectId[] objectId_  = CommandLineQuerries.SelectFaces(false);
                ObjectId[] objectId_2 = CommandLineQuerries.SelectLines(false);
                LineProjection.string_2 = CommandLineQuerries.SpecifyProjectionDirection(LineProjection.string_2);
                //new Vector3d(0.0, 0.0, 1.0);
                ngeometry.VectorGeometry.Vector3d directionVector  = new ngeometry.VectorGeometry.Vector3d(1.0, 0.0, 0.0);
                ngeometry.VectorGeometry.Vector3d directionVector2 = new ngeometry.VectorGeometry.Vector3d(0.0, 1.0, 0.0);
                string a;
                if ((a = LineProjection.string_2.ToUpper()) != null)
                {
                    if (!(a == "X"))
                    {
                        if (!(a == "Y"))
                        {
                            if (!(a == "Z"))
                            {
                                if (!(a == "U"))
                                {
                                    if (!(a == "2P"))
                                    {
                                        goto IL_267;
                                    }
                                    CommandLineQuerries.Specify2PDirection().BasisVector[2].Normalize();
                                }
                                else
                                {
                                    Conversions.GetUCS().BasisVector[2].Normalize();
                                }
                            }
                            else
                            {
                                directionVector  = new ngeometry.VectorGeometry.Vector3d(1.0, 0.0, 0.0);
                                directionVector2 = new ngeometry.VectorGeometry.Vector3d(0.0, 1.0, 0.0);
                                //new Vector3d(0.0, 0.0, 1.0);
                            }
                        }
                        else
                        {
                            directionVector  = new ngeometry.VectorGeometry.Vector3d(1.0, 0.0, 0.0);
                            directionVector2 = new ngeometry.VectorGeometry.Vector3d(0.0, 0.0, 1.0);
                            //new Vector3d(0.0, 1.0, 0.0);
                        }
                    }
                    else
                    {
                        directionVector  = new ngeometry.VectorGeometry.Vector3d(0.0, 1.0, 0.0);
                        directionVector2 = new ngeometry.VectorGeometry.Vector3d(0.0, 0.0, 1.0);
                        //new Vector3d(0.0, 0.0, 1.0);
                    }
                    ngeometry.VectorGeometry.Point point = new ngeometry.VectorGeometry.Point(0.0, 0.0, 0.0);
                    ngeometry.VectorGeometry.Plane plane = new ngeometry.VectorGeometry.Plane(point, directionVector, directionVector2);
                    CoordinateSystem coordinateSystem_   = new CoordinateSystem(plane);
                    LineProjection.string_1 = CommandLineQuerries.InsertOnLayer_Current_Face_Line(LineProjection.string_1);
                    LineProjection.string_0 = CommandLineQuerries.KeywordYesNo("Delete original lines", LineProjection.string_0, false, false);
                    this.method_0(objectId_2, objectId_, coordinateSystem_, true);
                    return;
                }
IL_267:
                throw new System.Exception("Invalid option keyword.");
            }
            catch (System.Exception ex)
            {
                editor.WriteMessage("\n" + ex.Message + "\n");
            }
        }