Beispiel #1
0
        public void ConfigPari()
        {
            log.Info("ConfigPari");
            try
            {
                var factory  = new Factory();
                var database = factory.CreatePariDatabase();
                if (database == null)
                {
                    throw new InvalidOperationException("Database is null!");
                }

                _AcWnd.OpenFileDialog ofd = new _AcWnd.OpenFileDialog("Datenbank wählen", "", "accdb", "AccessFile", _AcWnd.OpenFileDialog.OpenFileDialogFlags.AllowAnyExtension);
                var dr = ofd.ShowDialog();
                if (dr != DialogResult.OK)
                {
                    return;
                }
                database.SetDatabase(ofd.Filename);

                ofd = new _AcWnd.OpenFileDialog("Excel-Template wählen", "", "xlsx", "ExcelFile", _AcWnd.OpenFileDialog.OpenFileDialogFlags.AllowAnyExtension);
                dr  = ofd.ShowDialog();
                if (dr != DialogResult.OK)
                {
                    return;
                }
                var excel = factory.CreateVisualOutputHandler();
                excel.SetTemplates(Path.GetDirectoryName(ofd.Filename));
            }
            catch (Exception ex)
            {
                log.Error(ex.Message, ex);
                Application.ShowAlertDialog(ex.Message);
            }
        }
Beispiel #2
0
        private static string GetDwgName()
        {
            _AcAp.Document doc = _AcAp.Application.DocumentManager.MdiActiveDocument;
            _AcEd.Editor   ed  = doc.Editor;

            _AcWnd.OpenFileDialog ofd = new _AcWnd.OpenFileDialog(
                "AutoCAD-Datei mit den zu importierenden Layerfilter wählen", "", "dwg", "AutoCAD-Datei mit den zu importierenden Layerfilter wählen", _AcWnd.OpenFileDialog.OpenFileDialogFlags.AllowAnyExtension
                );
            System.Windows.Forms.DialogResult dr = ofd.ShowDialog();
            if (dr != System.Windows.Forms.DialogResult.OK)
            {
                return(null);
            }

            return(ofd.Filename);
        }
        public static _AcDb.ResultBuffer LispOpenFileDialog(_AcDb.ResultBuffer args)
        {
            if (args == null)
            {
                return(new _AcDb.ResultBuffer(new _AcDb.TypedValue((int)_AcBrx.LispDataType.Nil)));
            }
            string FileName, Ext, Title;
            bool   Multiple;

            if (!GetArgsFromRb(args, out FileName, out Ext, out Title, out Multiple))
            {
                return(new _AcDb.ResultBuffer(new _AcDb.TypedValue((int)_AcBrx.LispDataType.Nil)));
            }
            else
            {
                _AcWnd.OpenFileDialog ofd;
                if (Multiple)
                {
                    ofd = new _AcWnd.OpenFileDialog(Title, FileName, Ext, "LispOFD", _AcWnd.OpenFileDialog.OpenFileDialogFlags.AllowAnyExtension | _AcWnd.OpenFileDialog.OpenFileDialogFlags.AllowMultiple);
                }
                else
                {
                    ofd = new _AcWnd.OpenFileDialog(Title, FileName, Ext, "LispOFD", _AcWnd.OpenFileDialog.OpenFileDialogFlags.AllowAnyExtension);
                }
                System.Windows.Forms.DialogResult dr = ofd.ShowDialog();
                if (dr == System.Windows.Forms.DialogResult.OK)
                {
                    if (Multiple)
                    {
                        _AcDb.ResultBuffer rb = new _AcDb.ResultBuffer();
                        foreach (string fname in ofd.GetFilenames())
                        {
                            rb.Add(new _AcDb.TypedValue((int)_AcBrx.LispDataType.Text, fname));
                        }
                        return(rb);
                    }
                    else
                    {
                        return(new _AcDb.ResultBuffer(new _AcDb.TypedValue((int)_AcBrx.LispDataType.Text, ofd.Filename)));
                    }
                }
                else
                {
                    return(new _AcDb.ResultBuffer(new _AcDb.TypedValue((int)_AcBrx.LispDataType.Nil)));
                }
            }
        }
Beispiel #4
0
        public void iFds()
        {
            Utils.Init();
#if ARX_APP
            OpenFileDialog theDialog = new OpenFileDialog();
            theDialog.Title            = "Open FDS file";
            theDialog.Filter           = "FDS files (*.fds)|*.fds|All files (*.*)|*.*";
            theDialog.RestoreDirectory = true;
#elif BRX_APP
            Bricscad.Windows.OpenFileDialog theDialog = new Bricscad.Windows.OpenFileDialog("Open FDS file", "", "*.fds", "Dialog name", Bricscad.Windows.OpenFileDialog.OpenFileDialogFlags.DefaultIsFolder);
#endif

            if (theDialog.ShowDialog() == DialogResult.OK)
            {
#if ARX_APP
                string filename = theDialog.FileName;
#elif BRX_APP
                string filename = theDialog.Filename;
#endif
                string[] filelines = File.ReadAllLines(filename);
                double[] xb        = new double[6];
                string   surf      = "";

                foreach (string line in filelines)
                {
                    if (line.Contains("&OBST"))
                    {
                        //&OBST ID = 'OBST1', XB = 6.8,7., 7,64, 1.8,5.234, SURF_ID = 'gypsum_board' /
                        xb   = regXb(line);
                        surf = "";
                        surf = regSurfId(line);

                        Random rnd   = new Random();
                        int    color = rnd.Next(1, 255);

                        // Check if layer exists
                        if (surf != null)
                        {
                            Layers.CreateLayer(surf, Color.FromColorIndex(ColorMethod.ByAci, Convert.ToInt16(color)));
                        }
                        else
                        {
                            surf = "!FDS_OBST[inert](0)";
                            Layers.CreateLayer(surf, Color.FromColorIndex(ColorMethod.ByAci, Convert.ToInt16(color)));
                        }

                        if (xb != null)
                        {
                            Utils.CreateBox(xb[0], xb[1], xb[2], xb[3], xb[4], xb[5], surf);
                        }
                    }
                    else if (line.Contains("&MESH"))
                    {
                        xb   = regXb(line);
                        surf = "!FDS_MESH";
                        Utils.CreateBox(xb[0], xb[1], xb[2], xb[3], xb[4], xb[5], surf);
                    }
                    //ed.WriteMessage(filelines[i]);
                }
            }

            //Utils.CreateBox(0, 4, 0, 0.2, 0, 3, "!FDS_OBST[inert](0)");
            //Utils.CreateBox(-0.2, 0, 0, 4, 0, 3, "!FDS_OBST[inert](0)");
            //Utils.CreateBox(-1, 5, -2, 8, 0, 3.6, "!FDS_MESH");
            //Utils.CreateExtrudedSurface(new Point3d(2, 2, 2), new Point3d(2, 2.4, 2.2), "!FDS_VENT[vent]");
            //Utils.CreateExtrudedSurface(new Point3d(4, -2.4, 0), new Point3d(4, 8.4, 3.0), "!FDS_SLCF[slice]");

            //Utils.ZoomInit();
        }
Beispiel #5
0
        public void iFds()
        {
            CultureInfo culture = new CultureInfo("en-US");

            Utils.Init();
#if ARX_APP
            OpenFileDialog theDialog = new OpenFileDialog();
            theDialog.Title            = "Open FDS file";
            theDialog.Filter           = "FDS files (*.fds)|*.fds|All files (*.*)|*.*";
            theDialog.RestoreDirectory = true;
#elif BRX_APP
            Bricscad.Windows.OpenFileDialog theDialog = new Bricscad.Windows.OpenFileDialog("Open FDS file", "", "*.fds", "Dialog name", Bricscad.Windows.OpenFileDialog.OpenFileDialogFlags.DefaultIsFolder);
#endif

            if (theDialog.ShowDialog() == DialogResult.OK)
            {
#if ARX_APP
                string filename = theDialog.FileName;
#elif BRX_APP
                string filename = theDialog.Filename;
#endif
                string[] filelines = File.ReadAllLines(filename);

                double x1, x2, y1, y2, z1, z2;
                string surf = "";

                foreach (string line in filelines)
                {
                    if (line.Contains("&OBST"))
                    {
                        //&OBST ID = 'OBST1', XB = 6.8,7., 7,64, 1.8,5.234, SURF_ID = 'gypsum_board' /
                        surf = "";

                        Regex regExXb = new Regex(@"XB\s*=\s*(\-*\d*\.{0,1}\d*)\s*,\s*(\-*\d*\.{0,1}\d*)\s*,\s*(\-*\d*\.{0,1}\d*)\s*,\s*(\-*\d*\.{0,1}\d*)\s*,\s*(\-*\d*\.{0,1}\d*)\s*,\s*(\-*\d*\.{0,1}\d*)", RegexOptions.IgnoreCase);
                        Match xb      = regExXb.Match(line);

                        if (xb.Success)
                        {
                            System.Text.RegularExpressions.Group x1G = xb.Groups[1];
                            System.Text.RegularExpressions.Group x2G = xb.Groups[2];
                            System.Text.RegularExpressions.Group y1G = xb.Groups[3];
                            System.Text.RegularExpressions.Group y2G = xb.Groups[4];
                            System.Text.RegularExpressions.Group z1G = xb.Groups[5];
                            System.Text.RegularExpressions.Group z2G = xb.Groups[6];
                            x1 = Convert.ToDouble(x1G.Value, culture);
                            x2 = Convert.ToDouble(x2G.Value, culture);
                            y1 = Convert.ToDouble(y1G.Value, culture);
                            y2 = Convert.ToDouble(y2G.Value, culture);
                            z1 = Convert.ToDouble(z1G.Value, culture);
                            z2 = Convert.ToDouble(z2G.Value, culture);

                            ed.WriteMessage(x1.ToString() + "\n");
                            ed.WriteMessage(x2.ToString() + "\n");
                            ed.WriteMessage(y1.ToString() + "\n");
                            ed.WriteMessage(y2.ToString() + "\n");
                            ed.WriteMessage(z1.ToString() + "\n");
                            ed.WriteMessage(z2.ToString() + "\n");

                            Regex regExSurfId = new Regex(@"SURF_ID\s*=\s*'(.*)'", RegexOptions.IgnoreCase);
                            Match surfId      = regExSurfId.Match(line);
                            surf = surfId.Success ? "!FDS_OBST[" + surfId.Groups[1].Value + "](0)" : "!FDS_OBST[inert](0)";

                            Layers.CreateLayer(surf);

                            if (x1 != x2 && y1 != y2 && z1 != z2)
                            {
                                Utils.CreateBox(x1, x2, y1, y2, z1, z2, surf);
                            }
                        }
                    }
                    //ed.WriteMessage(filelines[i]);
                }
            }

            //Utils.CreateBox(0, 4, 0, 0.2, 0, 3, "!FDS_OBST[inert](0)");
            //Utils.CreateBox(-0.2, 0, 0, 4, 0, 3, "!FDS_OBST[inert](0)");
            //Utils.CreateBox(-1, 5, -2, 8, 0, 3.6, "!FDS_MESH");
            //Utils.CreateExtrudedSurface(new Point3d(2, 2, 2), new Point3d(2, 2.4, 2.2), "!FDS_VENT[vent]");
            //Utils.CreateExtrudedSurface(new Point3d(4, -2.4, 0), new Point3d(4, 8.4, 3.0), "!FDS_SLCF[slice]");

            //Utils.ZoomInit();
        }