コード例 #1
0
        public override void RunAnalysis()
        {
            if (this.Designers == null)
            {
                return;
            }

            this.m_TextualOutput = "sustainability-open v" + SOFramework.VERSION + "\n\n";
            this.m_MaterialQuantities.Clear();

            foreach (SOComponent component in this.CurrentDesignAlternative.FlattenedLeafComponents)
            {
                foreach (SOPhysicalObject obj in component.Parts)
                {
                    this.m_TextualOutput += "Physical object: " + obj.Name + "\n";
                    SOMaterialQuantity quantity = obj.MaterialQuantity;

                    this.m_TextualOutput += "- " + quantity.Material.Name + ": " + quantity.Quantity.ToString("    0.00") + " " + quantity.Unit + "\n";
                    bool exists = false;
                    foreach (SOMaterialQuantity totalquantity in this.m_MaterialQuantities)
                    {
                        if ((totalquantity.Material.Equals(quantity.Material)) ||
                            (totalquantity.Material.Name.Equals(quantity.Material.Name)))
                        {
                            totalquantity.Quantity += quantity.Quantity;
                            exists = true;
                            break;
                        }
                    }
                    if (!exists)
                    {
                        this.m_MaterialQuantities.Add(new SOMaterialQuantity(quantity.Material, quantity.Quantity, quantity.Unit));
                    }
                }
            }


            this.m_TextualOutput += "\nTotals\n";
            foreach (SOMaterialQuantity quantity in this.m_MaterialQuantities)
            {
                this.m_TextualOutput += "- " + quantity.Material.Name + ": " + quantity.Quantity.ToString("    0.00") + " " + quantity.Unit + "\n";
            }
        }
 public void SetUp()
 {
     this.m_Material = new SOMaterial(MATERIAL_NAME);
     this.m_Quantity = new SOMaterialQuantity(this.m_Material, QUANTITY, UNIT);
 }