protected override bool Read(Rhino.FileIO.BinaryArchiveReader archive)
        {
            Rhino.Collections.ArchivableDictionary dict = archive.ReadDictionary();
            Beam ownerBeam = ProjectPlugIn.Instance.Beams.Find(o => o.Id == dict.GetInteger("BeamId"));

            BaseBrep = (Brep)dict["baseBrep"];

            int noBaseCurves = dict.GetInteger("NoBaseCurves");

            for (int i = 0; i < noBaseCurves; i++)
            {
                BaseCurves.Add((Curve)dict["BaseCurve" + i]);
            }


            Id = (int)dict["Id"];
            if ((string)dict["Material"] == "Concrete")
            {
                Material = new ConcreteMaterial((string)dict["MaterialStrength"], ownerBeam);
            }
            else if ((string)dict["Material"] == "Steel")
            {
                Material = new SteelMaterial((string)dict["MaterialName"], SteelType.StructuralSteel, ownerBeam);
            }
            //TODO Add extra materials
            else
            {
                Material = new ConcreteMaterial("C30/37", ownerBeam);
            }

            return(true);
        }
 //Constructor
 public GeometryLarge(MaterialType materialType, string materialName, Brep baseBrep, Beam bm)
 {
     if (materialType == MaterialType.Concrete)
     {
         Material = new ConcreteMaterial(materialName, bm);
     }
     else if (materialType == MaterialType.Steel)
     {
         Material = new SteelMaterial(materialName, SteelType.StructuralSteel, bm);
     }
     BaseBrep  = baseBrep;
     OwnerBeam = bm;
     Id        = _idCounter;
     _idCounter++;
 }
        protected override bool Write(Rhino.FileIO.BinaryArchiveWriter archive)
        {
            var dict = new Rhino.Collections.ArchivableDictionary(20181023, "Values");

            dict.Set("baseBrep", BaseBrep);
            dict.Set("Id", Id);
            if (OwnerBeam != null)
            {
                dict.Set("BeamId", OwnerBeam.Id);
            }
            else
            {
                dict.Set("BeamId", -1);
            }
            dict.Set("NoBaseCurves", BaseCurves.Count);
            for (int i = 0; i < BaseCurves.Count; i++)
            {
                dict.Set("BaseCurve" + i, BaseCurves[i]);
            }

            if (Material.GetType() == typeof(ConcreteMaterial))
            {
                ConcreteMaterial material = Material as ConcreteMaterial;
                dict.Set("Material", "Concrete");
                dict.Set("MaterialStrength", material.StrengthClass);
            }
            else if (Material.GetType() == typeof(SteelMaterial))
            {
                SteelMaterial material = Material as SteelMaterial;

                dict.Set("Material", "Steel");
                dict.Set("MaterialName", material.StrengthClass);
            }

            archive.WriteDictionary(dict);

            return(true);
        }