Example #1
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");
            }
        }