private void writeMaterialAsElement(XmlTextWriter xw, MetalBar material) { xw.WriteStartElement("Material"); //Type xw.WriteStartElement("Type"); xw.WriteString(material.type); xw.WriteEndElement(); //Holes xw.WriteStartElement("Holes"); xw.WriteString(material.holes.ToString()); xw.WriteEndElement(); //Length xw.WriteStartElement("Length"); xw.WriteString(material.length.ToString()); xw.WriteEndElement(); //FirstOffset xw.WriteStartElement("FirstOffset"); xw.WriteString(material.firstOffset.ToString()); xw.WriteEndElement(); //LastOffset xw.WriteStartElement("LastOffset"); xw.WriteString(material.lastOffset.ToString()); xw.WriteEndElement(); //holeDist xw.WriteStartElement("HoleDist"); xw.WriteString(material.holeDist.ToString()); xw.WriteEndElement(); //Finish out and close the overall element. xw.WriteEndElement(); }
private void addButton_Click(object sender, EventArgs e) { MetalBar rmBar = new MetalBar(); rmBar.type = typeTextBox.Text.ToString(); Double.TryParse(overLenTextB.Text.ToString(), out rmBar.length); if (holesCHK.Enabled) { rmBar.holes = true; Double.TryParse(leftOffTextB.Text.ToString(), out rmBar.firstOffset); Double.TryParse(rightOffTextB.Text.ToString(), out rmBar.lastOffset); Double.TryParse(holeDistTextB.Text.ToString(), out rmBar.holeDist); } else rmBar.holes = false; bool noMatch = true; for (int i = 0; i < rawMats.Count; i++) { if(String.Compare(rawMats[i].type, typeTextBox.Text.ToString()) == 0) noMatch = false; } if (noMatch) rawMats.Add(rmBar); else { string errMsg = "Cannot add duplicate raw materials."; this.errorProvider1.SetError(addButton, errMsg); } displayPartList(); }
public bool validCut(MetalBar pc, bool backCut) { MetalBar testPiece = new MetalBar(); testPiece.length = loadedPiece.length; if (backCut) { testPiece.lastOffset = loadedPiece.firstOffset; testPiece.firstOffset = loadedPiece.lastOffset; } else { testPiece.lastOffset = loadedPiece.lastOffset; testPiece.firstOffset = loadedPiece.firstOffset; } testPiece.holeDist = loadedPiece.holeDist; if (testPiece.length > pc.length) { if (testPiece.firstOffset > pc.firstOffset) { double difference = testPiece.firstOffset - pc.firstOffset; testPiece.length -= difference; } else if (testPiece.firstOffset < pc.firstOffset) { testPiece.length -= testPiece.firstOffset; testPiece.firstOffset = testPiece.holeDist; double difference = testPiece.firstOffset - pc.firstOffset; testPiece.length -= difference; } //Then we see if there's enough left to cut it to length. If there is, we return true. //Otherwise we return false. if (testPiece.length >= pc.length) { return(true); } else { return(false); } } else if (testPiece.length == pc.length) { if (testPiece.firstOffset == pc.firstOffset && testPiece.lastOffset == pc.lastOffset) { return(true); } else { return(false); } } else { return(false); } }
public MetalBar(MetalBar cpy) { type = cpy.type; holes = cpy.holes; length = cpy.length; firstOffset = cpy.firstOffset; lastOffset = cpy.lastOffset; holeDist = cpy.holeDist; }
public MetalBar(MetalBar cpy) { type = cpy.type; holes = cpy.holes; length = cpy.length; firstOffset = cpy.firstOffset; lastOffset = cpy.lastOffset; holeDist = cpy.holeDist; }
private int matchClosestDrop(List <MetalBar> pile, MetalBar pc) { double bestSize = 2000; int bestID = -1; for (int i = 0; i < pile.Count(); i++) { //std::cout << "Comparing: " << pile[i].length << " < " << bestSize << " and " << pile[i].length << " > " << pc.length << "\n"; if (pile[i].length <bestSize && pile[i].length> pc.length) { bestSize = pile[i].length; bestID = i; } } return(bestID); }
public void cutPiece(MetalBar pc, bool backCut) { //The very first thing we need to do is flip the piece on the table around if we want to back cut it. if (backCut) { double tempOffset = loadedPiece.firstOffset; loadedPiece.firstOffset = loadedPiece.lastOffset; loadedPiece.lastOffset = tempOffset; } //Do two things here. First, we need to cut to the offset. //If the first offset on the loaded piece is more than that of the piece we want, just cut it down. if (loadedPiece.firstOffset > pc.firstOffset) { //Get the difference first. double difference = loadedPiece.firstOffset - pc.firstOffset; //Then cut down the length of the loaded piece by the difference. loadedPiece.length -= difference; //Then we cut the piece itself to length. loadedPiece.length -= pc.length; //Then we need to set the first offset to the hole distance of the raw material //minus the last offset of the piece we just cut. loadedPiece.firstOffset = loadedPiece.holeDist - pc.lastOffset; } //If the first offset on the loaded piece is less than that of the piece we want, we have to go down to the next hole. else if (loadedPiece.firstOffset < pc.firstOffset) { //We cut the first hole off to make the offset distance the maximum possible for the raw material. loadedPiece.length -= pc.firstOffset; loadedPiece.firstOffset = loadedPiece.holeDist; //Then we proceed as normal. double difference = loadedPiece.firstOffset - pc.firstOffset; loadedPiece.length -= difference; loadedPiece.length -= pc.length; loadedPiece.firstOffset = loadedPiece.holeDist - loadedPiece.lastOffset; } //Otherwise if they're equal just cut the length off. //I don't anticipate this ever happening but you never know! else { loadedPiece.length -= pc.length; loadedPiece.firstOffset = loadedPiece.holeDist - pc.lastOffset; } }
public void cutPiece(MetalBar pc, bool backCut) { //The very first thing we need to do is flip the piece on the table around if we want to back cut it. if (backCut) { double tempOffset = loadedPiece.firstOffset; loadedPiece.firstOffset = loadedPiece.lastOffset; loadedPiece.lastOffset = tempOffset; } //Do two things here. First, we need to cut to the offset. //If the first offset on the loaded piece is more than that of the piece we want, just cut it down. if (loadedPiece.firstOffset > pc.firstOffset) { //Get the difference first. double difference = loadedPiece.firstOffset - pc.firstOffset; //Then cut down the length of the loaded piece by the difference. loadedPiece.length -= difference; //Then we cut the piece itself to length. loadedPiece.length -= pc.length; //Then we need to set the first offset to the hole distance of the raw material //minus the last offset of the piece we just cut. loadedPiece.firstOffset = loadedPiece.holeDist - pc.lastOffset; } //If the first offset on the loaded piece is less than that of the piece we want, we have to go down to the next hole. else if (loadedPiece.firstOffset < pc.firstOffset) { //We cut the first hole off to make the offset distance the maximum possible for the raw material. loadedPiece.length -= pc.firstOffset; loadedPiece.firstOffset = loadedPiece.holeDist; //Then we proceed as normal. double difference = loadedPiece.firstOffset - pc.firstOffset; loadedPiece.length -= difference; loadedPiece.length -= pc.length; loadedPiece.firstOffset = loadedPiece.holeDist - loadedPiece.lastOffset; } //Otherwise if they're equal just cut the length off. //I don't anticipate this ever happening but you never know! else { loadedPiece.length -= pc.length; loadedPiece.firstOffset = loadedPiece.holeDist - pc.lastOffset; } }
private void addButton_Click(object sender, EventArgs e) { MetalBar partTemplate = new MetalBar(rawMats[selectedRMIndex]); double len; double fiO; double laO; Double.TryParse(partLengthText.Text.ToString(), out len); Double.TryParse(partLeftOText.Text.ToString(), out fiO); Double.TryParse(partRightOText.Text.ToString(), out laO); partTemplate.length = len; partTemplate.firstOffset = fiO; partTemplate.lastOffset = laO; int quan; Int32.TryParse(quantityText.Text.ToString(), out quan); Bundle nextBund = new Bundle(partNameText.Text.ToString(), partTemplate, quan); cutAgenda.Add(nextBund); displayCutList(); }
private void loadSaw(ref List <MetalBar> pile, MetalBar pc, MetalBar rawMat, ref Saw cutter, ref int rmTracker) { if (pile.Count() > 0) { int dropToUse = matchClosestDrop(pile, pc); if (dropToUse == -1) { cutter.load(rawMat); rmTracker++; } else { cutter.load(pile[dropToUse]); pile.RemoveAt(dropToUse); } } else { cutter.load(rawMat); rmTracker++; } }
private void addButton_Click(object sender, EventArgs e) { MetalBar rmBar = new MetalBar(); rmBar.type = typeTextBox.Text.ToString(); Double.TryParse(overLenTextB.Text.ToString(), out rmBar.length); if (holesCHK.Enabled) { rmBar.holes = true; Double.TryParse(leftOffTextB.Text.ToString(), out rmBar.firstOffset); Double.TryParse(rightOffTextB.Text.ToString(), out rmBar.lastOffset); Double.TryParse(holeDistTextB.Text.ToString(), out rmBar.holeDist); } else { rmBar.holes = false; } bool noMatch = true; for (int i = 0; i < rawMats.Count; i++) { if (String.Compare(rawMats[i].type, typeTextBox.Text.ToString()) == 0) { noMatch = false; } } if (noMatch) { rawMats.Add(rmBar); } else { string errMsg = "Cannot add duplicate raw materials."; this.errorProvider1.SetError(addButton, errMsg); } displayPartList(); }
private void addButton_Click(object sender, EventArgs e) { MetalBar partTemplate = new MetalBar(rawMats[selectedRMIndex]); double len; double fiO; double laO; Double.TryParse(partLengthText.Text.ToString(), out len); Double.TryParse(partLeftOText.Text.ToString(), out fiO); Double.TryParse(partRightOText.Text.ToString(), out laO); partTemplate.length = len; partTemplate.firstOffset = fiO; partTemplate.lastOffset = laO; int quan; Int32.TryParse(quantityText.Text.ToString(), out quan); Bundle nextBund = new Bundle(partNameText.Text.ToString(), partTemplate, quan); cutAgenda.Add(nextBund); displayCutList(); }
private void loadCutListToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.DefaultExt = ".xml"; dlg.Filter = "XML documents (.xml)|*.xml"; dlg.InitialDirectory = Application.StartupPath; if (dlg.ShowDialog() == DialogResult.OK) { XmlDocument xDoc = new XmlDocument(); xDoc.Load(dlg.FileName); cutAgenda.Clear(); sawCutList.Items.Clear(); XmlNode verify = xDoc.SelectSingleNode("/CutList"); if (verify == null) { closeProgram(); //failure event. I suppose closing the program is dramatic enough } XmlNodeList nodli = xDoc.SelectNodes("/CutList/Bundle"); foreach (XmlNode node in nodli) { Bundle nextBund = new Bundle(); //Get part name. This should be the first property. nextBund.partname = node.ChildNodes.Item(0).InnerText; string quan = node.ChildNodes.Item(1).InnerText; int quant; Int32.TryParse(quan, out quant); nextBund.quantity = quant; //Now we're done with the non metal bar parts in the bundle. MetalBar nextMB = new MetalBar(); XmlNode savedTemplate = node.SelectSingleNode("PartSpecs"); //Get type. This is already a string so no converstion needed. nextMB.type = savedTemplate.ChildNodes.Item(0).InnerText; //Get holes. Convert to boolean from string. string hol = savedTemplate.ChildNodes.Item(1).InnerText; bool holes; Boolean.TryParse(hol, out holes); nextMB.holes = holes; //Get legnth. Convert to double from string. string len = savedTemplate.ChildNodes.Item(2).InnerText; double length; Double.TryParse(len, out length); nextMB.length = length; //Get first offest. Convert to double from string. string fiO = savedTemplate.ChildNodes.Item(3).InnerText; double firstOff; Double.TryParse(fiO, out firstOff); nextMB.firstOffset = firstOff; //Get last offset. Convert to double from string. string laO = savedTemplate.ChildNodes.Item(4).InnerText; double lastOff; Double.TryParse(laO, out lastOff); nextMB.lastOffset = lastOff; //Get hole distance. Convert to double from string. string hoD = savedTemplate.ChildNodes.Item(5).InnerText; double holeDist; Double.TryParse(hoD, out holeDist); nextMB.holeDist = holeDist; nextBund.metaltype = nextMB; cutAgenda.Add(nextBund); } displayCutList(); } displayRMList(); //If we load a nonblank list, enable the button. if (rawMatList.Items.Count > 0) { cutPartsButton.Enabled = true; } }
private void loadMaterialsToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.DefaultExt = ".xml"; dlg.Filter = "XML documents (.xml)|*.xml"; dlg.InitialDirectory = Application.StartupPath; if (dlg.ShowDialog() == DialogResult.OK) { XmlDocument xDoc = new XmlDocument(); xDoc.Load(dlg.FileName); //XmlTextReader xReader = new XmlTextReader(dlg.FileName); //xReader.WhitespaceHandling = WhitespaceHandling.None; //xReader.Read(); //First we clear out the shit that's already there. rawMats.Clear(); rawMatList.Items.Clear(); XmlNode verify = xDoc.SelectSingleNode("/MaterialList"); if (verify == null) { closeProgram(); //failure event. I suppose closing the program is dramatic enough } XmlNodeList nodli = xDoc.SelectNodes("/MaterialList/Material"); foreach (XmlNode node in nodli) { MetalBar nextMB = new MetalBar(); //Get type. This is already a string so no converstion needed. nextMB.type = node.ChildNodes.Item(0).InnerText; //Get holes. Convert to boolean from string. string hol = node.ChildNodes.Item(1).InnerText; bool holes; Boolean.TryParse(hol, out holes); nextMB.holes = holes; //Get legnth. Convert to double from string. string len = node.ChildNodes.Item(2).InnerText; double length; Double.TryParse(len, out length); nextMB.length = length; //Get first offest. Convert to double from string. string fiO = node.ChildNodes.Item(3).InnerText; double firstOff; Double.TryParse(fiO, out firstOff); nextMB.firstOffset = firstOff; //Get last offset. Convert to double from string. string laO = node.ChildNodes.Item(4).InnerText; double lastOff; Double.TryParse(laO, out lastOff); nextMB.lastOffset = lastOff; //Get hole distance. Convert to double from string. string hoD = node.ChildNodes.Item(5).InnerText; double holeDist; Double.TryParse(hoD, out holeDist); nextMB.holeDist = holeDist; rawMats.Add(nextMB); } displayRMList(); //If we load a nonblank list, enable the button. if (rawMatList.Items.Count > 0) { cutPartsButton.Enabled = true; } //Then we go into the load loop. This was the old way of doing it. /* * while (!xReader.EOF) * { * //We should not be at the first tag * if (xReader.Name == "MaterialList" && !xReader.IsStartElement()) break; * * while (xReader.Name != "Material" || !xReader.IsStartElement()) * xReader.Read(); // advance to <Material> tag * * string matType; * string holes; * string length; * string firstOff; * string lastOff; * string holeDist; * * //Not worried about attributes here. Next we advance to the type tag. * xReader.Read(); * matType = xReader.ReadElementString("Type"); * //Advance to the next set of tags, the holes. * xReader.Read(); * holes = xReader.ReadElementString("Holes"); * //Advance to length * xReader.Read(); * length = xReader.ReadElementString("Length"); * //Advance to firstoff * xReader.Read(); * firstOff = xReader.ReadElementString("FirstOffset"); * //Advance to lastoff * xReader.Read(); * lastOff = xReader.ReadElementString("LastOffset"); * //Advance to holedist * xReader.Read(); * holeDist = xReader.ReadElementString("HoleDist"); * * //Now we process the metal bar, and then stuff it in the list. * MetalBar nextMB = new MetalBar(); * nextMB.type = matType; * rawMats.Add(nextMB); * * //Advance again. We should now be in the next material tag. * xReader.Read(); * } */ } }
public Bundle() { partname = ""; metaltype = new MetalBar(); quantity = 0; }
public Bundle(string pn, MetalBar mb, int quan) { partname = pn; metaltype = new MetalBar(mb); quantity = quan; }
public Bundle() { partname = ""; metaltype = new MetalBar(); quantity = 0; }
public Bundle(string pn, MetalBar mb, int quan) { partname = pn; metaltype = new MetalBar(mb); quantity = quan; }
public bool validCut(MetalBar pc, bool backCut) { MetalBar testPiece = new MetalBar(); testPiece.length = loadedPiece.length; if (backCut) { testPiece.lastOffset = loadedPiece.firstOffset; testPiece.firstOffset = loadedPiece.lastOffset; } else { testPiece.lastOffset = loadedPiece.lastOffset; testPiece.firstOffset = loadedPiece.firstOffset; } testPiece.holeDist = loadedPiece.holeDist; if (testPiece.length > pc.length) { if (testPiece.firstOffset > pc.firstOffset) { double difference = testPiece.firstOffset - pc.firstOffset; testPiece.length -= difference; } else if (testPiece.firstOffset < pc.firstOffset) { testPiece.length -= testPiece.firstOffset; testPiece.firstOffset = testPiece.holeDist; double difference = testPiece.firstOffset - pc.firstOffset; testPiece.length -= difference; } //Then we see if there's enough left to cut it to length. If there is, we return true. //Otherwise we return false. if (testPiece.length >= pc.length) { return true; } else return false; } else if (testPiece.length == pc.length) { if (testPiece.firstOffset == pc.firstOffset && testPiece.lastOffset == pc.lastOffset) return true; else return false; } else return false; }
public void load(MetalBar pc) { loadedPiece = new MetalBar(pc); }
private int matchClosestDrop(List<MetalBar> pile, MetalBar pc) { double bestSize = 2000; int bestID = -1; for (int i = 0; i < pile.Count(); i++) { //std::cout << "Comparing: " << pile[i].length << " < " << bestSize << " and " << pile[i].length << " > " << pc.length << "\n"; if (pile[i].length < bestSize && pile[i].length > pc.length) { bestSize = pile[i].length; bestID = i; } } return bestID; }
private void loadSaw(ref List<MetalBar> pile, MetalBar pc, MetalBar rawMat, ref Saw cutter, ref int rmTracker) { if(pile.Count() > 0) { int dropToUse = matchClosestDrop(pile, pc); if(dropToUse == -1) { cutter.load(rawMat); rmTracker++; } else { cutter.load(pile[dropToUse]); pile.RemoveAt(dropToUse); } } else { cutter.load(rawMat); rmTracker++; } }
private void loadMaterialsToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.DefaultExt = ".xml"; dlg.Filter = "XML documents (.xml)|*.xml"; dlg.InitialDirectory = Application.StartupPath; if (dlg.ShowDialog() == DialogResult.OK) { XmlDocument xDoc = new XmlDocument(); xDoc.Load(dlg.FileName); //XmlTextReader xReader = new XmlTextReader(dlg.FileName); //xReader.WhitespaceHandling = WhitespaceHandling.None; //xReader.Read(); //First we clear out the shit that's already there. rawMats.Clear(); rawMatList.Items.Clear(); XmlNode verify = xDoc.SelectSingleNode("/MaterialList"); if (verify == null) { closeProgram(); //failure event. I suppose closing the program is dramatic enough } XmlNodeList nodli = xDoc.SelectNodes("/MaterialList/Material"); foreach (XmlNode node in nodli) { MetalBar nextMB = new MetalBar(); //Get type. This is already a string so no converstion needed. nextMB.type = node.ChildNodes.Item(0).InnerText; //Get holes. Convert to boolean from string. string hol = node.ChildNodes.Item(1).InnerText; bool holes; Boolean.TryParse(hol, out holes); nextMB.holes = holes; //Get legnth. Convert to double from string. string len = node.ChildNodes.Item(2).InnerText; double length; Double.TryParse(len, out length); nextMB.length = length; //Get first offest. Convert to double from string. string fiO = node.ChildNodes.Item(3).InnerText; double firstOff; Double.TryParse(fiO, out firstOff); nextMB.firstOffset = firstOff; //Get last offset. Convert to double from string. string laO = node.ChildNodes.Item(4).InnerText; double lastOff; Double.TryParse(laO, out lastOff); nextMB.lastOffset = lastOff; //Get hole distance. Convert to double from string. string hoD = node.ChildNodes.Item(5).InnerText; double holeDist; Double.TryParse(hoD, out holeDist); nextMB.holeDist = holeDist; rawMats.Add(nextMB); } displayRMList(); //If we load a nonblank list, enable the button. if (rawMatList.Items.Count > 0) { cutPartsButton.Enabled = true; } //Then we go into the load loop. This was the old way of doing it. /* while (!xReader.EOF) { //We should not be at the first tag if (xReader.Name == "MaterialList" && !xReader.IsStartElement()) break; while (xReader.Name != "Material" || !xReader.IsStartElement()) xReader.Read(); // advance to <Material> tag string matType; string holes; string length; string firstOff; string lastOff; string holeDist; //Not worried about attributes here. Next we advance to the type tag. xReader.Read(); matType = xReader.ReadElementString("Type"); //Advance to the next set of tags, the holes. xReader.Read(); holes = xReader.ReadElementString("Holes"); //Advance to length xReader.Read(); length = xReader.ReadElementString("Length"); //Advance to firstoff xReader.Read(); firstOff = xReader.ReadElementString("FirstOffset"); //Advance to lastoff xReader.Read(); lastOff = xReader.ReadElementString("LastOffset"); //Advance to holedist xReader.Read(); holeDist = xReader.ReadElementString("HoleDist"); //Now we process the metal bar, and then stuff it in the list. MetalBar nextMB = new MetalBar(); nextMB.type = matType; rawMats.Add(nextMB); //Advance again. We should now be in the next material tag. xReader.Read(); } */ } }
private void loadCutListToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.DefaultExt = ".xml"; dlg.Filter = "XML documents (.xml)|*.xml"; dlg.InitialDirectory = Application.StartupPath; if (dlg.ShowDialog() == DialogResult.OK) { XmlDocument xDoc = new XmlDocument(); xDoc.Load(dlg.FileName); cutAgenda.Clear(); sawCutList.Items.Clear(); XmlNode verify = xDoc.SelectSingleNode("/CutList"); if (verify == null) { closeProgram(); //failure event. I suppose closing the program is dramatic enough } XmlNodeList nodli = xDoc.SelectNodes("/CutList/Bundle"); foreach (XmlNode node in nodli) { Bundle nextBund = new Bundle(); //Get part name. This should be the first property. nextBund.partname = node.ChildNodes.Item(0).InnerText; string quan = node.ChildNodes.Item(1).InnerText; int quant; Int32.TryParse(quan, out quant); nextBund.quantity = quant; //Now we're done with the non metal bar parts in the bundle. MetalBar nextMB = new MetalBar(); XmlNode savedTemplate = node.SelectSingleNode("PartSpecs"); //Get type. This is already a string so no converstion needed. nextMB.type = savedTemplate.ChildNodes.Item(0).InnerText; //Get holes. Convert to boolean from string. string hol = savedTemplate.ChildNodes.Item(1).InnerText; bool holes; Boolean.TryParse(hol, out holes); nextMB.holes = holes; //Get legnth. Convert to double from string. string len = savedTemplate.ChildNodes.Item(2).InnerText; double length; Double.TryParse(len, out length); nextMB.length = length; //Get first offest. Convert to double from string. string fiO = savedTemplate.ChildNodes.Item(3).InnerText; double firstOff; Double.TryParse(fiO, out firstOff); nextMB.firstOffset = firstOff; //Get last offset. Convert to double from string. string laO = savedTemplate.ChildNodes.Item(4).InnerText; double lastOff; Double.TryParse(laO, out lastOff); nextMB.lastOffset = lastOff; //Get hole distance. Convert to double from string. string hoD = savedTemplate.ChildNodes.Item(5).InnerText; double holeDist; Double.TryParse(hoD, out holeDist); nextMB.holeDist = holeDist; nextBund.metaltype = nextMB; cutAgenda.Add(nextBund); } displayCutList(); } displayRMList(); //If we load a nonblank list, enable the button. if (rawMatList.Items.Count > 0) { cutPartsButton.Enabled = true; } }
public Saw() { loadedPiece = new MetalBar(); }
public void load(MetalBar pc) { loadedPiece = new MetalBar(pc); }
public Saw() { loadedPiece = new MetalBar(); }
private void writeMaterialAsElement(XmlTextWriter xw, MetalBar material) { xw.WriteStartElement("Material"); //Type xw.WriteStartElement("Type"); xw.WriteString(material.type); xw.WriteEndElement(); //Holes xw.WriteStartElement("Holes"); xw.WriteString(material.holes.ToString()); xw.WriteEndElement(); //Length xw.WriteStartElement("Length"); xw.WriteString(material.length.ToString()); xw.WriteEndElement(); //FirstOffset xw.WriteStartElement("FirstOffset"); xw.WriteString(material.firstOffset.ToString()); xw.WriteEndElement(); //LastOffset xw.WriteStartElement("LastOffset"); xw.WriteString(material.lastOffset.ToString()); xw.WriteEndElement(); //holeDist xw.WriteStartElement("HoleDist"); xw.WriteString(material.holeDist.ToString()); xw.WriteEndElement(); //Finish out and close the overall element. xw.WriteEndElement(); }