Esempio n. 1
0
        //----------------------------------------------------------
        public string CreatePreview(ElementType type, All_Data myAll_Data)
        {
            string path = "";
            try
            {
                mySource = new ListSource();
                if (Directory.Exists(mySource.user + myAll_Data.list_path_foder_data[1]) == false) Directory.CreateDirectory(mySource.user + myAll_Data.list_path_foder_data[1]);

                Size imgSize = new Size(200, 200);

                Bitmap image = type.GetPreviewImage(imgSize);

                // encode image to jpeg for test display purposes:

                JpegBitmapEncoder encoder
                  = new JpegBitmapEncoder();

                encoder.Frames.Add(BitmapFrame.Create(
                  ConvertBitmapToBitmapSource(image)));

                encoder.QualityLevel = 25;

                path = mySource.user + myAll_Data.list_path_foder_data[1] + "\\" + type.FamilyName + ".jpg";

                FileStream file = new FileStream(path, FileMode.Create, FileAccess.Write);

                encoder.Save(file);
                file.Close();
            }
            catch (Exception ex)
            {

            }
            return path;
        }
Esempio n. 2
0
        public void Execute(UIApplication uiapp)
        {
            UIDocument uidoc = uiapp.ActiveUIDocument;
            Document   doc   = uidoc.Document;

            mySource          = new ListSource();
            myFunctionSupport = new FunctionSupoort();

            try
            {
                Transaction transaction = new Transaction(doc);
                transaction.Start("Opening");

                if (command == "Update By Revit")
                {
                    Update_By_Revit(uiapp, doc);
                }

                if (command == "Draw By Revit")
                {
                    Draw_By_Revit(uiapp, doc);
                }

                if (command == "Draw By CAD")
                {
                    Draw_By_CAD(uiapp, doc);
                }

                if (command == "Duplicate Type")
                {
                    Duplicate_Type(uiapp, doc);
                }

                transaction.Commit();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return;
        }
Esempio n. 3
0
        public UserControl1(UIApplication _uiapp)
        {
            InitializeComponent();
            uiapp = _uiapp;
            uidoc = uiapp.ActiveUIDocument;
            doc   = uidoc.Document;

            myExampleDraw = new ExternalEventClass();
            Draw          = ExternalEvent.Create(myExampleDraw);

            mySQL             = new FunctionSQL();
            myFunctionSupport = new FunctionSupoort();
            mySource          = new ListSource();

            var listtotal = mySQL.SQLRead(@"Server=18.141.116.111,1433\SQLEXPRESS;Database=ManageDataBase;User Id=ManageUser; Password = manage@connect789", "Select * from dbo.PathSource", "Query", new List <string>(), new List <string>());

            path = listtotal.Rows[0][1].ToString();
            Function_TXT();

            Function_Dau_Vao();
        }
Esempio n. 4
0
        //----------------------------------------------------------
        public ObservableCollection<parameter_data> View_Dimensions_FamilySymbol(Document doc, Element element, All_Data myAll_Data)
        {
            mySource = new ListSource();
            ObservableCollection<parameter_data> my_parameter_data = new ObservableCollection<parameter_data>();
            try
            {
                try
                {
                    foreach (Parameter para in element.Parameters)
                    {
                        try
                        {
                            if (para.Definition.ParameterGroup == BuiltInParameterGroup.PG_GEOMETRY && mySource.para_name_not_use.Contains(para.Definition.Name) == false && para.IsReadOnly == false)
                            {
                                string value = Get_Parameter_Information(para, doc, myAll_Data);
                                my_parameter_data.Add(new parameter_data()
                                {
                                    parameter_name = para.Definition.Name,
                                    parameter_value = value,
                                    parameter = para
                                });
                            }
                        }
                        catch (Exception)
                        {

                        }
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Bạn cần có ít nhất 1 đối tượng đã được vẽ để lấy thông tin!", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return my_parameter_data;
        }