コード例 #1
0
        public static void fCWall()
        {
            Utils.Utils.Init();
            Document doc = acApp.DocumentManager.MdiActiveDocument;
            Database db  = doc.Database;
            Editor   ed  = acApp.DocumentManager.MdiActiveDocument.Editor;

            BulgePolyJig jig = new BulgePolyJig(ed.CurrentUserCoordinateSystem);

            // Get zMin & zMax | height level
            PromptDoubleOptions zMinO = new PromptDoubleOptions("\nEnter Z-min level:");

            zMinO.DefaultValue = zMinOld;
            PromptDoubleResult zMin = ed.GetDouble(zMinO);

            if (zMin.Status != PromptStatus.OK)
            {
                Utils.Utils.End(); return;
            }
            zMinOld = zMin.Value;
            Utils.Utils.SetUCS(zMin.Value);

            if (!Utils.Layers.CurrentLayer().Contains("OBST"))
            {
                Utils.Layers.SetLayerForCurrentFloor("!FDS_OBST[gypsum_board]");
            }

            while (true)
            {
                PromptResult res = ed.Drag(jig);
                switch (res.Status)
                {
                // New point was added, keep going
                case PromptStatus.OK:
                    jig.AddDummyVertex();
                    break;

                // Keyword was entered
                case PromptStatus.Keyword:
                    if (jig.IsUndoing)
                    {
                        jig.RemoveLastVertex();
                    }
                    break;

                // If the jig completed successfully, add the polyline
                case PromptStatus.None:
                    jig.RemoveLastVertex();
                    jig.Append();
                    // Wyciagniecie geometrii
                    jig.ExtrudeToCeiling(zMin.Value);
                    Utils.Utils.End();
                    return;

                // User cancelled the command, get out of here
                // and don't forget to dispose the jigged entity
                default:
                    jig.Entity.Dispose();
                    Utils.Utils.End();
                    return;
                }
            }
        }
コード例 #2
0
        public static void fWall()
        {
            Utils.Utils.Init();
            Document doc = acApp.DocumentManager.MdiActiveDocument;
            Database db  = doc.Database;
            Editor   ed  = acApp.DocumentManager.MdiActiveDocument.Editor;

            BulgePolyJig jig = new BulgePolyJig(ed.CurrentUserCoordinateSystem);

            // Get zMin & zMax | height level
            PromptDoubleOptions zMinO = new PromptDoubleOptions("\nEnter Z-min level:");

            zMinO.DefaultValue = zMinOld;
            PromptDoubleResult zMin = ed.GetDouble(zMinO);

            if (zMin.Status != PromptStatus.OK)
            {
                Utils.Utils.End(); return;
            }
            zMinOld = zMin.Value;
            Utils.Utils.SetUCS(zMin.Value);

            if (!Utils.Layers.CurrentLayer().Contains("OBST"))
            {
                Utils.Layers.SetLayerForCurrentFloor("!FDS_OBST[gypsum_board]");
            }

            double             height;
            PromptDoubleResult zMax;
            PromptDoubleResult heightResult;

            // Enter Z-max (and check if > Z-min) or Height
            while (true)
            {
                PromptDoubleOptions zMaxO = new PromptDoubleOptions("\nEnter Z-max level or ");
                zMaxO.DefaultValue = zMaxOld;
                zMaxO.Keywords.Add("Height");
                zMax = ed.GetDouble(zMaxO);
                if (zMax.Status == PromptStatus.Keyword && zMax.StringResult == "Height")
                {
                    PromptDoubleOptions heightO = new PromptDoubleOptions("\nEnter height:");
                    heightO.DefaultValue  = heightOld;
                    heightO.AllowNone     = false;
                    heightO.AllowZero     = false;
                    heightO.AllowNegative = false;
                    heightResult          = ed.GetDouble(heightO);
                    if (heightResult.Status == PromptStatus.OK)
                    {
                        height    = heightResult.Value;
                        heightOld = heightResult.Value;
                        break;
                    }
                }
                else if (zMax.Status != PromptStatus.OK)
                {
                    Utils.Utils.End(); return;
                }
                else if (zMax.Value <= zMin.Value)
                {
                    ed.WriteMessage("\nZ-max level should be greater than Z-min level");
                }
                else
                {
                    zMaxOld = zMax.Value;
                    height  = zMax.Value - zMin.Value;
                    break;
                }
            }


            while (true)
            {
                PromptResult res = ed.Drag(jig);
                switch (res.Status)
                {
                // New point was added, keep going
                case PromptStatus.OK:
                    jig.AddDummyVertex();
                    break;

                // Keyword was entered
                case PromptStatus.Keyword:
                    if (jig.IsUndoing)
                    {
                        jig.RemoveLastVertex();
                    }
                    break;

                // If the jig completed successfully, add the polyline
                case PromptStatus.None:
                    jig.RemoveLastVertex();
                    jig.Append();
                    // Wyciagniecie geometrii
                    jig.ExtrudeWall(zMin.Value, zMax.Value, height);
                    Utils.Utils.End();
                    return;

                // User cancelled the command, get out of here
                // and don't forget to dispose the jigged entity
                default:
                    jig.Entity.Dispose();
                    Utils.Utils.End();
                    return;
                }
            }
        }