Ejemplo n.º 1
0
Archivo: Db.cs Proyecto: 15831944/EM
        makePointEnt(Point3d pt, int colorIndex, Database db)
        {
            int mode = (int)AcadApp.GetSystemVariable("pdmode");

            if (mode == 0)
            {
                AcadApp.SetSystemVariable("pdmode", 99);
            }

            try
            {
                using (Transaction tr = BaseObjs.startTransactionDb())
                {
                    using (DBPoint dbPt = new DBPoint(pt))
                    {
                        dbPt.ColorIndex = colorIndex;
                        SymTbl.AddToCurrentSpace(dbPt, db);
                    }
                    tr.Commit();
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(ex.Message + " Db.cs: line: 431");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Starts new command.
        /// </summary>
        /// <param name="command">The command.</param>
        public static void StartCommand(string command)
        {
            var existingCommands = Application.GetSystemVariable("CMDNAMES").ToString();
            var escapes          = existingCommands.Length > 0
                ? string.Join(string.Empty, Enumerable.Repeat('\x03', existingCommands.Split('\'').Length))
                : string.Empty;

            Application.DocumentManager.MdiActiveDocument.SendStringToExecute(escapes + command, true, false, true);
        }
Ejemplo n.º 3
0
        private void btn_selectViewport_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //check if defnition and  note list are selected
                if (checkifDefnitionsSelected())
                {
                    //rest progressbar
                    proBar.Value = 0;

                    using (GV.Doc.LockDocument())
                    {
                        short val = (short)AcAp.GetSystemVariable("CVPORT");

                        if (val != 1)
                        {
                            GV.processStatus = false;
                            UIH.toastIT("This option works only in Paperspace (Layouts), please swtich to paperspace and try again!", "Viewport Not Preset", NotificationType.Error);
                        }
                        else
                        {
                            Helper.ViewportExtensions.getvPortCoordinatesADV();
                            if (GV.processStatus == true && GV.selObjects_forProcessing != null)
                            {
                                bw.WorkerSupportsCancellation = true;
                                bw.WorkerReportsProgress      = true;
                                //bw.ProgressChanged += bw_ProgressChanged;
                                bw.DoWork += new DoWorkEventHandler(bw_UpdateProgressBar);
                                //start work
                                if (bw.IsBusy != true)
                                {
                                    bw.RunWorkerAsync();
                                }

                                ProcessLabels();
                                updateUIdata();

                                UIH.toastIT("All selected labels processed successfully!", "Status", NotificationType.Success);
                            }
                        }
                    }
                }
            }
            catch (Autodesk.Civil.CivilException ex)
            {
                GH.errorBox(ex.ToString());
            }
            catch (Autodesk.AutoCAD.Runtime.Exception ex)
            {
                GH.errorBox(ex.ToString());
            }
            catch (System.Exception ee)
            {
                GH.errorBox(ee.ToString());
            }
        }
Ejemplo n.º 4
0
        public static void doMXR()
        {
            string title  = "Multiple XRef - MXR";
            string dir    = Path.GetDirectoryName(BaseObjs.docFullName);
            string filter = "All Drawings (*.dwg)|*.dwg|Current Design Files1 (*.dwg)|????BNDY.dwg;????CGP.dwg;????CUP.dwg;????CNTL.dwg;????CONT.dwg;????DEMO.dwg;????GCAL.dwg;????SD.dwg;????TOPO.dwg;????T-SITE.dwg;????UTIL.dwg|Current Design Files2(*.dwg)|*BNDY.dwg;*CGP.dwg;*CUP.dwg;*CNTL.dwg;*CONT.dwg;*DEMO.dwg;*GCAL.dwg;*SD.dwg;*TOPO.dwg;*T-SITE.dwg;*UTIL.dwg|_JDH Files (*_JDH.dwg)|*_JDH.dwg";
            string defExt = ".dwg";

            string[] files = FileManager.getFiles(defExt, title, filter, dir);


            if (files == null || files.Length == 0)
            {
                return;
            }

            string jn = BaseObjs.jobNumber();

            object tMode = Application.GetSystemVariable("TILEMODE");

            if (tMode.ToString() != "1")
            {
                BaseObjs._editor.Command("_tilemode", "1", "");
            }

            BaseObjs._editor.Command("_ucs", "w", "");

            for (int i = 0; i < files.Length; i++)
            {
                string nameLayer = string.Format("_{0}", Path.GetFileNameWithoutExtension(files[i]));
                Layer.manageLayers(nameLayer);

                string nameXRef = nameLayer.Replace("_", "x");

                using (Transaction tr = BaseObjs.startTransactionDb())
                {
                    ObjectId id = BaseObjs._db.AttachXref(files[i], nameXRef);

                    if (!id.IsNull)
                    {
                        using (BlockReference br = new BlockReference(Point3d.Origin, id))
                        {
                            BlockTable       bt = (BlockTable)BaseObjs._db.BlockTableId.GetObject(OpenMode.ForRead);
                            BlockTableRecord ms = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
                            ms.AppendEntity(br);
                            tr.AddNewlyCreatedDBObject(br, true);
                            br.Layer = nameLayer;
                        }
                    }
                    tr.Commit();
                }
            }
            Editor ed = BaseObjs._editor;

            ed.Command("_.LAYER", "C", "9", "*TOPO*", "");
        }
Ejemplo n.º 5
0
        public RegionMassProperties()
        {
            var scaleUnitsValue = UnitsValue.Millimeters;
            var sysUnits        =
                Application.GetSystemVariable("INSUNITS").ToString();

            switch (sysUnits)
            {
            case "1":
                scaleUnitsValue = UnitsValue.Inches;
                break;

            case "2":
                scaleUnitsValue = UnitsValue.Feet;
                break;

            case "4":
                scaleUnitsValue = UnitsValue.Millimeters;
                break;

            case "5":
                scaleUnitsValue = UnitsValue.Centimeters;
                break;

            case "6":
                scaleUnitsValue = UnitsValue.Meters;
                break;

            case "14":
                scaleUnitsValue = UnitsValue.Decimeters;
                break;

            default:
                MessageBox.Show("\nUnits to scale inserted content: UNRECOGNIZED ?!", "units E R R O R");
                break;
            }
            AreaUnit    = scaleUnitsValue;
            IyUnit      = scaleUnitsValue;
            WyUpperUnit = scaleUnitsValue;
            WyLowerUnit = scaleUnitsValue;
            DUpperUnit  = scaleUnitsValue;
            DLowerUnit  = scaleUnitsValue;
            IyyUnit     = scaleUnitsValue;
            IzUnit      = scaleUnitsValue;
            WzRightUnit = scaleUnitsValue;
            WzLeftUnit  = scaleUnitsValue;
            DRightUnit  = scaleUnitsValue;
            DLeftUnit   = scaleUnitsValue;
            IzzUnit     = scaleUnitsValue;
            IminUnit    = scaleUnitsValue;
            ImaxUnit    = scaleUnitsValue;
        }
Ejemplo n.º 6
0
        protected void Save()
        {
            var previousCmdEcho = AcadApp.GetSystemVariable("CMDECHO");

            var lispCommand = new StringBuilder();

            lispCommand
            .Append("(setvar \"CMDECHO\" 0)")
            .Append("(command \"_.QSAVE\"")
            .AppendFormat("(setvar \"CMDECHO\" {0})", previousCmdEcho)
            .Append("(princ) ");

            AcadApp
            .DocumentManager
            .MdiActiveDocument
            .SendStringToExecute(lispCommand.ToString(), false, false, false);
        }
Ejemplo n.º 7
0
        protected void Save(string documentId)
        {
            var previousCmdEcho = AcadApp.GetSystemVariable("CMDECHO");

            var lispCommand = new StringBuilder();

            lispCommand
            .Append("(setvar \"CMDECHO\" 0)")
            .AppendFormat("(command \"_.SAVEAS\" \"\" \"{0}.DWG\")", documentId)
            .AppendFormat("(setvar \"CMDECHO\" {0})", previousCmdEcho)
            .Append("(princ) ");

            AcadApp
            .DocumentManager
            .MdiActiveDocument
            .SendStringToExecute(lispCommand.ToString(), false, false, false);

            UpdateCustomProperties(documentId);
        }
Ejemplo n.º 8
0
        public static void Setup()
        {
            // Установка flexBrics
            // 1. Добавить папку в доверенные
            var fbLocalDir = GetFBLocalDir();

            if (Directory.Exists(fbLocalDir))
            {
                if (isAcadVerLater2013())
                {
                    string trustedPath = AutoCadApp.GetSystemVariable("TRUSTEDPATHS").ToString();
                    if (!trustedPath.ToLower().Contains(fbLocalDir.ToLower()))
                    {
                        trustedPath += ";" + fbLocalDir + @"\...";
                        AutoCadApp.SetSystemVariable("TRUSTEDPATHS", trustedPath);
                    }
                    try
                    {
                        Log.Info("FlexBrics.Setup. trustedPath ={0}", trustedPath);
                    }
                    catch { }
                }

                // 2. Добавить в пути поиска
                dynamic preference = AutoCadApp.Preferences;
                string  supPath    = preference.Files.SupportPath;
                supPath = AddPath(fbLocalDir, supPath);                      //Папка flexBrics
                supPath = AddPath(Path.Combine(fbLocalDir, "dwg"), supPath); //папка dwg
                preference.Files.SupportPath = supPath;
                try
                {
                    Log.Info("FlexBrics.Setup. SupportPath ={0}", supPath);
                }
                catch { }
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// The internal Zoom() method (credit: AutoCAD .NET Developer's Guide).
        /// </summary>
        /// <param name="min"></param>
        /// <param name="max"></param>
        /// <param name="center"></param>
        /// <param name="factor"></param>
        internal static void Zoom(Point3d min, Point3d max, Point3d center, double factor)
        {
            // Get the current document and database
            var document = Application.DocumentManager.MdiActiveDocument;
            var database = document.Database;

            int currentViewport = Convert.ToInt32(Application.GetSystemVariable("CVPORT"));

            // Get the extents of the current space no points
            // or only a center point is provided
            // Check to see if Model space is current
            if (database.TileMode)
            {
                if (min.Equals(new Point3d()) && max.Equals(new Point3d()))
                {
                    min = database.Extmin;
                    max = database.Extmax;
                }
            }
            else
            {
                // Check to see if Paper space is current
                if (currentViewport == 1)
                {
                    // Get the extents of Paper space
                    if (min.Equals(new Point3d()) && max.Equals(new Point3d()))
                    {
                        min = database.Pextmin;
                        max = database.Pextmax;
                    }
                }
                else
                {
                    // Get the extents of Model space
                    if (min.Equals(new Point3d()) && max.Equals(new Point3d()))
                    {
                        min = database.Extmin;
                        max = database.Extmax;
                    }
                }
            }

            // Start a transaction
            using (var trans = database.TransactionManager.StartTransaction())
            {
                // Get the current view
                using (var currentView = document.Editor.GetCurrentView())
                {
                    Extents3d extents;

                    // Translate WCS coordinates to DCS
                    var matWCS2DCS = Matrix3d.PlaneToWorld(currentView.ViewDirection);
                    matWCS2DCS = Matrix3d.Displacement(currentView.Target - Point3d.Origin) * matWCS2DCS;
                    matWCS2DCS = Matrix3d.Rotation(
                        angle: -currentView.ViewTwist,
                        axis: currentView.ViewDirection,
                        center: currentView.Target) * matWCS2DCS;

                    // If a center point is specified, define the min and max
                    // point of the extents
                    // for Center and Scale modes
                    if (center.DistanceTo(Point3d.Origin) != 0)
                    {
                        min = new Point3d(center.X - (currentView.Width / 2), center.Y - (currentView.Height / 2), 0);
                        max = new Point3d((currentView.Width / 2) + center.X, (currentView.Height / 2) + center.Y, 0);
                    }

                    // Create an extents object using a line
                    using (Line line = new Line(min, max))
                    {
                        extents = new Extents3d(line.Bounds.Value.MinPoint, line.Bounds.Value.MaxPoint);
                    }

                    // Calculate the ratio between the width and height of the current view
                    double viewRatio = currentView.Width / currentView.Height;

                    // Tranform the extents of the view
                    matWCS2DCS = matWCS2DCS.Inverse();
                    extents.TransformBy(matWCS2DCS);

                    double  width;
                    double  height;
                    Point2d newCenter;

                    // Check to see if a center point was provided (Center and Scale modes)
                    if (center.DistanceTo(Point3d.Origin) != 0)
                    {
                        width  = currentView.Width;
                        height = currentView.Height;

                        if (factor == 0)
                        {
                            center = center.TransformBy(matWCS2DCS);
                        }

                        newCenter = new Point2d(center.X, center.Y);
                    }
                    else // Working in Window, Extents and Limits mode
                    {
                        // Calculate the new width and height of the current view
                        width  = extents.MaxPoint.X - extents.MinPoint.X;
                        height = extents.MaxPoint.Y - extents.MinPoint.Y;

                        // Get the center of the view
                        newCenter = new Point2d(
                            ((extents.MaxPoint.X + extents.MinPoint.X) * 0.5),
                            ((extents.MaxPoint.Y + extents.MinPoint.Y) * 0.5));
                    }

                    // Check to see if the new width fits in current window
                    if (width > (height * viewRatio))
                    {
                        height = width / viewRatio;
                    }

                    // Resize and scale the view
                    if (factor != 0)
                    {
                        currentView.Height = height * factor;
                        currentView.Width  = width * factor;
                    }

                    // Set the center of the view
                    currentView.CenterPoint = newCenter;

                    // Set the current view
                    document.Editor.SetCurrentView(currentView);
                }

                // Commit the changes
                trans.Commit();
            }
        }
Ejemplo n.º 10
0
        getDockLimits(int intNumDocks)
        {
            bool     exists          = false;
            ObjectId idDictGRADEDOCK = Dict.getNamedDictionary("GRADEDOCK", out exists);
            ObjectId idDictX         = default(ObjectId);

            if ((idDictGRADEDOCK == ObjectId.Null))
            {
                Autodesk.AutoCAD.ApplicationServices.Core.Application.ShowAlertDialog("GRADEDOCK dictionary missing - run AVG");
            }
            Point3d pnt3dPick;

            Entity ent = Select.selectEntity(typeof(Polyline3d), "\nSelect Finish Floor 3d Polyline: ",
                                             "3d Polyline selection failed.  Exiting...", out pnt3dPick);

            Polyline3d poly3d = (Polyline3d)ent;

            ResultBuffer rb = poly3d.ObjectId.getXData("AVG");

            if (rb == null)
            {
                return;
            }
            TypedValue[] tvs = rb.AsArray();

            bldgNum = tvs[2].Value.ToString();

            ObjectId idDictBLDG = Dict.getSubDict(idDictGRADEDOCK, bldgNum);

            ObjectId idDictDOCKS = Dict.getSubEntry(idDictBLDG, "DOCKS");

            if (idDictDOCKS == ObjectId.Null)
            {
                idDictDOCKS = Dict.addSubDict(idDictBLDG, "DOCKS");
            }

            using (BaseObjs._acadDoc.LockDocument())
            {
                Object selectCycling = Application.GetSystemVariable("SELECTIONCYCLING");
                Application.SetSystemVariable("SELECTIONCYCLING", 0);
                PromptStatus ps;
                try
                {
                    for (int i = 1; i < intNumDocks + 1; i++)
                    {
                        idDictX = Dict.addSubDict(idDictDOCKS, i.ToString(CultureInfo.InvariantCulture));

                        bool    escape   = false;
                        Point3d pnt3dRet = UserInput.getPoint(string.Format("\nSelect Dock {0} : Begin point (CCW orientation)", i), Pub.pnt3dO, out escape, out ps, osMode: 0);
                        BaseObjs.write("\n");

                        TypedValue[] TVs = new TypedValue[] {
                            new TypedValue(1040, pnt3dRet.X),
                            new TypedValue(1040, pnt3dRet.Y),
                            new TypedValue(1040, pnt3dRet.Z)
                        };

                        Dict.addXRec(idDictX, "BEG", TVs);

                        pnt3dRet = UserInput.getPoint(string.Format("\nSelect Dock {0} : End point (CCW orientation)", i), pnt3dRet, out escape, out ps, osMode: 0);
                        BaseObjs.write("\n");

                        TVs = new TypedValue[] {
                            new TypedValue(1040, pnt3dRet.X),
                            new TypedValue(1040, pnt3dRet.Y),
                            new TypedValue(1040, pnt3dRet.Z)
                        };

                        Dict.addXRec(idDictX, "END", TVs);
                    }
                }
                catch (System.Exception ex)
                {
                    BaseObjs.writeDebug(ex.Message + " Grading_Dock.cs: line: 85");
                }
                finally
                {
                    Application.SetSystemVariable("SELECTIONCYCLING", selectCycling);
                }
            }
        }
Ejemplo n.º 11
0
        public void GenerateUiFile()
        {
            string mainCui = Application.GetSystemVariable("MENUNAME") + ".cuix";

            string[] split   = mainCui.Split(new Char[] { '\\' });
            string   mainDir = "";

            for (int i = 0; i < split.Length - 2; i++)
            {
                mainDir += split[i]; mainDir += "\\";
            }

            string myCuiFile        = mainDir + "support\\KOJTO_3D.cuix";
            string myCuiSectionName = "KOJTO_3D";

            try
            {
                if (File.Exists(myCuiFile))
                {
                    File.Delete(myCuiFile);
                }
            }
            catch { }

            CustomizationSection pcs = new CustomizationSection();

            pcs.MenuGroupName = myCuiSectionName;

            #region macros
            MacroGroup mg            = new MacroGroup(myCuiSectionName, pcs.MenuGroup);
            MenuMacro  mmSettings    = new MenuMacro(mg, "KCAD_SETTINGS", "^C^CKCAD_SETTINGS", "ID_KCAD_SETTINGS");
            MenuMacro  mm0           = new MenuMacro(mg, "KCAD_NETLOAD", "^C^CNETLOAD", "ID_NETLOAD");
            MenuMacro  mm1           = new MenuMacro(mg, "KCAD_CREATEMESH", "^C^CKCAD_CREATEMESH", "ID_KCAD_CREATEMESH");
            MenuMacro  mm1C          = new MenuMacro(mg, "KCAD_READ_MESH_FROM_CSV", "^C^CKCAD_READ_MESH_FROM_CSV", "ID_KCAD_READ_MESH_FROM_CSV");
            MenuMacro  munC          = new MenuMacro(mg, "KCAD_DELETE_MESH_DATA", "^C^CKCAD_DELETE_MESH_DATA", "ID_KCAD_DELETE_MESH_DATA");
            MenuMacro  mm2           = new MenuMacro(mg, "KCAD_READMESH", "^C^CKCAD_READMESH", "ID_KCAD_READMESH");
            MenuMacro  mm3           = new MenuMacro(mg, "KCAD_SAVEMESH", "^C^CKCAD_SAVEMESH", "ID_KCAD_SAVEMESH");
            MenuMacro  mm4           = new MenuMacro(mg, "KCAD_DRAW", "^C^CKCAD_DRAW", "ID_KCAD_DRAW");
            MenuMacro  mm5           = new MenuMacro(mg, "KCAD_DRAW_NORMAL", "^C^CKCAD_DRAW_NORMALS", "ID_KCAD_DRAW_NORMAL");
            MenuMacro  mm5_          = new MenuMacro(mg, "KCAD_DRAW_NODE_UCS", "^C^CKCAD_DRAW_NODE_UCS", "ID_KCAD_DRAW_NODE_UCS");
            MenuMacro  mm67          = new MenuMacro(mg, "KCAD_SET_GLASS_DISTANCE_FOR_BEND", "^C^CKCAD_SET_GLASS_DISTANCE_FOR_BEND", "ID_KCAD_SET_GLASS_DISTANCE_FOR_BEND");
            MenuMacro  mm6           = new MenuMacro(mg, "KCAD_SET_GLASS_DISTANCE_FOR_ALL_BENDS", "^C^CKCAD_SET_GLASS_DISTANCE_FOR_ALL_BENDS", "ID_KCAD_SET_GLASS_DISTANCE_FOR_ALL_BENDS");
            MenuMacro  mm7           = new MenuMacro(mg, "KCAD_SHOW_GLASS", "^C^CKCAD_SHOW_GLASS", "ID_KCAD_SHOW_GLASS");
            MenuMacro  mm8           = new MenuMacro(mg, "KCAD_GLASS_EDGES", "^C^CKCAD_GLASS_EDGES_BY_FOLD_BASE", "ID_KCAD_GLASS_EDGES");
            MenuMacro  mm8A          = new MenuMacro(mg, "KCAD_GLASS_EDGES_", "^C^CKCAD_GLASS_EDGES_BY_UNFOLD_BASE", "ID_KCAD_GLASS_EDGES");
            MenuMacro  mm9           = new MenuMacro(mg, "KCAD_REVERSE", "^C^CKCAD_REVERSE", "ID_KCAD_REVERSE");
            MenuMacro  mm10          = new MenuMacro(mg, "KCAD_GlASS_CONTURS_BY_LEVEL", "^C^CGET_GlASS_CONTURS_BY_LEVEL", "ID_KCAD_GlASS_CONTURS_BY_LEVEL");
            MenuMacro  mm11          = new MenuMacro(mg, "KCAD_GlASS_CONTURS_UNFOLD_BY_LEVEL", "^C^CGET_GlASS_CONTURS_UNFOLD_BY_LEVEL", "ID_KCAD_GlASS_CONTURS_UNFOLD_BY_LEVEL");
            MenuMacro  mmAA          = new MenuMacro(mg, "KCAD_GET_BY_NUMER", "^C^CKCAD_GET_BY_NUMER", "ID_KCAD_GET_BY_NUMER");
            MenuMacro  mmAB          = new MenuMacro(mg, "KCAD_GET_BY_SELECTION", "^C^CKCAD_GET_BY_SELECTION", "ID_KCAD_GET_BY_SELECTION");
            MenuMacro  mmDIST        = new MenuMacro(mg, "KCAD_SET_GLASS_DISTANCE_TO_BEND_BY_NUMER", "^C^CKCAD_SET_GLASS_DISTANCE_TO_BEND_BY_NUMER", "ID_SET_GLASS_DISTANCE_TO_BEND_BY_NUMER");
            MenuMacro  mmGlasUnfolds = new MenuMacro(mg, "KCAD_GlASS_UNFOLDS_BY_LEVEL", "^C^CKCAD_GlASS_UNFOLDS_BY_LEVEL", "ID_KCAD_GlASS_UNFOLDS_BY_LEVEL");
            MenuMacro  mm08          = new MenuMacro(mg, "KCAD_DRAW_NODES_NORMALS_BY_NOFICTIVE", "^C^CKCAD_DRAW_NODES_NORMALS_BY_NOFICTIVE", "ID_KCAD_DRAW_NODES_NORMALS_BY_NOFICTIVE");
            MenuMacro  mm09          = new MenuMacro(mg, "KCAD_CHANGE_SELECTED_BENDS_NORMALS", "^C^CKCAD_CHANGE_SELECTED_BENDS_NORMALS", "ID_KCAD_CHANGE_SELECTED_BENDS_NORMALS");
            MenuMacro  mm091         = new MenuMacro(mg, "KCAD_SET_EXPLICIT_NODE_NORMAL_BY_POSITION", "^C^CKCAD_SET_EXPLICIT_NODE_NORMAL_BY_POSITION", "ID_KCAD_SET_EXPLICIT_NODE_NORMAL_BY_POSITION");

            MenuMacro mmPrf1   = new MenuMacro(mg, "KCAD_READ_PROFILE_DATA", "^C^CKCAD_DRAW_PROFILE_SOLID", "ID_KCAD_KCAD_DRAW_PROFILE_SOLID");
            MenuMacro mmPrf1_  = new MenuMacro(mg, "KCAD_READ_PROFILE_DATA_A", "^C^CKCAD_DRAW_PROFILE_SOLID_A", "ID_KCAD_KCAD_DRAW_PROFILE_SOLID_A");
            MenuMacro mmPrf1__ = new MenuMacro(mg, "KCAD_ADD_PROFILE_POINT_TO_FILE", "^C^CKCAD_ADD_PROFILE_POINT_TO_FILE", "ID_KCAD_ADD_PROFILE_POINT_TO_FILE");
            MenuMacro mmPrf2   = new MenuMacro(mg, "KCAD_PREPARE_PROFILE_UNFOLD", "^C^CKCAD_PREPARE_PROFILE_UNFOLD", "ID_KCAD_PREPARE_PROFILE_UNFOLD");


            MenuMacro mmCAM_CNC  = new MenuMacro(mg, "KCAD_NODE_TO_CNC", "^C^CKCAD_NODE_TO_CNC", "ID_KCAD_NODE_TO_CNC");
            MenuMacro mmCAM_CNC1 = new MenuMacro(mg, "KCAD_NODE_TO_CSV", "^C^CKCAD_NODE_TO_CSV", "ID_KCAD_NODE_TO_CSV");
            MenuMacro mmCAM_CN1  = new MenuMacro(mg, "KCAD_POLYGONS_CSV", "^C^CKCAD_POLYGONS_CSV", "ID_KCAD_POLIGONS_CSV");

            MenuMacro mmPlacement_3D_0    = new MenuMacro(mg, "KCAD_PLACEMENT_OF_NODE_3D_IN_POSITION", "^C^CKCAD_PLACEMENT_OF_NODE_3D_IN_POSITION", "ID_KCAD_PLACEMENT_OF_NODE_3D_IN_POSITION");
            MenuMacro mmPlacement_3D_00   = new MenuMacro(mg, "KCAD_PLACEMENT_OF_NODE_3D_IN_POSITION_DELETE", "^C^CKCAD_PLACEMENT_OF_NODE_3D_IN_POSITION_DELETE", "ID_KCAD_PLACEMENT_OF_NODE_3D_IN_POSITION_DELETE");
            MenuMacro mmPlacement_3D_000  = new MenuMacro(mg, "KCAD_PLACEMENT_OF_NODE_3D_IN_POSITION_HIDE", "^C^CKCAD_PLACEMENT_OF_NODE_3D_IN_POSITION_HIDE", "ID_KCAD_PLACEMENT_OF_NODE_3D_IN_POSITION_HIDE");
            MenuMacro mmPlacement_3D_0000 = new MenuMacro(mg, "KCAD_PLACEMENT_OF_NODE_3D_IN_POSITION_SHOW", "^C^CKCAD_PLACEMENT_OF_NODE_3D_IN_POSITION_SHOW", "ID_KCAD_PLACEMENT_OF_NODE_3D_IN_POSITION_SHOW");
            MenuMacro mmPlacement_3D_1    = new MenuMacro(mg, "PLACEMENT_OF_BENDS_NOZZLE_BLOCKS_IN_NODES", "^C^CKCAD_PLACEMENT_OF_BENDS_NOZZLE_BLOCKS_IN_NODES", "ID_KCAD_PLACEMENT_OF_BENDS_NOZZLE_BLOCKS_IN_NODES");
            MenuMacro mmPlacement_3D_100  = new MenuMacro(mg, "KCAD_PLACEMENT_OF_BENDS_NOZZLE_3D_IN_POSITION_HIDE", "^C^CKCAD_PLACEMENT_OF_BENDS_NOZZLE_3D_IN_POSITION_HIDE", "ID_KCAD_PLACEMENT_OF_BENDS_NOZZLE_3D_IN_POSITION_HIDE");
            MenuMacro mmPlacement_3D_1000 = new MenuMacro(mg, "KCAD_PLACEMENT_OF_BENDS_NOZZLE_3D_IN_POSITION_SHOW", "^C^CKCAD_PLACEMENT_OF_BENDS_NOZZLE_3D_IN_POSITION_SHOW", "ID_KCAD_PLACEMENT_OF_BENDS_NOZZLE_3D_IN_POSITION_SHOW");
            MenuMacro mmPlacement_3D_10   = new MenuMacro(mg, "PLACEMENT_OF_BEND_NOZZLE_3D_DELETE", "^C^CKCAD_PLACEMENT_OF_BEND_NOZZLE_3D_DELETE", "ID_KCAD_PLACEMENT_OF_BEND_NOZZLE_3D_DELETE");
            MenuMacro mmPlacement_3D_2    = new MenuMacro(mg, "KCAD_PLACEMENT_BENDS_3D", "^C^CKCAD_PLACEMENT_BENDS_3D", "ID_KCAD_PLACEMENT_BENDS_3D");
            MenuMacro mmPlacement_3D_3    = new MenuMacro(mg, "KCAD_PLACEMENT_BEND_3D_DELETE", "^C^CKCAD_PLACEMENT_BEND_3D_DELETE", "ID_KCAD_PLACEMENT_BEND_3D_DELETE");
            MenuMacro mmPlacement_3D_4    = new MenuMacro(mg, "KCAD_PLACEMENT_OF_BENDS_3D_IN_POSITION_HIDE", "^C^CKCAD_PLACEMENT_OF_BENDS_3D_IN_POSITION_HIDE", "ID_KCAD_PLACEMENT_OF_BENDS_3D_IN_POSITION_HIDE");
            MenuMacro mmPlacement_3D_5    = new MenuMacro(mg, "KCAD_PLACEMENT_OF_BENDS_3D_IN_POSITION_SHOW", "^C^CKCAD_PLACEMENT_OF_BENDS_3D_IN_POSITION_SHOW", "ID_KCAD_PLACEMENT_OF_BENDS_3D_IN_POSITION_SHOW");
            MenuMacro mmCAM_Check         = new MenuMacro(mg, "KCAD_CALC_MIN_CAM_RADIUS", "^C^CKCAD_CALC_MIN_CAM_RADIUS", "ID_KCAD_CALC_MIN_CAM_RADIUS");

            MenuMacro mmFixing = new MenuMacro(mg, "KCAD_ADD_FIXING_ELEMENTS", "^C^CKCAD_ADD_FIXING_ELEMENTS", "ID_KCAD_ADD_FIXING_ELEMENTS");
            MenuMacro mmRB     = new MenuMacro(mg, "KCAD_RESTORE_BENDS_NORMALS", "^C^CKCAD_RESTORE_BENDS_NORMALS", "ID_KCAD_RESTORE_BENDS_NORMALS");
            MenuMacro mmRN     = new MenuMacro(mg, "KCAD_RESTORE_NODES_NORMALS", "^C^CKCAD_RESTORE_NODES_NORMALS", "ID_KCAD_RESTORE_NODES_NORMALS");
            MenuMacro mmTN     = new MenuMacro(mg, "KCAD_SET_ALL_NODES_NORMALS_EXPLICIT", "^C^CKCAD_SET_ALL_NODES_NORMALS_EXPLICIT", "ID_KCAD_SET_ALL_NODES_NORMALS_EXPLICIT");

            MenuMacro mmGlass_DOUBLE1 = new MenuMacro(mg, "KCAD_SHOW_DOUBLE_GLAS", "^C^CKCAD_SHOW_DOUBLE_GLAS", "ID_KCAD_SHOW_DOUBLE_GLAS");
            MenuMacro mmGlass_DOUBLE2 = new MenuMacro(mg, "KCAD_DOUBLE_GlASS_UNFOLDS_TRIANGLE", "^C^CKCAD_DOUBLE_GlASS_UNFOLDS_TRIANGLE", "ID_KCAD_DOUBLE_GlASS_UNFOLDS_TRIANGLE");
            MenuMacro mmGlass_DOUBLE3 = new MenuMacro(mg, "KCAD_BENDS_TO_SEPARATE_DRAWINGS", "^C^CKCAD_BENDS_TO_SEPARATE_DRAWINGS", "ID_KCAD_BENDS_TO_SEPARATE_DRAWINGS");

            MenuMacro mmRCN = new MenuMacro(mg, "KCAD_PLACEMENT_BENDS_3D_BY_NORMALS", "^C^CKCAD_PLACEMENT_BENDS_3D_BY_NORMALS", "ID_KCAD_PLACEMENT_BENDS_3D_BY_NORMALS");
            MenuMacro mmRPN = new MenuMacro(mg, "KCAD_BEND_SECTION_TO_SEPARATE_DRAWINGS", "^C^CKCAD_BEND_SECTION_TO_SEPARATE_DRAWINGS", "ID_KCAD_BEND_SECTION_TO_SEPARATE_DRAWINGS");
            MenuMacro mmDN  = new MenuMacro(mg, "KCAD_DRAW_NUMERS", "^C^CKCAD_DRAW_NUMERS", "ID_KCAD_DRAW_NUMERS");

            MenuMacro mmEN = new MenuMacro(mg, "KCAD_DRAW_SECOND_MESH", "^C^CKCAD_DRAW_SECOND_MESH", "ID_KCAD_DRAW_SECOND_MESH");

            MenuMacro mmRES = new MenuMacro(mg, "KCAD_RESTORE_NODE_NORMAL_BY_SELECTION", "^C^CKCAD_RESTORE_NODE_NORMAL_BY_SELECTION", "ID_KCAD_RESTORE_NODE_NORMAL_BY_SELECTION");
            MenuMacro mmCH  = new MenuMacro(mg, "KCAD_KCAD_CHANGE_EXPLICIT_NORMAL_LENGTH_SELECTION", "^C^CKCAD_CHANGE_EXPLICIT_NORMAL_LENGTH_SELECTION", "ID_KCAD_CHANGE_EXPLICIT_NORMAL_LENGTH_SELECTION");

            MenuMacro mmS = new MenuMacro(mg, "KCAD_KCAD_ATTACHING_A_SOLID3D_TO_BEND", "^C^CKCAD_ATTACHING_A_SOLID3D_TO_BEND", "ID_KCAD_ATTACHING_A_SOLID3D_TO_BEND");

            MenuMacro mmS1 = new MenuMacro(mg, "KCAD_KCAD_RESTORE_BEND_NORMAL", "^C^CKCAD_RESTORE_BEND_NORMAL", "ID_KCAD_RESTORE_BEND_NORMAL");

            MenuMacro mmS2 = new MenuMacro(mg, "KCAD_KCAD_EXPROF", "^C^CKCAD_EXPROF", "ID_KCAD_EXPROF");
            MenuMacro mmS3 = new MenuMacro(mg, "KCAD_EXTRIM", "^C^CKCAD_EXTRIM", "ID_KCAD_EXTRIM");

            MenuMacro mmS4 = new MenuMacro(mg, "KCAD_GlASS_POLYGON_UNFOLDS_BY_LEVEL", "^C^CKCAD_GlASS_POLYGON_UNFOLDS_BY_LEVEL", "ID_KCAD_GlASS_POLYGON_UNFOLDS_BY_LEVEL");
            MenuMacro mmS5 = new MenuMacro(mg, "KCAD_GlASS_TRIANGLE_UNFOLDS_BY_LEVEL", "^C^CKCAD_GlASS_TRIANGLE_UNFOLDS_BY_LEVEL", "ID_KCAD_GlASS_TRIANGLE_UNFOLDS_BY_LEVEL");

            MenuMacro mm0_help  = new MenuMacro(mg, "KCAD_READMESH_GET_HELP", "^C^CKCAD_READMESH_GET_HELP", "ID_KCAD_READMESH_GET_HELP");
            MenuMacro mm11_help = new MenuMacro(mg, "KCAD_SAVEMESH_GET_HELP", "^C^CKCAD_SAVEMESH_GET_HELP", "ID_KCAD_SAVEMESH_GET_HELP");
            MenuMacro mm2_help  = new MenuMacro(mg, "KCAD_DRAW_NODES_NORMALS_BY_NOFICTIVE_HELP", "^C^CKCAD_DRAW_NODES_NORMALS_BY_NOFICTIVE_HELP", "ID_KCAD_DRAW_NODES_NORMALS_BY_NOFICTIVE_HELP");

            MenuMacro mmHELP = new MenuMacro(mg, "KCAD_HELP", "^C^CKCAD_HELP", "ID_KCAD_HELP");
            // MenuMacro mmCCAM = new MenuMacro(mg, "CALC MIN CAM RADIUS", "^C^CKCAD_CALC_MIN_CAM_RADIUS", "ID_KCAD_CALC_MIN_CAM_RADIUS");

            MenuMacro mmHEeP = new MenuMacro(mg, "KCAD_CUTTING_BENDS_IN_NODES", "^C^CKCAD_CUTTING_BENDS_IN_NODES", "ID_KCAD_CUTTING_BENDS_IN_NODES");

            MenuMacro mm0CSV = new MenuMacro(mg, "KCAD_READ_NAMED_POINTS_FROM_CSV", "^C^CKCAD_READ_NAMED_POINTS_FROM_CSV", "ID_KCAD_READ_NAMED_POINTS_FROM_CSV");
            MenuMacro mm1CSV = new MenuMacro(mg, "KCAD_NAMED_POINTS_DRAW", "^C^CKCAD_NAMED_POINTS_DRAW", "ID_KCAD_NAMED_POINTS_DRAW");

            MenuMacro mmGHG  = new MenuMacro(mg, "HIDE GLASS", "^C^CKCAD_HIDE_GLASS", "ID_KCAD_HIDE_GLASS");
            MenuMacro mmGSHG = new MenuMacro(mg, "SHOW HIDEN GLASS", "^C^CKCAD_SHOW_HIDEN_GLASS", "ID_KCAD_SHOW_HIDEN_GLASS");

            MenuMacro mmdGHG  = new MenuMacro(mg, "HIDE DOUBLE GLASS", "^C^CKCAD_HIDE_DOUBLE_GLASS", "ID_KCAD_HIDE_DOUBLE_GLASS");
            MenuMacro mmdGSHG = new MenuMacro(mg, "SHOW HIDEN DOUBLE GLASS", "^C^CKCAD_SHOW_HIDEN_DOUBLE_GLASS", "ID_KCAD_SHOW_HIDEN_DOUBLE_GLASS");

            MenuMacro mmCG = new MenuMacro(mg, "CENTER of Gravity", "^C^CKCAD_GET_REAL_CENTROID", "ID_KCAD_GET_REAL_CENTROID");

            MenuMacro mmGCC = new MenuMacro(mg, "SPOTS from glass on the triangles - CENTER of Gravity", "^C^CKCAD_GET_GLASS_CONTURS_CENTROID", "ID_KCAD_GET_GLASS_CONTURS_CENTROID");
            MenuMacro mmTBC = new MenuMacro(mg, "TEORETICAL MESH CENTROID", "^C^CKCAD_GET_TEORETICAL_BENDS_CENTROID", "ID_KCAD_GET_TEORETICAL_BENDS_CENTROID");

            MenuMacro mmCPS  = new MenuMacro(mg, "SET_CUT_PROFILE_PARAM_GLOBAL", "^C^CKCAD_SET_CUT_SOLID_LK", "ID_KCAD_SET_CUT_SOLID_LK");
            MenuMacro mmCPS1 = new MenuMacro(mg, "SET_CUT_PROFILE_PARAM_GLOBAL", "^C^CKCAD_SET_CUT_SOLID_TH", "ID_KCAD_SET_CUT_SOLID_TH");
            MenuMacro mmCPS3 = new MenuMacro(mg, "SET_CUT_SOLID_ER_GLOBAL", "^C^CKCAD_SET_CUT_SOLID_ER", "ID_KCAD_SET_CUT_SOLID_ER");
            MenuMacro mmCPS2 = new MenuMacro(mg, "SET_CUT_PROFILE_PARAM_BY_BEND_NUMER", "^C^CKCAD_SET_BEND_EXPLICIT_PARAMETERS", "ID_KCAD_SET_BEND_EXPLICIT_PARAMETERS");

            MenuMacro mmCPS4 = new MenuMacro(mg, "TRIMING_VERTICES_VARIANT", "^C^CKCAD_CHANGE_PICK_TRIM_VARIANT", "ID_KCAD_CHANGE_PICK_TRIM_VARIANT");

            MenuMacro mmCPS5 = new MenuMacro(mg, "ERASE_GLASS_3D", "^C^CKCAD_PLACEMENT_3D_GLASS_DELETE", "ID_KCAD_PLACEMENT_3D_GLASS_DELETE");

            MenuMacro mmERS5  = new MenuMacro(mg, "EX_RATIO_BY_BEND", "^C^CKCAD_EX_RATIO_BY_BEND", "ID_KCAD_EX_RATIO_BY_BEND");
            MenuMacro mmERS4  = new MenuMacro(mg, "EXPLICIT_CUTTING_METHOD", "^C^CKCAD_EXPLICIT_CUTTING_METHOD_FOR_ENDS_IN_NODE", "ID_KCAD_EXPLICIT_CUTTING_METHOD_FOR_ENDS_IN_NODE");
            MenuMacro mmER5S5 = new MenuMacro(mg, "CLEAR_EXPLICIT_CUTTING_METHOD", "^C^CKCAD_CLEAR_EXPLICIT_CUTTING_METHOD_FOR_ALL", "ID_KCAD_CLEAR_EXPLICIT_CUTTING_METHOD_FOR_ALL");

            MenuMacro mmERP5 = new MenuMacro(mg, "PROJECT_POINT_TO_PLANE", "^C^CKCAD_PROJECT_POINT_TO_PLANE", "ID_KCAD_PROJECT_POINT_TO_PLANE");

            MenuMacro mmERT5 = new MenuMacro(mg, "ANGLE BETWEEN TRIANGLES", "^C^CKCAD_ANGLE_BETWEEN_TRIANGLES", "ID_KCAD_ANGLE_BETWEEN_TRIANGLES");

            MenuMacro mmMDN = new MenuMacro(mg, "MINIMUMU DISTANCE TO NODE", "^C^CKCAD_NEAREST_FROM_NODES", "ID_KCAD_NEAREST_FROM_NODES");
            MenuMacro mmMDB = new MenuMacro(mg, "MINIMUMU DISTANCE TO BEND MID", "^C^CKCAD_NEAREST_BEND_MIDPOINT", "ID_KCAD_NEAREST_BEND_MIDPOINT");
            MenuMacro mmMDT = new MenuMacro(mg, "MINIMUMU DISTANCE TO TRIANGLE MID", "^C^CKCAD_NEAREST_TRIANGLE_MIDPOINT", "ID_KCAD_NEAREST_TRIANGLE_MIDPOINT");

            MenuMacro mmRSM1 = new MenuMacro(mg, "READ MESH FROM EXTERNAL", "^C^CKCAD_READ_CONTAINER_FROM_EXTERNAL_FILE", "ID_KCAD_READ_CONTAINER_FROM_EXTERNAL_FILE");
            MenuMacro mmRSM2 = new MenuMacro(mg, "SAVE MESH TO EXTERNAL", "^C^CKCAD_SAVE_CONTAINER_IN_EXTERNAL_FILE", "ID_KCAD_SAVE_CONTAINER_IN_EXTERNAL_FILE");

            MenuMacro mmDSN = new MenuMacro(mg, "CREATE NEW MESH FROM CURRENT THROUGH END OF NORMALS", "^C^CKCAD_SMB", "ID_KCAD_NEAREST_FROM_NODES");

            MenuMacro mmMDBS = new MenuMacro(mg, "REURN MINIMAL DISTANCE BETWEEN SOLIDS", "^C^CKCAD_MIN_DISTANCE_BETWEEN_SOLID3D", "ID_KCAD_MIN_DISTANCE_BETWEEN_SOLID3D");

            MenuMacro mmITP = new MenuMacro(mg, "INTERSECTION LINE BETWEE TWO PLANES", "^C^CKCAD_INTERSECTION_LINE_BETWEEN_TWO_PLANES", "ID_KCAD_INTERSECTION_LINE_BETWEEN_TWO_PLANES");

            MenuMacro mmCALC = new MenuMacro(mg, "CALCULATE FORMULA", "^C^CKCAD_CALCULATE_FORMULA", "ID_KCAD_CALCULATE_FORMULA");
            #endregion ;

            StringCollection sc = new StringCollection();
            sc.Add("POP15");

            PopMenu     pm          = new PopMenu(myCuiSectionName, sc, "ID_MyPop1", pcs.MenuGroup);
            PopMenuItem pmi000      = new PopMenuItem(mmCALC, "CALCULATE FORMULA", pm, -1);
            PopMenuItem pmi_000     = new PopMenuItem(pm, -1);
            PopMenuItem pmi0        = new PopMenuItem(mm0, "NETLOAD", pm, -1);
            PopMenuItem pmi_h0      = new PopMenuItem(pm, -1);
            PopMenuItem pmiHELP     = new PopMenuItem(mmHELP, "HELP", pm, -1);
            PopMenuItem pmi_0       = new PopMenuItem(pm, -1);
            PopMenuItem pmiSettings = new PopMenuItem(mmSettings, "SETTINGS", pm, -1);


            PopMenuItem pmi_sie = new PopMenuItem(pm, -1);
            #region mesh
            StringCollection scMESH      = new StringCollection();
            PopMenu          pmMESH      = new PopMenu("MESH", scMESH, "ID_SubscMESH", pcs.MenuGroup);
            PopMenuItem      pmi1        = new PopMenuItem(mm1, "CREATE  MESH", pmMESH, -1);
            PopMenuItem      pmi1C       = new PopMenuItem(mm1C, "READ MESH FROM CSV file", pmMESH, -1);
            PopMenuItem      pmi_se      = new PopMenuItem(pmMESH, -1);
            PopMenuItem      pmi2        = new PopMenuItem(mm2, "READ  MESH from this DWG (from dictionary)", pmMESH, -1);
            PopMenuItem      pmij2       = new PopMenuItem(mmRSM1, "READ  MESH from External TXT file", pmMESH, -1);
            PopMenuItem      pmi2_help   = new PopMenuItem(mm0_help, "Read mesh HELP topic", pmMESH, -1);
            PopMenuItem      pmi_se_help = new PopMenuItem(pmMESH, -1);
            PopMenuItem      pmi4        = new PopMenuItem(mm3, "SAVE  MESH in this DWG (in dictionary)", pmMESH, -1);
            PopMenuItem      pmij4       = new PopMenuItem(mmRSM2, "SAVE  MESH to External TXT File", pmMESH, -1);
            PopMenuItem      pmi3_help   = new PopMenuItem(mm11_help, "Save mesh HELP topic", pmMESH, -1);
            PopMenuItem      pmi_se_     = new PopMenuItem(pmMESH, -1);
            PopMenuItem      pmdd_help   = new PopMenuItem(munC, "Delete Mesh Data from Dictionary", pmMESH, -1);
            PopMenuItem      pmi_dd_help = new PopMenuItem(pmMESH, -1);
            PopMenuItem      pmu3_help   = new PopMenuItem(mmTBC, "Teoretical mesh (No fictive Bends) - Center of Gravity", pmMESH, -1);
            PopMenuItem      pmi_ge_     = new PopMenuItem(pmMESH, -1);
            PopMenuItem      pmi5        = new PopMenuItem(mm4, "DRAW", pmMESH, -1);
            PopMenuItem      pmi6        = new PopMenuItem(mm5, "DRAW  NORMALS", pmMESH, -1);
            PopMenuItem      pmi_7       = new PopMenuItem(mmEN, "LINK the ENDS of NORMALS in the NODES", pmMESH, -1);
            PopMenuItem      pmi_8       = new PopMenuItem(mmDSN, "CREATE NEW MESH FROM CURRENT THROUGH END OF NORMALS", pmMESH, -1);
            PopMenuItem      pmi_ise_    = new PopMenuItem(pmMESH, -1);
            PopMenuItem      pmi06       = new PopMenuItem(mm08, "DRAW  NODE NORMALS BY NoFictive Bends", pmMESH, -1);
            PopMenuItem      pmi06_help  = new PopMenuItem(mm2_help, "HELP", pmMESH, -1);
            PopMenuItem      pmi_siie_   = new PopMenuItem(pmMESH, -1);
            PopMenuItem      pmi07_      = new PopMenuItem(mm5_, "DRAW  NODE UCS BY NoFictive Bends", pmMESH, -1);
            PopMenuItem      pmi07i_     = new PopMenuItem(mmDN, "DRAW  NUMERS", pmMESH, -1);
            PopMenuItem      pmi_se__    = new PopMenuItem(pmMESH, -1);
            PopMenuItem      pmui        = new PopMenuItem(mmAA, "GET_BY_NUMER", pmMESH, -1);
            PopMenuItem      pmuii       = new PopMenuItem(mmAB, "GET_BY_SELECTION", pmMESH, -1);
            PopMenuItem      pmSGff2     = new PopMenuItem(mmERT5, "Angle between the NORMALS of the adjacent Triangles", pmMESH, -1);
            PopMenuItem      pmi_gue_    = new PopMenuItem(pmMESH, -1);

            StringCollection scMESH_MINIMUM_DISTANCES = new StringCollection();
            PopMenu          pmMESH_MINIMUM_DISTANCES = new PopMenu("Minimum Distance to ..", scMESH_MINIMUM_DISTANCES, "ID_MINDIST", pcs.MenuGroup);
            PopMenuItem      pmMD1 = new PopMenuItem(mmMDN, "to Node", pmMESH_MINIMUM_DISTANCES, -1);
            PopMenuItem      pmMD2 = new PopMenuItem(mmMDB, "to Bend Mid Point", pmMESH_MINIMUM_DISTANCES, -1);
            PopMenuItem      pmMD3 = new PopMenuItem(mmMDT, "to Triangle Centroid", pmMESH_MINIMUM_DISTANCES, -1);
            PopMenuRef       pmMESH_MINIMUM_DISTANCES_Ref = new PopMenuRef(pmMESH_MINIMUM_DISTANCES, pmMESH, -1);
            pmMESH.PopMenuItems.Add(pmMESH_MINIMUM_DISTANCES_Ref);

            PopMenuItem pmi_seo__ = new PopMenuItem(pmMESH, -1);

            StringCollection scMESH_MODIFY_NORMALS = new StringCollection();
            PopMenu          pmMESH_MODIFY_NORMALS = new PopMenu("MODIFY NORMALS", scMESH_MODIFY_NORMALS, "ID_SubscMESH", pcs.MenuGroup);
            PopMenuItem      pmi10     = new PopMenuItem(mm9, "REVERSE NORMALS", pmMESH_MODIFY_NORMALS, -1);
            PopMenuItem      pmt_seo__ = new PopMenuItem(pmMESH_MODIFY_NORMALS, -1);
            PopMenuItem      pmi010    = new PopMenuItem(mm09, "SET EXPLICIT BENDS NORMALS BY DIRECTION", pmMESH_MODIFY_NORMALS, -1);
            PopMenuItem      pmr010    = new PopMenuItem(mmRB, "RESTORE BENDS NORMALS", pmMESH_MODIFY_NORMALS, -1);
            PopMenuItem      pmi0100   = new PopMenuItem(mmS1, "RESTORE BEND NORMAL", pmMESH_MODIFY_NORMALS, -1);
            PopMenuItem      pmt_seo_  = new PopMenuItem(pmMESH_MODIFY_NORMALS, -1);
            PopMenuItem      pmi011    = new PopMenuItem(mm091, "SET EXPLICIT NODE NORMAL", pmMESH_MODIFY_NORMALS, -1);
            PopMenuItem      pmi012    = new PopMenuItem(mmTN, "SET ALL NOES NORMALS EXPLICIT (by bends midpoints centroid)", pmMESH_MODIFY_NORMALS, -1);
            PopMenuItem      pmr011    = new PopMenuItem(mmRN, "RESTORE NODE NORMALS", pmMESH_MODIFY_NORMALS, -1);
            PopMenuItem      pmr01_1   = new PopMenuItem(mmRES, "RESTORE NODE NORMAL BY SELECTION", pmMESH_MODIFY_NORMALS, -1);
            PopMenuItem      pmr01_2   = new PopMenuItem(mmCH, "CHENGE EXPLICIT NORMAL LENGTH SELECTION", pmMESH_MODIFY_NORMALS, -1);
            //PopMenuItem pmt_seo = new PopMenuItem(pmMESH_MODIFY_NORMALS, -1);
            PopMenuRef pmMESH__MODIFY_NORMALS_Ref = new PopMenuRef(pmMESH_MODIFY_NORMALS, pmMESH, -1);
            pmMESH.PopMenuItems.Add(pmMESH__MODIFY_NORMALS_Ref);
            PopMenuRef pmMESH_Ref = new PopMenuRef(pmMESH, pm, -1);
            pm.PopMenuItems.Add(pmMESH_Ref);
            #endregion

            PopMenuItem pmi_seu__ = new PopMenuItem(pm, -1);
            #region glass
            StringCollection scGLASS      = new StringCollection();
            PopMenu          pmGLASS      = new PopMenu("GLASS", scGLASS, "ID_GLASS", pcs.MenuGroup);
            PopMenuItem      pmi7         = new PopMenuItem(mm7, "MAKE and SHOW  GLASS", pmGLASS, -1);
            PopMenuItem      pmi7_        = new PopMenuItem(mmGHG, "HIDE  GLASS", pmGLASS, -1);
            PopMenuItem      pmi7__       = new PopMenuItem(mmGSHG, "SHOW HIDEN GLASS", pmGLASS, -1);
            PopMenuItem      pmi5__       = new PopMenuItem(mmCPS5, "ERASE GLASS 3D and from database", pmGLASS, -1);
            PopMenuItem      pmi_s_e_____ = new PopMenuItem(pmGLASS, -1);
            PopMenuItem      pmi8CG       = new PopMenuItem(mmGCC, "spots from glass on the triangles - Center of Gravity", pmGLASS, -1);
            PopMenuItem      pmi8         = new PopMenuItem(mm8, "SHOW GLASS EDGES (spots from glass on the triangles)", pmGLASS, -1);
            // PopMenuItem pmi8A = new PopMenuItem(mm8A, "SHOW GLASS EDGES_BY_UNFOLD_BASE", pmGLASS, -1);
            PopMenuItem      pmi8B              = new PopMenuItem(mm10, "SHOW GlASS_CONTURS_BY_LEVEL", pmGLASS, -1);
            PopMenuItem      pmi8C              = new PopMenuItem(mm11, "SHOW GlASS_CONTURS_UNFOLD_BY_LEVEL", pmGLASS, -1);
            PopMenuItem      pmi_s_e____        = new PopMenuItem(pmGLASS, -1);
            PopMenuItem      pmi8C_             = new PopMenuItem(mmGlasUnfolds, "SEPARATE ALL - GlASS UNFOLDS BY LEVEL", pmGLASS, -1);
            PopMenuItem      pmi8F_             = new PopMenuItem(mmS5, "SEPARATE BY NUMER - TRIANGLE GLASS UNFOLDS", pmGLASS, -1);
            PopMenuItem      pmi8FF_            = new PopMenuItem(mmS4, "SEPARATE BY NUMER- POLYGON GLASS UNFOLDS", pmGLASS, -1);
            PopMenuItem      pmi_se____         = new PopMenuItem(pmGLASS, -1);
            StringCollection scGLASS_DOUBLE     = new StringCollection();
            PopMenu          pmGLASS_DOUBLE     = new PopMenu("DOUBLE GLASS", scGLASS_DOUBLE, "ID_GLASS_DOUBLE", pcs.MenuGroup);
            PopMenuItem      pmu7               = new PopMenuItem(mmGlass_DOUBLE1, "SHOW", pmGLASS_DOUBLE, -1);
            PopMenuItem      pmx7               = new PopMenuItem(mmdGHG, "HIDE DOUBLE GLASS", pmGLASS_DOUBLE, -1);
            PopMenuItem      pmx7_              = new PopMenuItem(mmdGSHG, "SHOW HIDEN DOUBLE GLASS", pmGLASS_DOUBLE, -1);
            PopMenuItem      pmi8__             = new PopMenuItem(mmCPS5, "ERASE GLASS 3D and from database", pmGLASS_DOUBLE, -1);
            PopMenuItem      pmi_soe____        = new PopMenuItem(pmGLASS_DOUBLE, -1);
            PopMenuItem      pmu8               = new PopMenuItem(mmGlass_DOUBLE2, "UNFOLD TRIANGULAR GLASS", pmGLASS_DOUBLE, -1);
            PopMenuItem      pmu8a              = new PopMenuItem(mmGlass_DOUBLE3, "BENDS TO SEPARATE DRAWINGS", pmGLASS_DOUBLE, -1);
            PopMenuItem      pmu8aa             = new PopMenuItem(mmRPN, "BENDS SECTIONS TO SEPARATE DRAWINGS", pmGLASS_DOUBLE, -1);
            PopMenuRef       pmGlass_Double_Ref = new PopMenuRef(pmGLASS_DOUBLE, pmGLASS, -1);//***
            pmGLASS.PopMenuItems.Add(pmGlass_Double_Ref);
            PopMenuItem pmi_seu___  = new PopMenuItem(pmGLASS, -1);
            PopMenuItem pmi97       = new PopMenuItem(mm67, "GLASS  DISTANCE  FOR  BEND", pmGLASS, -1);
            PopMenuItem pmi9        = new PopMenuItem(mm6, "GLASS  DISTANCE  FOR  ALL BENDS", pmGLASS, -1);
            PopMenuItem pmi9_       = new PopMenuItem(mmDIST, "SET GLASS DISTANCE TO BEND BY NUMER", pmGLASS, -1);
            PopMenuRef  pmGlass_Ref = new PopMenuRef(pmGLASS, pm, -1);
            pm.PopMenuItems.Add(pmGlass_Ref);
            #endregion

            PopMenuItem      pmi_se_CAM__ = new PopMenuItem(pm, -1);
            StringCollection scCAM        = new StringCollection();
            PopMenu          pmCAM        = new PopMenu("CAM Tools", scCAM, "ID_CAM_Tools", pcs.MenuGroup);
            PopMenuItem      pm_cnc       = new PopMenuItem(mmCAM_CNC, "Node to CNC", pmCAM, -1);
            PopMenuItem      pm_cnc1      = new PopMenuItem(mmCAM_CNC1, "Node to CSV", pmCAM, -1);
            PopMenuRef       pmCAM_Ref    = new PopMenuRef(pmCAM, pm, -1);
            pm.PopMenuItems.Add(pmCAM_Ref);

            PopMenuItem pmi_se___ = new PopMenuItem(pm, -1);

            #region profiles
            StringCollection scPROFILES     = new StringCollection();
            PopMenu          pmPROFILES     = new PopMenu("PROFILES", scPROFILES, "ID_SubProfiles", pcs.MenuGroup);
            PopMenuItem      pmipi1         = new PopMenuItem(mmS2, "SOLID EXTRUDE FROM REGIONS IN BLOCK", pmPROFILES, -1);
            PopMenuItem      pmipi2         = new PopMenuItem(mmS3, "CUT WITH EXTRUDED SOLID", pmPROFILES, -1);
            PopMenuItem      pmi_sei_o__    = new PopMenuItem(pmPROFILES, -1);
            PopMenuItem      pmip1          = new PopMenuItem(mmPrf1, "DRAW PROFILE SOLID by CSV", pmPROFILES, -1);
            PopMenuItem      pmip1_         = new PopMenuItem(mmPrf1_, "DRAW PROFILE by CSV and ERASE PROFILE LINE", pmPROFILES, -1);
            PopMenuItem      pmi_sei1       = new PopMenuItem(pmPROFILES, -1);
            PopMenuItem      pmip2_         = new PopMenuItem(mmPrf2, "KCAD PREPARE PROFILE UNFOLD", pmPROFILES, -1);
            PopMenuItem      pmi_sei___     = new PopMenuItem(pmPROFILES, -1);
            PopMenuItem      pmip1i_        = new PopMenuItem(mmPrf1__, "ADD PROFILE POINTS TO_FILE", pmPROFILES, -1);
            PopMenuRef       pmProfiles_Ref = new PopMenuRef(pmPROFILES, pm, -1);
            pm.PopMenuItems.Add(pmProfiles_Ref);
            #endregion

            PopMenuItem pmi_se___Placement = new PopMenuItem(pm, -1);

            #region placement
            StringCollection scPlacement_3D = new StringCollection();
            PopMenu          pmPlacement_3D = new PopMenu("SHOW PLACEMENT IN 3D", scPlacement_3D, "ID_Placement_3D", pcs.MenuGroup);

            PopMenuItem pmPlacemen__22_00 = new PopMenuItem(mmCG, "Real Center of Gravity", pmPlacement_3D, -1);
            PopMenuItem pmi_seiuuyhu1     = new PopMenuItem(pmPlacement_3D, -1);

            StringCollection scPlacement_3D_NODES     = new StringCollection();
            PopMenu          pmPlacement_3D_NODES     = new PopMenu("NODES 3D", scPlacement_3D_NODES, "ID_Bends_3D", pcs.MenuGroup);
            PopMenuItem      pmPlacemen_0             = new PopMenuItem(mmPlacement_3D_0, "PLACEMENT OF NODE 3D IN POSITION", pmPlacement_3D_NODES, -1);
            PopMenuItem      pmPlacemen_000           = new PopMenuItem(mmPlacement_3D_000, "PLACEMENT HIDE from Display", pmPlacement_3D_NODES, -1);
            PopMenuItem      pmPlacemen_0000          = new PopMenuItem(mmPlacement_3D_0000, "PLACEMENT SHOW to Display", pmPlacement_3D_NODES, -1);
            PopMenuItem      pmPlacemen_00            = new PopMenuItem(mmPlacement_3D_00, "PLACEMENT DELETE and from Data Base", pmPlacement_3D_NODES, -1);
            PopMenuRef       pmPlacement_3D_NODES_Ref = new PopMenuRef(pmPlacement_3D_NODES, pmPlacement_3D, -1);
            pmPlacement_3D.PopMenuItems.Add(pmPlacement_3D_NODES_Ref);


            PopMenuItem pmi_seiuu1 = new PopMenuItem(pmPlacement_3D, -1);

            StringCollection scPlacement_3D_NOZZLE     = new StringCollection();
            PopMenu          pmPlacement_3D_NOZZLE     = new PopMenu("BENDS NOZZLE 3D", scPlacement_3D_NOZZLE, "ID_Bends_3D", pcs.MenuGroup);
            PopMenuItem      pmPlacemen_1              = new PopMenuItem(mmPlacement_3D_1, "PLACEMENT OF BENDS NOZZLE BLOCKS IN NODES", pmPlacement_3D_NOZZLE, -1);
            PopMenuItem      pmPlacemen_100            = new PopMenuItem(mmPlacement_3D_100, "PLACEMENT HIDE from Display", pmPlacement_3D_NOZZLE, -1);
            PopMenuItem      pmPlacemen_1000           = new PopMenuItem(mmPlacement_3D_1000, "PLACEMENT SHOW to Display", pmPlacement_3D_NOZZLE, -1);
            PopMenuItem      pmPlacemen_10             = new PopMenuItem(mmPlacement_3D_10, "PLACEMENT DELETE and from Data Base", pmPlacement_3D_NOZZLE, -1);
            PopMenuRef       pmPlacement_3D_NOZZLE_Ref = new PopMenuRef(pmPlacement_3D_NOZZLE, pmPlacement_3D, -1);
            pmPlacement_3D.PopMenuItems.Add(pmPlacement_3D_NOZZLE_Ref);

            PopMenuItem pmi_seiiu1 = new PopMenuItem(pmPlacement_3D, -1);
            // PopMenuItem pmPlacemen_2 = new PopMenuItem(mmPlacement_3D_2, "PLACEMENT BENDS 3D and from Data Base", pmPlacement_3D, -1);
            PopMenuRef pmPlacement_3D_Ref = new PopMenuRef(pmPlacement_3D, pm, -1);
            pm.PopMenuItems.Add(pmPlacement_3D_Ref);

            StringCollection scPlacement_3D_0     = new StringCollection();
            PopMenu          pmPlacement_3D_0     = new PopMenu("BENDS 3D", scPlacement_3D_0, "ID_Bends_3D", pcs.MenuGroup);
            PopMenuItem      pmPlacemen_2_0       = new PopMenuItem(mmPlacement_3D_2, "PLACEMENT BENDS 3D", pmPlacement_3D_0, -1);
            PopMenuItem      pmPlacemen_2_a0      = new PopMenuItem(mmRCN, "PLACEMENT BENDS 3D  ( at the end of normals )", pmPlacement_3D_0, -1);
            PopMenuItem      pmPlacemen_2_o0      = new PopMenuItem(mmS, "KCAD ATTACHING AN SOLID3D TO BEND", pmPlacement_3D_0, -1);
            PopMenuItem      pmi_seiuuu1          = new PopMenuItem(pmPlacement_3D_0, -1);
            PopMenuItem      pmPlacemen_2_10      = new PopMenuItem(mmPlacement_3D_4, "BENDS 3D HIDE", pmPlacement_3D_0, -1);
            PopMenuItem      pmPlacemen_2_11      = new PopMenuItem(mmPlacement_3D_5, "BENDS 3D SHOW", pmPlacement_3D_0, -1);
            PopMenuItem      pmPlacemen_2_00      = new PopMenuItem(mmPlacement_3D_3, "BENDS 3D DELETE  and from Data Base", pmPlacement_3D_0, -1);
            PopMenuItem      pmi_seiuuyu1         = new PopMenuItem(pmPlacement_3D_0, -1);
            PopMenuItem      pmPlacemen__2_00     = new PopMenuItem(mmHEeP, "KCAD CUTTING BENDS IN NODES", pmPlacement_3D_0, -1);
            PopMenuItem      pmPlacemen__1_00     = new PopMenuItem(mmERS4, "* Explicit Cutting Method for Ends of 3D Bends In given Node", pmPlacement_3D_0, -1);
            PopMenuItem      pmPlacemen__1_01     = new PopMenuItem(mmER5S5, "*Clear Explicit Cutting Method for All Bend", pmPlacement_3D_0, -1);
            PopMenuRef       pmPlacement_3D_0_Ref = new PopMenuRef(pmPlacement_3D_0, pmPlacement_3D, -1);
            pmPlacement_3D.PopMenuItems.Add(pmPlacement_3D_0_Ref);
            #endregion

            PopMenuItem pmi_se___Placem = new PopMenuItem(pmPlacement_3D, -1);
            PopMenuItem pmPlacemen_10i  = new PopMenuItem(mmCAM_Check, "CALC MIN CAM RADIUS", pmPlacement_3D, -1);

            #region fixing elements
            StringCollection scPlacement_3D_Fixing_Elements = new StringCollection();
            PopMenu          pmPlacement_3D_Fixing_Elements = new PopMenu("Fixing Elements", scPlacement_3D_Fixing_Elements, "ID_Fixing_Elements", pcs.MenuGroup);
            PopMenuItem      pmFixing_0 = new PopMenuItem(mmFixing, "ADD FIXING ELEMENTS", pmPlacement_3D_Fixing_Elements, -1);
            PopMenuRef       pmPlacement_3D_Fixing_Elements_Ref = new PopMenuRef(pmPlacement_3D_Fixing_Elements, pmPlacement_3D, -1);
            pmPlacement_3D.PopMenuItems.Add(pmPlacement_3D_Fixing_Elements_Ref);
            #endregion


            PopMenuItem pmi___sie = new PopMenuItem(pm, -1);
            #region csv
            MenuMacro mmCSV_Node_Numer_Position = new MenuMacro(mg, "KCAD_NODE_NUMER_POSITION_CSV", "^C^CKCAD_NODE_NUMER_POSITION_CSV", "ID_KCAD_NODE_NUMER_POSITION_CSV");
            MenuMacro mmCSV_Bend_Joints_Numers  = new MenuMacro(mg, "KCAD_BEND_JOINTS_NUMERS_CSV", "^C^CKCAD_BEND_JOINTS_NUMERS_CSV", "ID_KCAD_BEND_JOINTS_NUMERS_CSV");
            MenuMacro mmCSV_Triangles           = new MenuMacro(mg, "KCAD_TRIANGLES_CSV", "^C^CKCAD_TRIANGLES_CSV", "ID_KCAD_TRIANGLES_CSV");

            //{
            StringCollection scPlacement_3D_CSV_Elements = new StringCollection();
            PopMenu          pmPlacement_3D_CSV_Elements = new PopMenu("CSV files", scPlacement_3D_CSV_Elements, "ID_CSV_Elements", pcs.MenuGroup);

            StringCollection scCSV_NODES     = new StringCollection();
            PopMenu          pmCSV_NODES     = new PopMenu("NODES  ", scCSV_NODES, "ID_NODES_CSV", pcs.MenuGroup);
            PopMenuItem      pmCSV_00        = new PopMenuItem(mmCSV_Node_Numer_Position, "NODE NUMER and POSITION to file", pmCSV_NODES, -1);
            PopMenuRef       pmCSV_NODES_Ref = new PopMenuRef(pmCSV_NODES, pmPlacement_3D_CSV_Elements, -1);
            pmPlacement_3D_CSV_Elements.PopMenuItems.Add(pmCSV_NODES_Ref);

            StringCollection scCSV_BENDS     = new StringCollection();
            PopMenu          pmCSV_BENDS     = new PopMenu("BENDS  ", scCSV_BENDS, "ID_BENDS_CSV", pcs.MenuGroup);
            PopMenuItem      pmCSV_0b        = new PopMenuItem(mmCSV_Bend_Joints_Numers, "BEND JOINTS NUMERS", pmCSV_BENDS, -1);
            PopMenuRef       pmCSV_BENDS_Ref = new PopMenuRef(pmCSV_BENDS, pmPlacement_3D_CSV_Elements, -1);
            pmPlacement_3D_CSV_Elements.PopMenuItems.Add(pmCSV_BENDS_Ref);

            StringCollection scCSV_TRIANGLES     = new StringCollection();
            PopMenu          pmCSV_TRIANGLES     = new PopMenu("TRIANGLES  ", scCSV_BENDS, "ID_TRIANGLE_CSV", pcs.MenuGroup);
            PopMenuItem      pmCSV_t0b           = new PopMenuItem(mmCSV_Triangles, "TRIANGLES ", pmCSV_TRIANGLES, -1);
            PopMenuRef       pmCSV_TRIANGLES_Ref = new PopMenuRef(pmCSV_TRIANGLES, pmPlacement_3D_CSV_Elements, -1);
            pmPlacement_3D_CSV_Elements.PopMenuItems.Add(pmCSV_TRIANGLES_Ref);

            PopMenuItem pmSQL_      = new PopMenuItem(mmCAM_CN1, "POLYGONS", pmPlacement_3D_CSV_Elements, -1);
            PopMenuItem pmiui___sie = new PopMenuItem(pmPlacement_3D_CSV_Elements, -1);
            PopMenuItem pmCSVV_     = new PopMenuItem(mm0CSV, "READ NAMED POINTS FROM CSV", pmPlacement_3D_CSV_Elements, -1);
            PopMenuItem pmCSVV1_    = new PopMenuItem(mm1CSV, "DRAW NAMED POINTS BY ARRAY NAME", pmPlacement_3D_CSV_Elements, -1);

            //}
            PopMenuRef pmPlacement_3D_CSV_Elements_Ref = new PopMenuRef(pmPlacement_3D_CSV_Elements, pm, -1);
            pm.PopMenuItems.Add(pmPlacement_3D_CSV_Elements_Ref);

            #endregion

            PopMenuItem pmii___sie = new PopMenuItem(pm, -1);

            #region deviation

            MenuMacro mmTR_An  = new MenuMacro(mg, "KCAD_AGT", "^C^CKCAD_AGT", "ID_KCAD_AGT");
            MenuMacro mmTR_Dr  = new MenuMacro(mg, "KCAD_AGT_DRAW", "^C^CKCAD_AGT_DRAW", "ID_KCAD_AGT_DRAW");
            MenuMacro mmTR_Anp = new MenuMacro(mg, "KCAD_AGP", "^C^CKCAD_AGP", "ID_KCAD_AGP");

            StringCollection scDeviation = new StringCollection();
            PopMenu          pmDeviation = new PopMenu("Deviation tools", scPlacement_3D_Fixing_Elements, "ID_Deviation_tools", pcs.MenuGroup);

            StringCollection scTR               = new StringCollection();
            PopMenu          pmTR               = new PopMenu("TRIANGLES  ", scTR, "ID_DEVIATION_TR_CSV", pcs.MenuGroup);
            PopMenuItem      pmCSV_00_          = new PopMenuItem(mmTR_An, "Analise and DRAW Lines", pmTR, -1);
            PopMenuItem      pmCSV_0_0_         = new PopMenuItem(mmTR_An, "DRAW TEXT in TRIANGLES", pmTR, -1);
            PopMenuRef       pmDEVIATION_TR_Ref = new PopMenuRef(pmTR, pmDeviation, -1);
            pmDeviation.PopMenuItems.Add(pmDEVIATION_TR_Ref);
            PopMenuItem pmFixing_00 = new PopMenuItem(mmTR_Anp, "POLIGONs DEVIATION", pmDeviation, -1);

            PopMenuRef pmDeviation_Ref = new PopMenuRef(pmDeviation, pm, -1);
            pm.PopMenuItems.Add(pmDeviation_Ref);
            #endregion

            PopMenuItem pmiii_sie = new PopMenuItem(pm, -1);

            #region stereometry
            MenuMacro mmSG  = new MenuMacro(mg, "Line and Plane - Intersection", "^C^CKCAD_ILP", "ID_KCAD_ILP");
            MenuMacro mmSG1 = new MenuMacro(mg, "TWO_LINES", "^C^CKCAD_DBP", "ID_KCAD_DBP");

            StringCollection scSolid_Geometry = new StringCollection();
            PopMenu          pmSolid_Geometry = new PopMenu("Solid Geometry", scSolid_Geometry, "ID_Solid_Geometry", pcs.MenuGroup);

            PopMenuItem pmSG_3      = new PopMenuItem(mmMDBS, "Minimal Distance between Solids3D", pmSolid_Geometry, -1);
            PopMenuItem pmi_seiu1u1 = new PopMenuItem(pmSolid_Geometry, -1);
            PopMenuItem pmSG_4      = new PopMenuItem(mmITP, "Intersction Line between two Planes", pmSolid_Geometry, -1);
            PopMenuItem pmSG_0      = new PopMenuItem(mmSG, "Line and Plane - Intersection", pmSolid_Geometry, -1);
            PopMenuItem pmSG_1      = new PopMenuItem(mmSG1, "Two Lines - Crossing", pmSolid_Geometry, -1);
            PopMenuItem pmSG_2      = new PopMenuItem(mmERP5, "Projection of the Point on the Plane", pmSolid_Geometry, -1);

            PopMenuItem pmi_seiuu11 = new PopMenuItem(pmSolid_Geometry, -1);

            StringCollection scCutSolids = new StringCollection();
            PopMenu          pmCutSolids = new PopMenu("CUT PARAMETERS", scCutSolids, "ID_Cut_Solids", pcs.MenuGroup);
            PopMenuItem      pmCut_0     = new PopMenuItem(mmCPS, "Global - Ratio of Length of the Extensions", pmCutSolids, -1);
            PopMenuItem      pmCut_1     = new PopMenuItem(mmCPS1, "Global - Thicnes of the CutProfile", pmCutSolids, -1);
            PopMenuItem      pmCut_3     = new PopMenuItem(mmCPS3, "Global - Extrude Ratio", pmCutSolids, -1);
            PopMenuItem      pmi_seiu1   = new PopMenuItem(pmCutSolids, -1);
            PopMenuItem      pmCutg_2    = new PopMenuItem(mmERS5, "By Bend Selection - Solid Extrude Ratio", pmCutSolids, -1);
            PopMenuItem      pmCut_2     = new PopMenuItem(mmCPS2, "By Bend Numer - Ratio of Length /  Thicnes of the CutProfile", pmCutSolids, -1);
            PopMenuItem      pmi_sesiu1  = new PopMenuItem(pmCutSolids, -1);
            PopMenuItem      pmCut_4     = new PopMenuItem(mmCPS4, "Trimming Vertices on/off", pmCutSolids, -1);

            PopMenuRef pmCutSolids_Ref = new PopMenuRef(pmCutSolids, pmSolid_Geometry, -1);
            pmSolid_Geometry.PopMenuItems.Add(pmCutSolids_Ref);

            //
            PopMenuItem      pmi_seiuu02 = new PopMenuItem(pmSolid_Geometry, -1);
            StringCollection scMESH_MINIMUM_DISTANCES_ = new StringCollection();
            PopMenu          pmMESH_MINIMUM_DISTANCES_ = new PopMenu("Minimum Distance to ...", scMESH_MINIMUM_DISTANCES_, "ID_MINDISTT", pcs.MenuGroup);
            PopMenuItem      pmMD1_ = new PopMenuItem(mmMDN, "to Node", pmMESH_MINIMUM_DISTANCES_, -1);
            PopMenuItem      pmMD2_ = new PopMenuItem(mmMDB, "to Bend Mid Point", pmMESH_MINIMUM_DISTANCES_, -1);
            PopMenuItem      pmMD3_ = new PopMenuItem(mmMDT, "to Triangle Centroid", pmMESH_MINIMUM_DISTANCES_, -1);
            PopMenuRef       pmMESH_MINIMUM_DISTANCES_Ref_ = new PopMenuRef(pmMESH_MINIMUM_DISTANCES_, pmSolid_Geometry, -1);
            pmSolid_Geometry.PopMenuItems.Add(pmMESH_MINIMUM_DISTANCES_Ref_);
            //

            PopMenuItem pmi_seiuu12 = new PopMenuItem(pmSolid_Geometry, -1);
            PopMenuItem pmSGf2      = new PopMenuItem(mmERT5, "Angle between the NORMALS of the adjacent Triangles", pmSolid_Geometry, -1);

            PopMenuRef pmSolid_Geometry_Ref = new PopMenuRef(pmSolid_Geometry, pm, -1);
            pm.PopMenuItems.Add(pmSolid_Geometry_Ref);


            #endregion

            //PopMenuItem pmiii_siye = new PopMenuItem(pm, -1);

            pcs.SaveAs(myCuiFile);
            //LoadMyCui(myCuiFileToSend);
            MessageBox.Show("Menu has been successfully created in\n\n" +
                            myCuiFile + "\n\nFor display in the main Menu Bar, use the Command: CUILOAD ", "New Menu:", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Ejemplo n.º 12
0
 private void CadDataSource_Load(object sender, EventArgs e)
 {
     //获取当前活动的选项卡
     CTAB = Application.GetSystemVariable("CTAB").ToString();
 }
Ejemplo n.º 13
0
        public RegionMassProperties(Region reg, double density)
        {
            var k = 1.0;
            var scaleUnitsValue = UnitsValue.Millimeters;
            var sysUnits        = Application.GetSystemVariable("INSUNITS").ToString();

            switch (sysUnits)
            {
            case "1":
                scaleUnitsValue = UnitsValue.Inches;
                k = 25.4;
                break;

            case "2":
                scaleUnitsValue = UnitsValue.Feet;
                k = 25.4 * 12.0;
                break;

            case "4":
                scaleUnitsValue = UnitsValue.Millimeters;
                k = 1.0;
                break;

            case "5":
                scaleUnitsValue = UnitsValue.Centimeters;
                k = 10.0;
                break;

            case "6":
                scaleUnitsValue = UnitsValue.Meters;
                k = 1000.0;
                break;

            case "14":
                scaleUnitsValue = UnitsValue.Decimeters;
                k = 100.0;
                break;

            default:
                MessageBox.Show("\nUnits to scale inserted content: UNRECOGNIZED ?!", "units E R R O R");
                break;
            }
            AreaUnit    = scaleUnitsValue;
            IyUnit      = scaleUnitsValue;
            WyUpperUnit = scaleUnitsValue;
            WyLowerUnit = scaleUnitsValue;
            DUpperUnit  = scaleUnitsValue;
            DLowerUnit  = scaleUnitsValue;
            IyyUnit     = scaleUnitsValue;
            IzUnit      = scaleUnitsValue;
            WzRightUnit = scaleUnitsValue;
            WzLeftUnit  = scaleUnitsValue;
            DRightUnit  = scaleUnitsValue;
            DLeftUnit   = scaleUnitsValue;
            IzzUnit     = scaleUnitsValue;
            IminUnit    = scaleUnitsValue;
            ImaxUnit    = scaleUnitsValue;

            // area
            Area = reg.Area;

            // Linear Volume
            Density      = density;
            LinearVolume = Area * k * k / (1000.0 * 1000.0);

            // weight G
            G = Density * LinearVolume;

            var Reg          = (AcadRegion)reg.AcadObject;
            var db           = Application.DocumentManager.MdiActiveDocument.Database;
            var tempCentroid = (double[])Reg.Centroid;

            MRegCentroid = new Point3d(tempCentroid[0], tempCentroid[1], 0.0);

            MMaxPoint = reg.GeometricExtents.MaxPoint;
            MMinPoint = reg.GeometricExtents.MinPoint;

            // Extents

            var maxZ = Math.Abs(reg.GeometricExtents.MaxPoint.Y - MRegCentroid.Y);
            var minZ = Math.Abs(reg.GeometricExtents.MinPoint.Y - MRegCentroid.Y);
            var maxY = Math.Abs(reg.GeometricExtents.MaxPoint.X - MRegCentroid.X);
            var minY = Math.Abs(reg.GeometricExtents.MinPoint.X - MRegCentroid.X);

            DUpper = maxZ;
            DLower = minZ;
            DRight = maxY;
            DLeft  = minY;

            using (var tr = db.TransactionManager.StartTransaction())
            {
                var origin = new Point3d(0, 0, 0);
                reg = (Region)tr.GetObject(reg.ObjectId, OpenMode.ForWrite);

                var acVec3D = MRegCentroid.GetVectorTo(origin);
                reg.TransformBy(Matrix3d.Displacement(acVec3D));

                Reg = (AcadRegion)reg.AcadObject;

                var principalMoments = (double[])Reg.PrincipalMoments;
                var momentOfInertia  = (double[])Reg.MomentOfInertia;

                // Y Moments
                Iy      = momentOfInertia[0];
                WyUpper = Iy / maxZ;
                WyLower = Iy / minZ;
                Iyy     = Math.Sqrt(Iy / Reg.Area);

                // Z Moments
                Iz      = momentOfInertia[1];
                WzRight = Iz / maxY;
                WzLeft  = Iz / minY;
                Izz     = Math.Sqrt(Iz / Reg.Area);


                // principal moments
                Imin = principalMoments[0];
                Imax = principalMoments[1];

                Reg.Erase();
                tr.Commit();
            }
        }
Ejemplo n.º 14
0
        public static void DrawText(ref RegionMassProperties aRms, string dU, string mU, Database db)
        {
            #region scale

            var scale           = "mm";
            var scaleUnitsValue = UnitsValue.Millimeters;
            var sysUnits        =
                Application.GetSystemVariable("INSUNITS").ToString();
            switch (sysUnits)
            {
            case "1":
                scale           = "inch";
                scaleUnitsValue = UnitsValue.Inches;
                break;

            case "2":
                scale           = "feet";
                scaleUnitsValue = UnitsValue.Feet;
                break;

            case "4":
                scale           = "mm";
                scaleUnitsValue = UnitsValue.Millimeters;
                break;

            case "5":
                scale           = "cm";
                scaleUnitsValue = UnitsValue.Centimeters;
                break;

            case "6":
                scale           = "m";
                scaleUnitsValue = UnitsValue.Meters;
                break;

            case "14":
                scale           = "dm";
                scaleUnitsValue = UnitsValue.Decimeters;
                break;

            default:
                MessageBox.Show("\nUnits to scale inserted content: UNRECOGNIZED ?!", "units E R R O R");
                break;
            }

            var format       = "f5";
            var mTextMessage = "";

            #endregion

            mTextMessage += AssemblyText(
                "Area",
                aRms.Area * Math.Pow(UnitsConverter.GetConversionFactor(scaleUnitsValue, aRms.AreaUnit), 2),
                aRms.AreaUnit,
                "2",
                scale,
                format);
            mTextMessage += AssemblyText(
                "Iy",
                aRms.Iy * Math.Pow(UnitsConverter.GetConversionFactor(scaleUnitsValue, aRms.IyUnit), 4),
                aRms.IyUnit,
                "4",
                scale,
                format);
            mTextMessage += AssemblyText(
                "Wy_Upper",
                aRms.WyUpper * Math.Pow(UnitsConverter.GetConversionFactor(scaleUnitsValue, aRms.WyUpperUnit), 3),
                aRms.WyUpperUnit,
                "3",
                scale,
                format);
            mTextMessage += AssemblyText(
                "Wy_Lower",
                aRms.WyLower * Math.Pow(UnitsConverter.GetConversionFactor(scaleUnitsValue, aRms.WyLowerUnit), 3),
                aRms.WyLowerUnit,
                "3",
                scale,
                format);
            mTextMessage += AssemblyText(
                "D_Upper",
                aRms.DUpper * Math.Pow(UnitsConverter.GetConversionFactor(scaleUnitsValue, aRms.DUpperUnit), 1),
                aRms.DUpperUnit,
                "",
                scale,
                format);
            mTextMessage += AssemblyText(
                "D_Lower",
                aRms.DLower * Math.Pow(UnitsConverter.GetConversionFactor(scaleUnitsValue, aRms.DLowerUnit), 1),
                aRms.DLowerUnit,
                "",
                scale,
                format);
            mTextMessage += AssemblyText(
                "Iyy",
                aRms.Iyy * Math.Pow(UnitsConverter.GetConversionFactor(scaleUnitsValue, aRms.IyyUnit), 1),
                aRms.IyyUnit,
                "",
                scale,
                format);
            mTextMessage += AssemblyText(
                "Iz",
                aRms.Iz * Math.Pow(UnitsConverter.GetConversionFactor(scaleUnitsValue, aRms.IzUnit), 4),
                aRms.IzUnit,
                "4",
                scale,
                format);
            mTextMessage += AssemblyText(
                "Wz_Right",
                aRms.WzRight * Math.Pow(UnitsConverter.GetConversionFactor(scaleUnitsValue, aRms.WzRightUnit), 3),
                aRms.WzRightUnit,
                "3",
                scale,
                format);
            mTextMessage += AssemblyText(
                "Wz_Left",
                aRms.WzLeft * Math.Pow(UnitsConverter.GetConversionFactor(scaleUnitsValue, aRms.WzLeftUnit), 3),
                aRms.WzLeftUnit,
                "3",
                scale,
                format);
            mTextMessage += AssemblyText(
                "D_Right",
                aRms.DRight * Math.Pow(UnitsConverter.GetConversionFactor(scaleUnitsValue, aRms.DRightUnit), 1),
                aRms.DRightUnit,
                "",
                scale,
                format);
            mTextMessage += AssemblyText(
                "D_Left",
                aRms.DLeft * Math.Pow(UnitsConverter.GetConversionFactor(scaleUnitsValue, aRms.DLeftUnit), 1),
                aRms.DLeftUnit,
                "",
                scale,
                format);
            mTextMessage += AssemblyText(
                "Izz",
                aRms.Izz * Math.Pow(UnitsConverter.GetConversionFactor(scaleUnitsValue, aRms.IzzUnit), 1),
                aRms.IzzUnit,
                "",
                scale,
                format);
            mTextMessage += AssemblyText(
                "Imin",
                aRms.Imin * Math.Pow(UnitsConverter.GetConversionFactor(scaleUnitsValue, aRms.IminUnit), 4),
                aRms.IminUnit,
                "4",
                scale,
                format);
            mTextMessage += AssemblyText(
                "Imax",
                aRms.Imax * Math.Pow(UnitsConverter.GetConversionFactor(scaleUnitsValue, aRms.ImaxUnit), 4),
                aRms.ImaxUnit,
                "4",
                scale,
                format);

            // Density
            var density = aRms.Density * UnitsConverter.GetConversionFactor(UnitsValue.Millimeters, aRms.DensityUnit);
            mTextMessage += "{\\A0Density:\\~" + density.ToString(scale != "m" ? format : "") + "\\~" + dU +
                            "\\S3;}\\P\n";

            // weight G
            var g = aRms.G * UnitsConverter.GetConversionFactor(UnitsValue.Millimeters, aRms.GUnit);
            mTextMessage += "{\\A0G:\\~" + g.ToString(scale != "m" ? format : "") + "\\~" + mU + "}\\P\n";
            Ed.WriteMessage(mTextMessage);

            // draw message
            using (var tr = db.TransactionManager.StartTransaction())
            {
                var bt  = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);
                var btr = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);

                if (!_textId.IsNull && !_textId.IsErased)
                {
                    var regoinTextEnt = (Entity)tr.GetObject(_textId, OpenMode.ForWrite);
                    regoinTextEnt.Erase(true);
                }

                var regionText = new MText();
                regionText.SetDatabaseDefaults();
                regionText.Location = aRms.TextInsertionPoint;
                regionText.Width    = 1000;
                regionText.Height   = 1.2;
                regionText.Contents = mTextMessage + "\n";
                btr.AppendEntity(regionText);
                _textId = regionText.ObjectId;
                tr.AddNewlyCreatedDBObject(regionText, true);
                tr.Commit();
            }

            CommandLineHelper.Command("_REGEN");
        }
Ejemplo n.º 15
0
        public void RegionDescriptionStart()
        {
            var sysUnits =
                Application.GetSystemVariable("INSUNITS").ToString();

            if ((sysUnits != "1") && (sysUnits != "2") && (sysUnits != "4") && (sysUnits != "5") && (sysUnits != "6") &&
                (sysUnits != "14"))
            {
                MessageBox.Show("\nUnits to scale inserted content: UNRECOGNIZED ?!", "units E R R O R");
                return;
            }

            // Prompt the user to select region mode - points or object
            //var regDescrModeOpts =new PromptKeywordOptions("\nSelect mode [Polylines And Circles/Regions/Block]", "PolylinesAndCircles Regions Block");
            var regDescrModeOpts = new PromptKeywordOptions("")
            {
                Message = "Select cross section mode:"
            };

            regDescrModeOpts.Keywords.Add("PolylinesAndCircles");
            regDescrModeOpts.Keywords.Add("Regions");
            regDescrModeOpts.Keywords.Add("Block");
            var regDescrModeRslt = Ed.GetKeywords(regDescrModeOpts);

            // If the user pressed cancel - return with no error
            if (regDescrModeRslt.Status != PromptStatus.OK)
            {
                return;
            }

            var myRegionColl = new DBObjectCollection();
            var objectsType  = typeof(bool);

            switch (regDescrModeRslt.StringResult)
            {
            case "PolylinesAndCircles":

                #region Contours Selection

                // Start a transaction
                using (var tr = Db.TransactionManager.StartTransaction())
                {
                    #region contour

                    // Request for objects to be selected in the drawing area       \
                    Ed.WriteMessage("\nSelect object describing outer contour");

                    //TypeVals.SetValue(new TypedValue((int)DxfCode.Start , "POLYLINE") , 0);
                    //TypeVals.SetValue(new TypedValue((int)DxfCode.Operator , "OR") , 1);
                    //TypeVals.SetValue(new TypedValue((int)DxfCode.Start , "CIRCLE") , 2);
                    // Assign the filter criteria to a SelectionFilter object
                    //SelectionFilter SelFilter = new SelectionFilter(TypeVals);

                    //PromptSelectionResult SSPrompt = Ed.GetSelection(SelFilter);
                    var ssPrompt = Ed.GetSelection();

                    // If the prompt status is OK, objects were selected
                    if (ssPrompt.Status == PromptStatus.OK)
                    {
                        var acSSet = ssPrompt.Value;

                        // Step through the objects in the selection set
                        var acDbObjColl = new DBObjectCollection();
                        foreach (SelectedObject acSsObj in acSSet)
                        {
                            // Check to make sure a valid SelectedObject object was returned
                            if (acSsObj == null)
                            {
                                continue;
                            }
                            // Open the selected object for write
                            var acEnt = tr.GetObject(acSsObj.ObjectId, OpenMode.ForWrite) as Entity;

                            if (acEnt != null)
                            {
                                acDbObjColl.Add(acEnt);
                            }
                            else
                            {
                                Ed.WriteMessage("Invalid input.");
                            }
                        }
                        myRegionColl = Region.CreateFromCurves(acDbObjColl);
                    }

                    #endregion

                    tr.Commit();
                }

                // If the user did not select any objects
                if (myRegionColl.Count == 0)
                {
                    return;
                }

                objectsType = typeof(Polyline);

                #endregion

                break;

            case "Regions":

                #region Regions Selection

                // Prompt for Regions
                var regionsSsOpts = new PromptSelectionOptions {
                    AllowDuplicates = false
                };

                //PromptEntityResult ObjectSelectionRslt = Ed.GetEntity(ObjectSelectionOpts);
                var regionsSsPrompt = Ed.GetSelection(regionsSsOpts);

                // If the prompt status is OK, objects were selected
                if (regionsSsPrompt.Status != PromptStatus.OK)
                {
                    return;
                }

                var regionsacSSet = regionsSsPrompt.Value;
                // Step through the objects in the selection set
                using (var tr = Db.TransactionManager.StartTransaction())
                {
                    var acDbObjColl = new DBObjectCollection();
                    foreach (SelectedObject acSsObj in regionsacSSet)
                    {
                        // Check to make sure a valid SelectedObject object was returned
                        if (acSsObj == null)
                        {
                            continue;
                        }
                        // Open the selected object for write
                        var acEnt = tr.GetObject(acSsObj.ObjectId, OpenMode.ForWrite) as Region;
                        if (acEnt != null)
                        {
                            var acDBObjColl_ = new DBObjectCollection();
                            acEnt.Explode(acDBObjColl_);
                            foreach (Entity acEntt in acDBObjColl_)
                            {
                                acDbObjColl.Add(acEntt);
                            }
                        }
                    }
                    myRegionColl = Region.CreateFromCurves(acDbObjColl);
                }

                // Dispatch function here

                #endregion

                objectsType = typeof(Region);
                break;

            case "Block":

                #region Block Selection

                // Ask the user to select a block

                var peo = new PromptEntityOptions("\nSelect a block:");
                peo.AllowNone = false;
                peo.SetRejectMessage("\nMust select a block.");
                peo.AddAllowedClass(typeof(BlockReference), false);

                var per = Ed.GetEntity(peo);
                if (per.Status != PromptStatus.OK)
                {
                    return;
                }


                using (var tr = Db.TransactionManager.StartTransaction())
                {
                    try
                    {
                        var ent = (Entity)tr.GetObject(per.ObjectId, OpenMode.ForRead);
                        var br  = ent as BlockReference;

                        if (br != null)
                        {
                            var btr =
                                (BlockTableRecord)tr.GetObject(br.BlockTableRecord, OpenMode.ForWrite);
                            var acDbObjColl = new DBObjectCollection();
                            foreach (var id in btr)
                            {
                                var ent2 = (Entity)tr.GetObject(id, OpenMode.ForWrite);
                                var str  = ent2.GetType().ToString().Split('.');
                                var Str  = str[str.Length - 1];

                                if (Str != "Polyline")
                                {
                                    if (Str == "Region")
                                    {
                                        var acEnt        = (Region)tr.GetObject(ent2.ObjectId, OpenMode.ForWrite);
                                        var acDBObjColl_ = new DBObjectCollection();
                                        acEnt.Explode(acDBObjColl_);
                                        foreach (Entity acEntt in acDBObjColl_)
                                        {
                                            acDbObjColl.Add(acEntt);
                                        }
                                    }
                                    else
                                    {
                                        acDbObjColl.Add(ent2);
                                    }
                                }
                                else
                                {
                                    var pl = ent2 as Polyline;
                                    if (pl != null)
                                    {
                                        if (pl.Closed)
                                        {
                                            acDbObjColl.Add(pl);
                                        }
                                        else
                                        {
                                            if ((pl.StartPoint.DistanceTo(pl.EndPoint) < 0.0000001) &&
                                                (Str == "Polyline"))
                                            {
                                                acDbObjColl.Add(pl);
                                            }
                                            else
                                            {
                                                MessageBox.Show("Not Closed PolyLine !");
                                            }
                                        }
                                    }
                                    else
                                    {
                                        var crl = ent2 as Circle;
                                        if (crl != null)
                                        {
                                            acDbObjColl.Add(crl);
                                        }
                                    }
                                }
                            }     //
                            myRegionColl = new DBObjectCollection();
                            myRegionColl = Region.CreateFromCurves(acDbObjColl);
                            var ori = new Point3d(0, 0, 0);
                            var pos = br.Position;
                            foreach (Region reg in myRegionColl)
                            {
                                var Reg = reg;
                                MoveRegionInOrigin(ref Reg, ref ori, ref pos);
                            }
                            tr.Commit();
                        }
                    }
                    catch (Exception e)
                    {
                        Ed.WriteMessage(e.ToString());
                    }
                }

                #endregion

                objectsType = typeof(BlockReference);
                break;
            }

            #region Density selection

            /*      PromptDoubleOptions DensityOptions = new PromptDoubleOptions( "Enter density [kg/m3] : " );
             * DensityOptions.UseDefaultValue = true;
             * DensityOptions.DefaultValue = Settings.Default.RegionDescrDensity;
             * PromptDoubleResult DensityResult = Ed.GetDouble( DensityOptions );
             * if ( DensityResult.Status != PromptStatus.OK )
             * {
             *  return;
             * }
             * else if ( DensityResult.Value == 0.0 )
             * {
             *  MessageBox.Show( "Density must be greater than zero!" );
             *  return;
             * }*/
            Settings.Default.RegionDescrDensity = 1000.0 /*DensityResult.Value*/;
            Settings.Default.Save();

            #endregion

            #region Insertion Point selection

            var insPointOptions = new PromptPointOptions("Pick insertion point : ");
            var insPointResult  = Ed.GetPoint(insPointOptions);
            if (insPointResult.Status != PromptStatus.OK)
            {
                return;
            }

            #endregion

            if (objectsType.Name == "Boolean")
            {
                MessageBox.Show("Error identifing type.");
                return;
            }
            using (var tr = Db.TransactionManager.StartTransaction())
            {
                var extractedRegion = ExtractRegionFromObjects(ref myRegionColl, tr);
                //RegMassProps = GetRegionMassProperties(ExtractedRegion);

                var regMassProps = new RegionMassProperties(extractedRegion, Settings.Default.RegionDescrDensity)
                {
                    TextInsertionPoint = insPointResult.Value
                };


                var rdForm = new RegionDescriptionForm(regMassProps, Ed.Document);
                rdForm.ShowDialog();
                if (rdForm.DialogResult == DialogResult.OK)
                {
                    _textId = new ObjectId();
                }

                tr.Commit();
            }
        }