Exemplo n.º 1
0
 private void ReleaseAllElementsButton_Click(object sender, RoutedEventArgs e)
 {
     if (PickedElements.SelectedIndex == -1)
     {
         while (Rvt.Data.PickedElements.Count > 0)
         {
             ElementContainer tmp = Rvt.Data.PickedElements[0];
             Rvt.Data.PickedElements.RemoveAt(0);
             Rvt.Data.AvailableElements.Add(tmp);
         }
     }
     else
     {
         var tmpCollection = new ElementCollection();
         foreach (ElementContainer item in PickedElements.SelectedItems)
         {
             tmpCollection.Add(item);
         }
         foreach (var item in tmpCollection)
         {
             Rvt.Data.PickedElements.Remove(item);
             Rvt.Data.AvailableElements.Insert(Rvt.Data.AvailableElements.Count, item);
         }
     }
 }
        public static string ElementType(ElementContainer elemContainer)
        {
            ///// "Тип, марка, обозначение документа, опросного листа"
            //// Variable: public string Type;
            /// Real parameters:
            // ELEM_TYPE_PARAM						// Type
            // SYMBOL_NAME_PARAM					// Type Name
            // ALL_MODEL_TYPE_NAME					// Type Name
            // ELEM_FAMILY_AND_TYPE_PARAM			// Family and Type
            // SYMBOL_FAMILY_AND_TYPE_NAMES_PARAM	// Family and Type

            string type = GetStringParameter(elemContainer.Element, new BuiltInParameter[] {
                BuiltInParameter.ELEM_TYPE_PARAM,
                BuiltInParameter.SYMBOL_NAME_PARAM,
                BuiltInParameter.ALL_MODEL_TYPE_NAME,
                BuiltInParameter.ELEM_FAMILY_AND_TYPE_PARAM,
                BuiltInParameter.SYMBOL_FAMILY_AND_TYPE_NAMES_PARAM
            });

            if (type == String.Empty)
            {
                type = elemContainer.Element.Category.Name;
            }
            return(type);
        }
Exemplo n.º 3
0
        public static void FillLine(ElementContainer elemCont)
        {
            //// Заголовок категории
            if (elemCont.LineType == ElementContainer.ContType.Category)
            {
                elemCont.Line = new List <string>()
                {
                    "", "", elemCont.CategoryLine, "", "", ""
                };
            }

            //// Нумерация стоблцов
            else if (elemCont.LineType == ElementContainer.ContType.ColumnsEnumeration)
            {
                elemCont.Line = new List <string>()
                {
                    "1", "2", "3", "4", "5", "6"
                };
            }

            //// Настоящий элемент
            else
            {
                elemCont.Line = new List <string>();

                // "Поз."
                elemCont.Line.Add(elemCont.Position.ToString());

                // Обозначение
                elemCont.Line.Add(GOST_21_110_2013.ElementType(elemCont));

                // Наименование
                elemCont.Line.Add(GOST_21_110_2013.ElementName(elemCont));

                // Кол.
                double amount = GOST_21_110_2013.ElementAmount(elemCont);
                if (amount == 0.0)
                {
                    elemCont.Line.Add(String.Empty);
                }
                else
                {
                    elemCont.Line.Add(amount.ToString());
                }

                // Масса ед., кг
                double weight = GOST_21_110_2013.ElementWeight(elemCont);
                if (weight == 0.0)
                {
                    elemCont.Line.Add(String.Empty);
                }
                else
                {
                    elemCont.Line.Add(weight.ToString());
                }

                // Примечание
                elemCont.Line.Add(GOST_21_110_2013.ElementNote(elemCont));
            }
        }
Exemplo n.º 4
0
 public void AddElement(ElementContainer element)
 {
     if (ElemCol == null)
     {
         ElemCol = new ElementCollection();
     }
     ElemCol.Add(element);
 }
 public bool Equals(ElementContainer other)
 {
     if (this.InstanceName == other.InstanceName &&
         this.Type == other.Type)
     {
         return(true);
     }
     return(false);
 }
 public ElementContainer(ElementContainer other)
 {
     Element      = other.Element;
     Amount       = other.Amount;
     CategoryLine = other.CategoryLine;
     Position     = other.Position;
     LineType     = other.LineType;
     Line         = other.Line;
 }
        public static double ElementAmount(ElementContainer elemContainer)
        {
            ///// "Количество"
            //// Variable: public double Amount;
            /// Real parameters:

            return(elemContainer.Amount);

            // TO DO! Consider measurement units!
        }
        public static void FillLine(ElementContainer elemCont)
        {
            //// Заголовок категории
            if (elemCont.LineType == ElementContainer.ContType.Category)
            {
                elemCont.Line = new List <string>()
                {
                    "", "", "", "", elemCont.CategoryLine, "", ""
                };
            }

            //// Нумерация стоблцов
            else if (elemCont.LineType == ElementContainer.ContType.ColumnsEnumeration)
            {
                elemCont.Line = new List <string>()
                {
                    "1", "2", "3", "4", "5", "6", "7"
                };
            }

            //// Настоящий элемент
            else
            {
                elemCont.Line = new List <string>();

                //(*1): Формат
                elemCont.Line.Add("");

                //(*2): Зона
                elemCont.Line.Add("");

                //(*3): Поз.
                elemCont.Line.Add(elemCont.Position.ToString());

                //(*4): Обозначение
                elemCont.Line.Add(GOST_21_110_2013.ElementType(elemCont));

                //(*5): Наименование
                elemCont.Line.Add(GOST_21_110_2013.ElementName(elemCont));

                //(*6): Кол.
                double amount = GOST_21_110_2013.ElementAmount(elemCont);
                if (amount == 0.0)
                {
                    elemCont.Line.Add(String.Empty);
                }
                else
                {
                    elemCont.Line.Add(amount.ToString());
                }

                //(*7): Примечаение
                elemCont.Line.Add(GOST_21_110_2013.ElementNote(elemCont));
            }
        }
        public static double ElementWeight(ElementContainer elemContainer)
        {
            ///// "Масса 1 ед., кг"
            //// Variable: public double Weight;
            /// Real parameters:
            // FABRIC_SHEET_MASSUNIT	// "Sheet Mass per Unit Area": Structural Sheet Mass
            // per Unit Area [Sheet Mass / (Overall Length * Overall Width)]
            // COUPLER_WEIGHT			// Mass

            return(GetDoubleParameter(elemContainer.Element, new BuiltInParameter[] {
                BuiltInParameter.FABRIC_SHEET_MASSUNIT,
                BuiltInParameter.COUPLER_WEIGHT
            }));
        }
        public static string ElementUnit(ElementContainer elemContainer)
        {
            ///// "Ед. измерения"
            //// Variable: public string Unit;
            /// Real parameters:
            // IMPORT_DISPLAY_UNITS				// Import Units
            // ALTERNATE_UNITS					// Alternate Units
            // POINT_ELEMENT_MEASUREMENT_TYPE	// Measurement Type

            return(GetStringParameter(elemContainer.Element, new BuiltInParameter[] {
                BuiltInParameter.IMPORT_DISPLAY_UNITS,
                BuiltInParameter.ALTERNATE_UNITS,
                BuiltInParameter.POINT_ELEMENT_MEASUREMENT_TYPE
            }));
        }
        public static string ElementProvider(ElementContainer elemContainer)
        {
            ///// "Поставщик"
            //// Variable: public string Provider;
            /// Real parameters:
            // ALL_MODEL_MANUFACTURER	// Manufacturer
            // FABRICATION_VENDOR		// Vendor
            // FABRICATION_VENDOR_CODE	// Vendor Code

            return(GetStringParameter(elemContainer.Element, new BuiltInParameter[] {
                BuiltInParameter.ALL_MODEL_MANUFACTURER,
                BuiltInParameter.FABRICATION_VENDOR,
                BuiltInParameter.FABRICATION_VENDOR_CODE
            }));
        }
        public static string ElementProdCode(ElementContainer elemContainer)
        {
            ///// "Код продукции"
            //// Variable: public string ProdCode; //int ProdCode;
            /// Real parameters:
            // STRUCTURAL_FAMILY_CODE_NAME	// Code Name
            // OMNICLASS_CODE				// OmniClass Number
            // FABRICATION_PRODUCT_CODE		// Product Code
            // UNIFORMAT_CODE				// Assembly code

            return(GetStringParameter(elemContainer.Element, new BuiltInParameter[] {
                BuiltInParameter.STRUCTURAL_FAMILY_CODE_NAME,
                BuiltInParameter.OMNICLASS_CODE,
                BuiltInParameter.FABRICATION_PRODUCT_CODE,
                BuiltInParameter.UNIFORMAT_CODE
            }));
        }
        public static string ElementName(ElementContainer elemContainer)
        {
            ///// "Наименование и техническая характеристика"
            //// Variable: public string Name;
            /// Real parameters:
            // ELEM_FAMILY_PARAM		// Family
            // SYMBOL_FAMILY_NAME_PARAM	// Family Name
            // ALL_MODEL_FAMILY_NAME	// Family Name

            /// Doubtful:
            // FAMILY_NAME_PSEUDO_PARAM		// Family
            // DPART_ORIGINAL_FAMILY		// Original Family

            return(GetStringParameter(elemContainer.Element, new BuiltInParameter[] {
                BuiltInParameter.ELEM_FAMILY_PARAM,
                BuiltInParameter.SYMBOL_FAMILY_NAME_PARAM,
                BuiltInParameter.ALL_MODEL_FAMILY_NAME
            }));
        }
        public static string ElementNote(ElementContainer elemContainer)
        {
            ///// "Примечание"
            //// Variable: public string Note;
            /// Real parameters:
            // ALL_MODEL_INSTANCE_COMMENTS	// Comments
            // ALL_MODEL_DESCRIPTION		// Description
            // ALL_MODEL_TYPE_COMMENTS		// Type comments
            // MARKUPS_NOTES				// Notes
            // SHEET_ASSEMBLY_KEYNOTE		// Assembly: Keynote
            // FABRICATION_PART_NOTES		// Fabrication Notes
            // ALL_MODEL_URL				// URL

            return(GetStringParameter(elemContainer.Element, new BuiltInParameter[] {
                BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS,
                BuiltInParameter.ALL_MODEL_DESCRIPTION,
                BuiltInParameter.ALL_MODEL_TYPE_COMMENTS,
                BuiltInParameter.MARKUPS_NOTES,
                BuiltInParameter.SHEET_ASSEMBLY_KEYNOTE,
                BuiltInParameter.FABRICATION_PART_NOTES,
                BuiltInParameter.ALL_MODEL_URL
            }));
        }
        public static void FillLine(ElementContainer elemCont)
        {
            //// Заголовок категории
            if (elemCont.LineType == ElementContainer.ContType.Category)
            {
                elemCont.Line = new List <string>()
                {
                    "", elemCont.CategoryLine, "", "", "", "", "", "", ""
                };
            }

            //// Нумерация стоблцов
            else if (elemCont.LineType == ElementContainer.ContType.ColumnsEnumeration)
            {
                elemCont.Line = new List <string>()
                {
                    "1", "2", "3", "4", "5", "6", "7", "8", "9"
                };
            }

            //// Настоящий элемент
            else
            {
                elemCont.Line = new List <string>();

                // "Поз."
                elemCont.Line.Add(elemCont.Position.ToString());

                // "Наименование и техническая характеристика"
                elemCont.Line.Add(ElementName(elemCont));

                // "Тип, марка, обозначение документа, опросного листа"
                elemCont.Line.Add(ElementType(elemCont));

                // "Код продукции"
                elemCont.Line.Add(ElementProdCode(elemCont));

                // "Поставщик"
                elemCont.Line.Add(ElementProvider(elemCont));

                // "Ед. измерения"
                string unit = ElementUnit(elemCont);
                if (unit == String.Empty)
                {
                    elemCont.Line.Add("Шт.");
                }
                else
                {
                    elemCont.Line.Add(unit);
                }

                // "Количество"
                double amount = ElementAmount(elemCont);
                if (amount == 0.0)
                {
                    elemCont.Line.Add(String.Empty);
                }
                else
                {
                    elemCont.Line.Add(amount.ToString());
                }

                // "Масса 1 ед., кг"
                double weight = ElementWeight(elemCont);
                if (weight == 0.0)
                {
                    elemCont.Line.Add(String.Empty);
                }
                else
                {
                    elemCont.Line.Add(weight.ToString());
                }

                // "Примечание"
                elemCont.Line.Add(ElementNote(elemCont));
            }
        }
        public static void FillLine(ElementContainer elemCont)
        {
            //// Заголовок категории
            if (elemCont.LineType == ElementContainer.ContType.Category)
            {
                elemCont.Line = new List <string>()
                {
                    "", elemCont.CategoryLine, "", "", "", "", "", "", "", "", ""
                };
            }

            //// Нумерация стоблцов
            else if (elemCont.LineType == ElementContainer.ContType.ColumnsEnumeration)
            {
                elemCont.Line = new List <string>()
                {
                    "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"
                };
            }

            //// Настоящий элемент
            else
            {
                elemCont.Line = new List <string>();

                //(*1): № строки
                elemCont.Line.Add(elemCont.Position.ToString());

                //(*2): Наименование
                elemCont.Line.Add(GOST_21_110_2013.ElementName(elemCont));
                // ??? elemCont.Line.Add(GOST_21_110_2013.ElementType(elemCont));

                //(*3): Код продукции
                elemCont.Line.Add(GOST_21_110_2013.ElementProdCode(elemCont));

                //(*4): Обозначение документа на поставку
                elemCont.Line.Add("");

                //(*5): Поставщик
                elemCont.Line.Add(GOST_21_110_2013.ElementProvider(elemCont));

                //(*6): Куда входит(обозначение)
                elemCont.Line.Add("");

                //(*7): Количество
                elemCont.Line.Add("");
                elemCont.Line.Add("");
                elemCont.Line.Add("");

                double amount = GOST_21_110_2013.ElementAmount(elemCont);
                if (amount == 0.0)
                {
                    elemCont.Line.Add(String.Empty);
                }
                else
                {
                    elemCont.Line.Add(amount.ToString());
                }

                //(*8): Примечание
                elemCont.Line.Add(GOST_21_110_2013.ElementNote(elemCont));
            }
        }