public void AddDataExchangeFormatToXMLOutput(CAD.AssembliesType assembliesRoot) { if (STEP_DataExchangeFormats.Count > 0 || NonSTEP_DataExchangeFormats.Count > 0 || SpecialDataFormatInstructions.Count > 0) { CAD.DataExchangeType dataexchangeout = new CAD.DataExchangeType(); dataexchangeout._id = UtilityHelpers.MakeUdmID(); List <CAD.STEPFormatType> exchangelist = new List <CAD.STEPFormatType>(); foreach (var item in STEP_DataExchangeFormats) { CAD.STEPFormatType formatout = new CAD.STEPFormatType(); formatout._id = UtilityHelpers.MakeUdmID(); formatout.Name = item; exchangelist.Add(formatout); } List <CAD.NonSTEPFormatType> stllist = new List <CAD.NonSTEPFormatType>(); foreach (var item in NonSTEP_DataExchangeFormats) { CAD.NonSTEPFormatType formatout = new CAD.NonSTEPFormatType(); formatout._id = UtilityHelpers.MakeUdmID(); switch (item.ToLower()) { case "inventor": case "parasolid": formatout.FormatType = item; formatout.FormatSubType = ""; break; case "stereolithography_ascii": formatout.FormatType = "Stereolithography"; formatout.FormatSubType = "ASCII"; break; case "stereolithography_binary": formatout.FormatType = "Stereolithography"; formatout.FormatSubType = "BINARY"; break; case "dxf_2013": formatout.FormatType = "DXF"; formatout.FormatSubType = "2013"; break; default: Logger.Instance.AddLogMessage("AddDataExchangeFormatToXMLOutput received an unknown NonSTEP_DataExchangeFormat, recieved value: " + item + " This would be due to a programming error/bug.", Severity.Error); break; } stllist.Add(formatout); } List <CAD.SpecialDataFormatInstructionType> specialInst = new List <CAD.SpecialDataFormatInstructionType>(); foreach (var item in SpecialDataFormatInstructions) { CAD.SpecialDataFormatInstructionType formatout = new CAD.SpecialDataFormatInstructionType(); formatout._id = UtilityHelpers.MakeUdmID(); formatout.Instruction = item; specialInst.Add(formatout); } if (exchangelist.Count > 0) { dataexchangeout.STEPFormat = exchangelist.ToArray(); } if (stllist.Count > 0) { dataexchangeout.NonSTEPFormat = stllist.ToArray(); } if (specialInst.Count > 0) { dataexchangeout.SpecialDataFormatInstruction = specialInst.ToArray(); } assembliesRoot.DataExchange = dataexchangeout; } }
public void AddDataExchangeFormatToXMLOutput(CAD.AssembliesType assembliesRoot) { if (DataExchangeFormats.Count > 0 || STLDataExchangeFormats.Count > 0 || SpecialDataFormatInstructions.Count > 0) { CAD.DataExchangeType dataexchangeout = new CAD.DataExchangeType(); dataexchangeout._id = UtilityHelpers.MakeUdmID(); List<CAD.STEPFormatType> exchangelist = new List<CAD.STEPFormatType>(); foreach (var item in DataExchangeFormats) { CAD.STEPFormatType formatout = new CAD.STEPFormatType(); formatout._id = UtilityHelpers.MakeUdmID(); formatout.Name = item; exchangelist.Add(formatout); } List<CAD.NonSTEPFormatType> stllist = new List<CAD.NonSTEPFormatType>(); foreach (var item in STLDataExchangeFormats) { CAD.NonSTEPFormatType formatout = new CAD.NonSTEPFormatType(); formatout._id = UtilityHelpers.MakeUdmID(); if (item == "Inventor" || item == "Parasolid") { formatout.FormatType = item; formatout.FormatSubType = ""; } else { formatout.FormatType = "Stereolithography"; formatout.FormatSubType = item.ToUpper(); } stllist.Add(formatout); } List<CAD.SpecialDataFormatInstructionType> specialInst = new List<CAD.SpecialDataFormatInstructionType>(); foreach (var item in SpecialDataFormatInstructions) { CAD.SpecialDataFormatInstructionType formatout = new CAD.SpecialDataFormatInstructionType(); formatout._id = UtilityHelpers.MakeUdmID(); formatout.Instruction = item; specialInst.Add(formatout); } if (exchangelist.Count > 0) dataexchangeout.STEPFormat = exchangelist.ToArray(); if (stllist.Count > 0) dataexchangeout.NonSTEPFormat = stllist.ToArray(); if (specialInst.Count > 0) dataexchangeout.SpecialDataFormatInstruction = specialInst.ToArray(); assembliesRoot.DataExchange = dataexchangeout; } }