Beispiel #1
0
 public void setDate(string value)
 {
     if (!string.IsNullOrEmpty(DocumentExtension.NormalString(value)))
     {
         Regex r = new Regex(@"\d{2}\.\d{2}\.\d{2,4}", RegexOptions.IgnoreCase);
         if (r.IsMatch(value))
         {
             d_date = DateTime.Parse(DocumentExtension.NormalString(r.Match(value).Value));
         }
         else
         {
             d_date           = DateTime.MinValue;
             c_import_warning = "d_date=" + value;
             //throw new Exception(value);
         }
     }
 }
        /// <summary>
        /// Retrieves information about the document extensions in the document library.
        /// </summary>
        /// <returns>A list of all document extensions in the document library.</returns>
        public IEnumerable <DocumentExtension> GetExtensions()
        {
            List <DocumentExtension> extensions = new List <DocumentExtension>();

            DatabaseQuery(Resources.SelectDocumentExtensions, record =>
            {
                DocumentExtension extension = new DocumentExtension
                                              (
                    record["Extension"] as string,
                    record["FileType"] as string,
                    record["ContentType"] as string
                                              );
                extensions.Add(extension);
            });

            return(extensions);
        }
Beispiel #3
0
        public void setBirthDay(string value)
        {
            string fioNormal = DocumentExtension.NormalString(value);

            if (!string.IsNullOrEmpty(DocumentExtension.GetBirthDayString(fioNormal)) &&
                DocumentExtension.GetDateString(DocumentExtension.GetBirthDayString(fioNormal)) != null)
            {
                try
                {
                    d_birthday = DateTime.Parse(DocumentExtension.GetDateString(DocumentExtension.GetBirthDayString(fioNormal)));
                }
                catch (Exception e)
                {
                    c_import_warning = e.Message;
                }
            }
        }
Beispiel #4
0
        public static Element FromElement(DB.Element element)
        {
            if (element is null)
            {
                return(null);
            }

            for (var type = element.GetType(); type != typeof(DB.Element); type = type.BaseType)
            {
                if (ActivatorDictionary.TryGetValue(type, out var activator))
                {
                    return(activator(element));
                }
            }

            if (DocumentExtension.AsCategory(element) is DB.Category category)
            {
                return(new Category(category));
            }

            if (GraphicalElement.IsValidElement(element))
            {
                if (InstanceElement.IsValidElement(element))
                {
                    if (Panel.IsValidElement(element))
                    {
                        return(new Panel(element as DB.FamilyInstance));
                    }

                    return(new InstanceElement(element));
                }

                if (GeometricElement.IsValidElement(element))
                {
                    return(new GeometricElement(element));
                }

                return(new GraphicalElement(element));
            }

            return(new Element(element));
        }
Beispiel #5
0
        protected override void ProcessVolatileData()
        {
            if (Grouping != DataGrouping.None)
            {
                if (Kind == GH_ParamKind.floating)
                {
                    if ((Grouping & DataGrouping.Document) != 0)
                    {
                        AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, "Grouped by Document");
                    }

                    if ((Grouping & DataGrouping.Workset) != 0)
                    {
                        AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, "Grouped by Workset");
                    }

                    if ((Grouping & DataGrouping.DesignOption) != 0)
                    {
                        AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, "Grouped by Design Option");
                    }

                    if ((Grouping & DataGrouping.Category) != 0)
                    {
                        AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, "Grouped by Category");
                    }
                }

                var data      = new GH_Structure <T>();
                var pathCount = m_data.PathCount;
                for (int p = 0; p < pathCount; ++p)
                {
                    var path   = m_data.Paths[p];
                    var branch = m_data.get_Branch(path);
                    foreach (var item in branch)
                    {
                        if (item is Types.IGH_ElementId value)
                        {
                            var group = path;

                            if ((Grouping & DataGrouping.Document) != 0)
                            {
                                var docId = DocumentExtension.DocumentSessionId(value.DocumentGUID);
                                group = group.AppendElement(docId);
                            }

                            if (Grouping > DataGrouping.Document)
                            {
                                var element = value.Document?.GetElement(value.Id);

                                if ((Grouping & DataGrouping.Workset) != 0)
                                {
                                    var catId = element?.WorksetId?.IntegerValue ?? 0;
                                    group = group.AppendElement(catId);
                                }

                                if ((Grouping & DataGrouping.DesignOption) != 0)
                                {
                                    var catId = element?.DesignOption?.Id.IntegerValue ?? 0;
                                    group = group.AppendElement(catId);
                                }

                                if ((Grouping & DataGrouping.Category) != 0)
                                {
                                    var catId = element?.Category?.Id.IntegerValue ?? 0;
                                    group = group.AppendElement(catId);
                                }
                            }

                            data.Append((T)value, group);
                        }
                        else
                        {
                            data.Append(null, path.AppendElement(int.MinValue));
                        }
                    }
                }

                m_data = data;
            }

            base.ProcessVolatileData();
        }
Beispiel #6
0
        public void setFio(string value)
        {
            string fioNormal = DocumentExtension.NormalString(value);

            c_fio = DocumentExtension.GetFioString(fioNormal);
        }
Beispiel #7
0
        //--------------------------------------------------------------
        #region Properties & Events
        //--------------------------------------------------------------
        #endregion


        //--------------------------------------------------------------
        #region Creation & Cleanup
        //--------------------------------------------------------------
        #endregion


        //--------------------------------------------------------------
        #region Methods
        //--------------------------------------------------------------

        protected override void OnConfigure()
        {
            if (WindowsHelper.IsInDesignMode)
            {
                return;
            }

            Logger.Info("Configuring editor.");

#if !DEBUG
            PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Critical;
#endif

            _serviceContainer = new ServiceContainer();

            // Configure general services.
            _serviceContainer.Register(typeof(IWindowService), null, typeof(WindowManager));

            // Configure editor.
            _editor = new EditorViewModel(_serviceContainer)
            {
                ApplicationName = ApplicationName,
                ApplicationIcon = BitmapFrame.Create(new Uri("pack://application:,,,/DigitalRune.Editor;component/Resources/Raido.ico", UriKind.RelativeOrAbsolute))
            };
            // Core extensions
            _editor.Extensions.Add(new CommandExtension());
            _editor.Extensions.Add(new LayoutExtension());
            _editor.Extensions.Add(new AboutExtension());
            _editor.Extensions.Add(new OptionsExtension());
            _editor.Extensions.Add(new PrintExtension());
            _editor.Extensions.Add(new QuickLaunchExtension());
            _editor.Extensions.Add(new ThemeExtension());
            _editor.Extensions.Add(new StatusExtension());
            _editor.Extensions.Add(new SearchExtension());

            // Common tool windows.
            _editor.Extensions.Add(new OutputExtension());
            _editor.Extensions.Add(new ErrorExtension());
            _editor.Extensions.Add(new OutlineExtension());
            _editor.Extensions.Add(new PropertiesExtension());

            // Document extensions.
            _documentExtension = new DocumentExtension();
            _editor.Extensions.Add(_documentExtension);
            _editor.Extensions.Add(new TextExtension());
            _editor.Extensions.Add(new ShaderExtension());
            _editor.Extensions.Add(new TexturesExtension());
            _editor.Extensions.Add(new ModelsExtension());

            // Other extensions.
            _editor.Extensions.Add(new DiagnosticsExtension());
            _editor.Extensions.Add(new ColorExtension());
            _editor.Extensions.Add(new GameExtension());
            _editor.Extensions.Add(new TestExtension0());

            try
            {
                bool success = _editor.Initialize();
                if (!success)
                {
                    // The editor could not be configured or command line arguments caused the
                    // editor to shut down (e.g. if "--help" was specified).
                    Application.Shutdown(_editor.ExitCode);
                    return;
                }
            }
            catch (Exception exception)
            {
                Logger.Error(exception, "Editor configuration failed.");

                _configurationFailed = true;
                Environment.ExitCode = ExitCodeConfigurationFailed;

                ExceptionHelper.ShowException(exception, ApplicationName, Email);
            }
        }
Beispiel #8
0
 public Document(string name, int size, IEnumerable <Atribute> atributes, string data, DocumentExtension extension) : base(name, size, atributes)
 {
     Data      = data;
     Extension = extension;
 }
Beispiel #9
0
 /// <summary>
 /// Removes the specified extension from the library.
 /// </summary>
 /// <param name="extension">The extension to remove from the library.</param>
 public void RemoveExtension(DocumentExtension extension) => _extensions.Remove(extension);
Beispiel #10
0
 /// <summary>
 /// Adds the specified extension to the library.
 /// </summary>
 /// <param name="extension">The extension to add to the library.</param>
 public void AddExtension(DocumentExtension extension) => _extensions.Add(extension);
Beispiel #11
0
        //Profiles for reinforcing panel
        #region Усиливающие рамки
        public void ReinforcingProfile(string testName)
        {
            const double thiknessF = 1;
            //var bendParams = sbSqlBaseData.BendTable(thiknessF);
            //var bendRadius = Convert.ToDouble(bendParams[0]);
            //var kFactor = Convert.ToDouble(bendParams[1]);
            const double heightF = 38.0; // Артурчик сказал не надо. 06.03.2017 16:45

            #region  Усиливающая рамка по ширине
            //newName = усиливающаяРамкаПоШирине.NewName;
            //newName = modelName + "-06-" + width + "-" + "40-" + materialP2[0] + скотч;
            //newPartPath = $@"{Settings.Default.DestinationFolder}\{_destinationFolder}\{newName}.SLDPRT";



            SolidWorksDocument = SolidWorksAdapter.AcativeteDoc(testName);// "02-11-07-40-"); // horisontal up

            if (false)
            {
            }
            else
            {
                parameters.Add("D2@Эскиз1", framelessPanel.PanelType == PanelType_e.RemovablePanel ? framelessPanel.SizePanel.X - 49.2 : framelessPanel.SizePanel.X - 47.2);
                //parameters.Add("D1@Эскиз1", heightF);
                parameters.Add("D1@Кривая3", ScrewsByWidthInner);
                parameters.Add("D1@Кривая2", колСаморезВинтШирина);
                //Размеры для отверсти под клепальные гайки под съемные панели
                parameters.Add("G0@Эскиз32", OutputHolesWrapper.G0 - 3.6);
                parameters.Add("G1@Эскиз32", OutputHolesWrapper.G1);
                parameters.Add("G2@Эскиз32", OutputHolesWrapper.G2);
                parameters.Add("G3@Эскиз32", OutputHolesWrapper.G0);
                //Convert.ToString(количествоВинтов)
                parameters.Add("L1@Эскиз32", OutputHolesWrapper.L1);
                parameters.Add("D1@Кривая4", OutputHolesWrapper.D1);
                parameters.Add("L2@Эскиз32", OutputHolesWrapper.L2);
                parameters.Add("D1@Кривая5", OutputHolesWrapper.D2);
                parameters.Add("L3@Эскиз32", OutputHolesWrapper.L3);
                parameters.Add("D1@Кривая6", OutputHolesWrapper.D3);
                parameters.Add("Толщина@Листовой металл", thiknessF);
                parameters.Add("D1@Листовой металл", (double)BendRadius);
                parameters.Add("D2@Листовой металл", (double)KFactor * 1000);
                EditPartParameters("02-11-06-40-", "", 0);
                //    $@"{Settings.Default.DestinationFolder}\{_destinationFolder}\{newName}",
            }

            #endregion

            #region  Усиливающая рамка по ширине 2

            if (framelessPanel.PanelType == PanelType_e.BlankPanel)
            {
                SolidWorksDocument = ((ModelDoc2)(SolidWorksAdapter.SldWoksAppExemplare.ActivateDoc2(AssemblyName + ".SLDASM", true, 0)));
                DocumentExtension.SelectByID2("02-11-06_2-40--4@" + AssemblyName, "COMPONENT", 0, 0, 0, false, 0, null, 0);
                //  AssemblyDocument.ReplaceComponents(System.IO.Path.Combine(RootFolder, SubjectDestinationFolder, усиливающаяРамкаПоШирине.NewName + "SLDPRT"), String.Empty, true, true);
                //($@"{RootFolder}\{SubjectDestinationFolder}\{усиливающаяРамкаПоШирине.NewName}.SLDPRT", "", true, true);

                SolidWorksAdapter.SldWoksAppExemplare.CloseDoc("02-11-06_2-40-.SLDPRT");
            }
            else
            {
                //newName = усиливающаяРамкаПоШирине2.NewName;
                //newName = modelName + "-06-" + width + "-" + "40-" + materialP2[0] + скотч;
                //newPartPath = $@"{Settings.Default.DestinationFolder}\{_destinationFolder}\{newName}.SLDPRT";

                if (false)
                {
                    SolidWorksDocument = ((ModelDoc2)(SolidWorksAdapter.SldWoksAppExemplare.ActivateDoc2(AssemblyName + ".SLDASM", true, 0)));
                    DocumentExtension.SelectByID2("02-11-06_2-40--4@" + AssemblyName, "COMPONENT", 0, 0, 0, false, 0, null, 0);
                    AssemblyDocument.ReplaceComponents(base.NewPartPath, "", true, true);
                    SolidWorksAdapter.SldWoksAppExemplare.CloseDoc("02-11-06_2-40-.SLDPRT");
                }
                else
                {
                    parameters.Add("D2@Эскиз1", framelessPanel.PanelType == PanelType_e.RemovablePanel ? framelessPanel.SizePanel.X - 49.2 : framelessPanel.SizePanel.X - 47.2);
                    parameters.Add("D1@Эскиз1", heightF);
                    parameters.Add("D1@Кривая3", ScrewsByWidthInner);
                    parameters.Add("D1@Кривая2", колСаморезВинтШирина);
                    parameters.Add("G0@Эскиз32", OutputHolesWrapper.G0 - 3.6);
                    parameters.Add("G1@Эскиз32", OutputHolesWrapper.G1);
                    parameters.Add("G2@Эскиз32", OutputHolesWrapper.G2);
                    parameters.Add("G3@Эскиз32", OutputHolesWrapper.G0);
                    parameters.Add("L1@Эскиз32", OutputHolesWrapper.L1);
                    parameters.Add("D1@Кривая4", OutputHolesWrapper.D1);
                    parameters.Add("L2@Эскиз32", OutputHolesWrapper.L2);
                    parameters.Add("D1@Кривая5", OutputHolesWrapper.D2);
                    parameters.Add("L3@Эскиз32", OutputHolesWrapper.L3);
                    parameters.Add("D1@Кривая6", OutputHolesWrapper.D3);
                    parameters.Add("Толщина@Листовой металл", thiknessF);
                    parameters.Add("D1@Листовой металл", (double)base.BendRadius);
                    parameters.Add("D2@Листовой металл", (double)base.KFactor * 1000);
                    EditPartParameters("02-11-06_2-40-", NewPartPath, 0);
                }
            }

            #endregion

            #region  Усиливающая рамка по высоте

            // PartName = усиливающаяРамкаПоВысоте.NewName;

            NewPartPath = "";                                                                                   // newName = modelName + "-07-" + lenght + "-" + "40-" + materialP2[0] + скотч;
            NewPartPath = System.IO.Path.Combine(RootFolder, SubjectDestinationFolder, NewPartPath + "SLDPRT"); //$@"{Settings.Default.DestinationFolder}\{_destinationFolder}\{newName}.SLDPRT";

            //if (GetExistingFile(Path.GetFileNameWithoutExtension(NewPartPath), 1)) {
            //    SolidWorksDocument = ((ModelDoc2)(SolidWorksAdapter.SldWoksAppExemplare.ActivateDoc2(AssemblyName + ".SLDASM", true, 0)));
            //    DocumentExtension.SelectByID2("02-11-07-40--1@" + AssemblyName, "COMPONENT", 0, 0, 0, false, 0, null, 0);
            //    AssemblyDocument.ReplaceComponents(newPartPath, "", true, true);
            //    SolidWorksAdapter.SldWoksAppExemplare.CloseDoc("02-11-07-40-.SLDPRT");
            if (false)
            {
                ;
            }

            else
            {
                parameters.Add("D3@Эскиз1", framelessPanel.PanelType == PanelType_e.RemovablePanel ? framelessPanel.SizePanel.Y - 2 : framelessPanel.SizePanel.Y);
                parameters.Add("D1@Эскиз1", heightF);
                parameters.Add("D1@Эскиз23", framelessPanel.PanelType == PanelType_e.BlankPanel ? 44.4 : 125);
                parameters.Add("D1@Кривая2", ScrewsByHeightInner);
                parameters.Add("D1@Кривая1", колЗаклепокВысота);
                parameters.Add("Толщина@Листовой металл", thiknessF);
                parameters.Add("D1@Листовой металл", (double)base.BendRadius);
                parameters.Add("D2@Листовой металл", (double)base.KFactor * 1000);

                EditPartParameters("02-11-07-40-", NewPartPath, 0);
                #endregion
            }

            #endregion
        }