23.09.2013 Views

Dia 1 - CAD College

Dia 1 - CAD College

Dia 1 - CAD College

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

F- The Afdrukken Palette<br />

One way to access the Layouts in a Database is to use the<br />

LayoutDictionary.<br />

In this routien,we open the LayoutDictionary get the current<br />

Layout Name (EnergieDakStuklijst), and then we ask the<br />

LayoutDictionary if it has an entry with an EntryName that is the<br />

same as the current<br />

layout’s name , it’s the different between BlockTableRecord<br />

names(*Model_Space, *Paper_Space, *Paper_Space0) and<br />

Layout Names (Model, Layout1, Layout2).<br />

Its work perfectly I use it to switch to Model , EnergieDakStuklijst-<br />

Layout , EnergieDakProject.<br />

Dim doc = Autodesk.Auto<strong>CAD</strong>.ApplicationServices.Application.<br />

DocumentManager.MdiActiveDocument<br />

Dim myDB As Database =<br />

HostApplicationServices.WorkingDatabase<br />

Using myTrans As Transaction =<br />

myDB.TransactionManager.StartTransaction<br />

Using doc.LockDocument()<br />

Dim myBlockTable As BlockTable =<br />

myDB.BlockTableId.GetObject(OpenMode.ForWrite)<br />

For Each myBTRid As ObjectId In myBlockTable<br />

Dim myDictionary As DBDictionary =<br />

myDB.LayoutDictionaryId.GetObject(OpenMode.ForRead)<br />

Dim EnergieDakStuklijst As String =<br />

LayoutManager.Current.CurrentLayout<br />

If myDictionary.Contains(EnergieDakStuklijst) Then<br />

Try<br />

Dim myLayoutID As ObjectId =<br />

myDictionary(EnergieDakStuklijst)<br />

Dim myLayout As Layout =<br />

myLayoutID.GetObject(OpenMode.ForRead)<br />

Dim myBTR As BlockTableRecord =<br />

myLayout.BlockTableRecordId.GetObject(OpenMode.ForWrite)<br />

LayoutManager.Current.CurrentLayout =<br />

"EnergieDakStuklijst"<br />

Exit For<br />

Catch ex As Exception<br />

End Try<br />

End If<br />

Next<br />

myTrans.Commit()<br />

DocumentManager.MdiActiveDocument.Editor.Regen()<br />

End Using<br />

End Using<br />

16/12/2010 ED<strong>CAD</strong>1.0 HBO-Traject 2010 56

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!