private MemoryStream GetSiemensZipStream(Material material, IList <Property> properties)
        {
            IList <ExportPropertyGeneral> propertiesMapped = MapProperites(properties, material.MaterialInfo.SourceId);
            bool isSteel = material.MaterialInfo.TypeId == 710 ? true : false;

            //TODO:-Kasnije postaviti tip plus materijala
            PlusGroup materialGroup = PlusGroup.Polymers;

            XDocument    siemensString       = NXSiemens.FillNXSiemens(material.MaterialInfo.Standard, material.MaterialInfo.Name, isSteel, materialGroup, propertiesMapped);
            MemoryStream memoryStreamsiemens = new MemoryStream();
            TextWriter   twsiemens           = new StreamWriter(memoryStreamsiemens);

            twsiemens.Write(System.Text.ASCIIEncoding.UTF8.GetString(Encoding.UTF8.GetBytes(siemensString.ToStringWithDeclaration())));
            twsiemens.Flush();
            MemoryStream zipStreamsiemens = new MemoryStream();

            using (ZipFile zip = new ZipFile())
            {
                memoryStreamsiemens.Seek(0, SeekOrigin.Begin);
                zip.AddEntry("Siemens NX" + material.MaterialInfo.Name.Replace("/", "") + " " + material.MaterialInfo.Standard.Replace("-", "") + ".xml", memoryStreamsiemens);
                zip.Save(zipStreamsiemens);
            }
            return(zipStreamsiemens);
        }
Example #2
0
 // Start is called before the first frame update
 void Start()
 {
     OnArround(true);
     group = GetComponentInParent <PlusGroup>();
 }
Example #3
0
        /// <summary>
        /// Fills the nx siemens.
        /// </summary>
        /// <returns></returns>
        public static XDocument FillNXSiemens(string standard, string name, bool isSteel, PlusGroup materialGroup, IList <ExportPropertyGeneral> properties)
        {
            XDocument xml       = new XDocument();
            XElement  MatML_Doc = new XElement("MatML_Doc");

            xml.Add(MatML_Doc);
            XElement Material = new XElement("Material");

            MatML_Doc.Add(Material);
            XElement BulkDetails = new XElement("BulkDetails");

            Material.Add(BulkDetails);
            XElement Name = new XElement("Name");

            Name.Value = name;
            BulkDetails.Add(Name);
            XElement Class     = new XElement("Class");
            XElement ClassName = new XElement("Name");


            if (isSteel)
            {
                ClassName.Value = "METAL";
            }
            else
            {
                //TODO:-Bice izmapirani Ceramics, COMPOSITES

                if (materialGroup == PlusGroup.Polymers)
                {
                    ClassName.Value = "POLYMERS";
                }
                //if (materialGroup == PlusGroup.Ceramics)
                //{
                //    ClassName.Value = "CERAMICS";
                //}
                //if (materialGroup == PlusGroup.Composites)
                //{
                //    ClassName.Value = "COMPOSITES";
                //}
            }
            Class.Add(ClassName);
            BulkDetails.Add(Class);
            XElement Source = new XElement("Source");

            Source.SetAttributeValue("source", "");
            BulkDetails.Add(Source);
            FillPropertyData(BulkDetails, properties);
            XElement Metadata = new XElement("Metadata");

            MatML_Doc.Add(Metadata);
            FillMetaData(Metadata);
            return(xml);
        }