コード例 #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);
            }
        }
コード例 #2
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");
            }
        }