That was first good orientation. Following is my standing now:
// doc is opened multilayer drawing document
// LOOP OVER many layers
//foreach (string layerName in layerNames) {
string dwgFile = Path.GetDirectoryName(doc.Name) + "\\" + layerName + DocUtil.DWG_EXTENSION;
Document acNewDoc = DocUtil.OpenDocument(dwgFile, true, false, true); ;
using (Transaction transNew = acNewDoc.Database.TransactionManager.StartTransaction()) {
using (DocumentLock doclck = acNewDoc.LockDocument()) {
using (Database destDb = acNewDoc.Database) {
ObjectId destDbMsId = SymbolUtilityServices.GetBlockModelSpaceId(destDb);
ObjectIdCollection layerEntities = elements[layerName];
transNew.TransactionManager.QueueForGraphicsFlush();
// next prepare to deepclone the recorded ids to the destdb
IdMapping mapping = new IdMapping();
// now clone the objects into the destdb
doc.Database.WblockCloneObjects(layerEntities, destDbMsId, mapping, DuplicateRecordCloning.Replace, false);
// hier I must delete my (non standard named layout)
LayoutUtil.deleteLayout("Work");
// and after this i have regenerated "Layout1" with all graphic elements into
}
}
transNew.Commit();
// regen all
}
// } loop
But I have new issue:
doc.SendStringToExecute("publish\n", false, false, false);
Calls command "publish" but, all my pdf sheets (from multisheet pdf - one per layout) are empty.
If I run it manually each my pdf sheet (from multisheet pdf) is OK and contains drawing elements.
Any ideas?
Thanks