EBDN - Community - Question & Answers

  Monday, 27 August 2018
  5 Replies
  1.6K Visits
0
Votes
Undo
Hello!

I was trying to export the Equiptment structure to an XML file. To export itself is working fine and very fast, but I have some issues with the attributes I wanted to export.
In my example I wanted to export the designation, TId, Comment and DimensioningIndex. The designation and the TId is working but the Comment und the DimensioningIndex is not exported.

Could you please check my code and tell me if anything is wrong there? I am using EB 6.8.0.


if(m_myApplication.Selection[0].Kind == ObjectKind.Equipment)
{
XMLExportConfiguration xc = m_myApplication.CreateXMLExportConfiguration();

xc.AttrIds = new List<AttributeId>() { AttributeId.Designation, AttributeId.TId, AttributeId.Comment, AttributeId.DimensioningIndex};
xc.Depth = -1;
xc.OutputAssocs = true;
xc.OutputBinaries = true;
xc.OutputDesignation = true;
xc.OutputUsageState = false;
xc.UseTranslate = false;

SaveFileDialog dialog = new SaveFileDialog();
dialog.FileName = "EquiptmentExport.xml";
dialog.Filter = "XML File | *.xml";

if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
StreamWriter writer = new StreamWriter(dialog.OpenFile());
writer.Write(m_myApplication.Selection[0].ExportXMLAsString(xc));
writer.Dispose();
writer.Close();
}
}
else
{
MessageBox.Show("The macro can only be started from the equiptment folder");
}


Thanks!

~Philipp~