EBDN - Community - Question & Answers

  Wednesday, 29 September 2021
  1 Replies
  896 Visits
0
Votes
Undo
Hi together,

using

ObjectCollection all_sheets = oi.Project.DrawingsFolder.FindObjects(ObjectKind.Sheet, SearchBehavior.Hierarchical);

i collect all sheets of my project.

I have another collection which contains sheets which should not be in the output PDF. Let's assume, the collecion is named "skipped"
Now I transfer all used sheet in a new collection:


List<ObjectItem> items = new List<ObjectItem>();
foreach (ObjectItem i in all_sheets)
{
if (skipped.Contains(i)) continue;
items.Add(i);
}


using that collection for smartpdf


mApp.Automation.Parameters.Clear();
mApp.Automation.Parameters.Add(dir); // 0: Pdf output path.
mApp.Automation.Parameters.Add((object)startobject); // 1: Start Object Item.
mApp.Automation.Parameters.Add(false); // 2: Show or Hide Assistant Window.
mApp.Automation.Parameters.Add(false); // 3: Exports only with Documents Navigation.
mApp.Automation.Parameters.Add(false); // 4: Export for Graphical Revision.
mApp.Automation.Parameters.Add(false); // 5: Show Options button in Main Window.
mApp.Automation.Parameters.Add(items); // 6: Collection of Sheets to export.


the last statement adding the sheets throw the following Exception:

System.Runtime.Serialization.SerializationException: "Der Typ "Aucotec.EngineeringBase.Client.Runtime.ObjectItem" in Assembly "Aucotec.EngineeringBase.Client.Runtime.v1.0, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6d4e536fc230a61a" ist nicht als serialisierbar gekennzeichnet."

The exception does not occure, if I add the original ObjectCollection all_sheets.

Can somebody help ?

Thanks in advance,
Thomas