I can't see to get this to work.
Question: When using the code provided, can I pass the database (db) to sub-functions? or do I have to try something else?
It looks like it might work, but I get an error when trying the command in Acad. Here is the main part of the rouine. If needs be I can post the whole code.
Thanks in advance for any help/tips on how to do this better.
public void UpdateRevStuff() {
Document Doc = AcadApp.DocumentManager.MdiActiveDocument;
Editor DocEd = Doc.Editor;
Autodesk.AutoCAD.Windows.OpenFileDialog Dia = new Autodesk.AutoCAD.Windows.OpenFileDialog("Select drawings to update Cloud layer", "", "dwg", "", Autodesk.AutoCAD.Windows.OpenFileDialog.OpenFileDialogFlags.AllowMultiple);
Dia.ShowDialog();
string[] DwgList = Dia.GetFilenames();
AxDbDocument dbxDoc = new AxDbDocument();
foreach (string Str in DwgList) {
dbxDoc.Open (Str, null);
Database db = Database.FromAcadDatabase (dbxDoc.Database);
using (CaddZone.DatabaseServices.WorkingDatabase wdb = new CaddZone.DatabaseServices.WorkingDatabase (db)) {
if (HasLayer (db, "Cloud-UNKNOWN")) {
string Rev = (GetHighestRev(db));
if (Rev != "") {
UpdateRevBlock (db, Rev);
UpdateCloudLayer (db, "Cloud-UNKNOWN", "Cloud-" + Rev);
dbxDoc.Save();
}
}
}
}
}