Example #1
0
        public void SliceLineCommand()
        {
            Editor   editor   = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
            Database arg_15_0 = HostApplicationServices.WorkingDatabase;

            try
            {
                //LicenseManager.CheckValid("FULL");
                ObjectId[] objectId_ = CommandLineQuerries.SelectLines(false);
                ngeometry.VectorGeometry.Plane planeNormalized = CommandLineQuerries.Specify3PSystem().GetPlaneNormalized();
                int num = 0;
                while (num == 0)
                {
                    Point             left = new Point();
                    PromptPointResult promptPointResult = CommandLineQuerries.SpecifyPointOrKeepBothSides();
                    if (promptPointResult.Status == (PromptStatus)(-5005))
                    {
                        num = 0;
IL_F2_:
                        this.method_0(objectId_, planeNormalized, num);
                        return;
                    }
                    if (promptPointResult.Status == (PromptStatus)5100)
                    {
                        Point3d value = promptPointResult.Value;
                        left = new Point(value.X, value.Y, value.Z);
                        num  = Math.Sign(ngeometry.VectorGeometry.Vector3d.Dot(planeNormalized.NormalVector, new ngeometry.VectorGeometry.Vector3d(left - planeNormalized.Point)));
                        if (num == 0)
                        {
                            editor.WriteMessage("\nInvalid point: point is on plane.");
                        }
                    }
                    else if (promptPointResult.Status == (PromptStatus)(-5002))
                    {
                        CommandLineQuerries.OnCancelled();
                    }
                    else if (promptPointResult.Status != (PromptStatus)5100)
                    {
                        CommandLineQuerries.OnNotOK();
                    }
                }
                goto IL_F2;
IL_F2:
                {
                    this.method_0(objectId_, planeNormalized, num);
                    return;
                }
            }
            catch (System.Exception ex)
            {
                editor.WriteMessage(Environment.NewLine + ex.Message + Environment.NewLine);
            }
        }
Example #2
0
        public void Contour(UserCmd cmd, string refrencePlan, double startElevation, double endElevation, double spacing, string whatCADData, string prefix)
        {
            this.cmd = cmd;
            MyDB2  mydb   = cmd.mydb;
            Editor editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            try
            {
                //ObjectId[] objectId_ = CommandLineQuerries.SelectFaces(false);
                ObjectId[] faceIDs = Selection.getFaceIds(mydb.getFaceLayerName());
                ContourLineComputation.string_0 = refrencePlan;
                CoordinateSystem coordinateSystem = CoordinateSystem.Global();
                if (ContourLineComputation.string_0 == "U")
                {
                    coordinateSystem = Conversions.GetUCS();
                }
                if (ContourLineComputation.string_0 == "3P")
                {
                    coordinateSystem = CommandLineQuerries.Specify3PSystem();
                }
                coordinateSystem.Orthonormalize();
                ContourLineComputation.startElevation = startElevation;
                ContourLineComputation.endElevation   = Math.Max(ContourLineComputation.endElevation, ContourLineComputation.startElevation);
                bool flag = false;
                while (!flag)
                {
                    ContourLineComputation.endElevation = endElevation;
                    if (ContourLineComputation.startElevation > ContourLineComputation.endElevation)
                    {
                        editor.WriteMessage("\nStart elevation must be less or equal end elevation.");
                    }
                    else
                    {
                        flag = true;
                    }
                }
                ContourLineComputation.spacing     = spacing;
                ContourLineComputation.whatCADData = whatCADData;//CommandLineQuerries.InsertOnLayer_Current_Face_Elevation_Index(ContourLineComputation.whichLayer);
                if (ContourLineComputation.whatCADData != "F" && ContourLineComputation.whatCADData != "C")
                {
                    ContourLineComputation.prefix = prefix;// CommandLineQuerries.SpecifyPrefixString(ContourLineComputation.prefix);
                }
                this.genContour2(faceIDs, coordinateSystem);
            }
            catch (System.Exception ex)
            {
                editor.WriteMessage("\n" + ex.Message + "\n");
            }
        }
        public void GenerateSolidCommand()
        {
            ProgressMeter progressMeter = new ProgressMeter();
            Database      arg_0B_0      = HostApplicationServices.WorkingDatabase;
            Editor        editor        = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            this.messageFilter_0 = new MessageFilter();
            System.Windows.Forms.Application.AddMessageFilter(this.messageFilter_0);
            try
            {
                //LicenseManager.CheckValid("FULL");
                ObjectId[] objectId_ = CommandLineQuerries.SelectFaces(false);
                CMD_FacesToSolid.string_1 = CommandLineQuerries.SpecifyReferencePlane(CMD_FacesToSolid.string_1);
                CoordinateSystem coordinateSystem = CoordinateSystem.Global();
                if (CMD_FacesToSolid.string_1 == "U")
                {
                    coordinateSystem = Conversions.GetUCS();
                }
                if (CMD_FacesToSolid.string_1 == "3P")
                {
                    coordinateSystem = CommandLineQuerries.Specify3PSystem();
                }
                coordinateSystem.Orthonormalize();
                CMD_FacesToSolid.double_0 = CommandLineQuerries.SpecifyDouble("Extrusion height in actual Z", CMD_FacesToSolid.double_0, false, true, false, false);
                bool flag = false;
                while (!flag)
                {
                    CMD_FacesToSolid.string_2 = CommandLineQuerries.SpecifyString("Minimum projected edge length", CMD_FacesToSolid.string_2, false);
                    if (Convert.ToDouble(CMD_FacesToSolid.string_2) >= 0.0001 && Convert.ToDouble(CMD_FacesToSolid.string_2) <= 1.0)
                    {
                        flag = true;
                    }
                    else
                    {
                        editor.WriteMessage("\nValue must be between 0.0001 and 1.");
                    }
                }
                CMD_FacesToSolid.string_0 = CommandLineQuerries.KeywordYesNo("Union solids", CMD_FacesToSolid.string_0, false, false).ToUpper().Trim();
                this.method_0(objectId_, progressMeter, coordinateSystem);
            }
            catch (System.Exception ex)
            {
                progressMeter.Stop();
                editor.WriteMessage("\n" + ex.Message);
            }
        }
Example #4
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");
            }
        }
Example #5
0
        public void SliceFacesCommand()
        {
            Editor editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            try
            {
                //LicenseManager.CheckValid("FULL");
                ObjectId[]       objectId_        = CommandLineQuerries.SelectFaces(false);
                CoordinateSystem coordinateSystem = CommandLineQuerries.Specify3PSystem();
                ngeometry.VectorGeometry.Plane planeNormalized = coordinateSystem.GetPlaneNormalized();
                int num = 0;
                while (num == 0)
                {
                    Point             left = new Point();
                    PromptPointResult promptPointResult = CommandLineQuerries.SpecifyPointOrKeepBothSides();
                    if (promptPointResult.Status == (PromptStatus)(-5005))
                    {
                        num = 0;
IL_F3_:
                        EntitySlicer.string_0 = CommandLineQuerries.KeywordYesNo("Keep coplanar faces", EntitySlicer.string_0, false, false);
                        int  num2  = 0;
                        int  num3  = 0;
                        int  num4  = 0;
                        bool bool_ = false;
                        if (EntitySlicer.string_0.Trim().ToUpper() == "Y")
                        {
                            bool_ = true;
                        }
                        this.method_1(objectId_, planeNormalized, num, bool_, ref num2, ref num3, ref num4);
                        editor.WriteMessage("\nFailed faces   : " + num3.ToString());
                        editor.WriteMessage("\nFaces sliced   : " + num2.ToString());
                        editor.WriteMessage("\nFaces remaining: " + num4.ToString());
                        return;
                    }
                    if (promptPointResult.Status == (PromptStatus)5100)
                    {
                        Point3d value = promptPointResult.Value;
                        left = new Point(value.X, value.Y, value.Z);
                        num  = Math.Sign(ngeometry.VectorGeometry.Vector3d.Dot(planeNormalized.NormalVector, new ngeometry.VectorGeometry.Vector3d(left - planeNormalized.Point)));
                        if (num == 0)
                        {
                            editor.WriteMessage("\nInvalid point: point is on slicing plane.");
                        }
                    }
                    else if (promptPointResult.Status == (PromptStatus)(-5002))
                    {
                        CommandLineQuerries.OnCancelled();
                    }
                    else if (promptPointResult.Status != (PromptStatus)5100)
                    {
                        CommandLineQuerries.OnNotOK();
                    }
                }
                goto IL_F3;
IL_F3:
                {
                    EntitySlicer.string_0 = CommandLineQuerries.KeywordYesNo("Keep coplanar faces", EntitySlicer.string_0, false, false);
                    int  num2  = 0;
                    int  num3  = 0;
                    int  num4  = 0;
                    bool bool_ = false;
                    if (EntitySlicer.string_0.Trim().ToUpper() == "Y")
                    {
                        bool_ = true;
                    }
                    this.method_1(objectId_, planeNormalized, num, bool_, ref num2, ref num3, ref num4);
                    editor.WriteMessage("\nFailed faces   : " + num3.ToString());
                    editor.WriteMessage("\nFaces sliced   : " + num2.ToString());
                    editor.WriteMessage("\nFaces remaining: " + num4.ToString());
                    return;
                }
            }
            catch (System.Exception ex)
            {
                editor.WriteMessage("\n" + ex.Message + "\n");
            }
        }