Hello: Our company has a template that loads into cad for use with their drawings and I'd like to dynamically build this template so that it displays nicely in the viewport of a new layout I create. I create the new layout before generating a drawing that's created in model space; after which, I create a table and want it to display in the upperleft hand corner of my new layout; however, I don't know how to:
a) make it display it in my new layout?
b) make it display in the leftmost corner of my new layout.
here's my code for creating the table: I say to create in paperspace...but don't know how to tell it to go into my new layout:
Dim myTransMan As DatabaseServices.TransactionManager
Dim myTrans As DatabaseServices.Transaction
Dim myDWG As Autodesk.AutoCAD.ApplicationServices.Document
Dim myBT As DatabaseServices.BlockTable
Dim myBTR As DatabaseServices.BlockTableRecord
'Dim myBTE As DatabaseServices.SymbolTableEnumerator
'Get the active document and begin a Transaction
myDWG = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
myTransMan = myDWG.TransactionManager
myTrans = myTransMan.StartTransaction
'Open the BlockTable for Read
myBT = myDWG.Database.BlockTableId.GetObject( _
DatabaseServices.OpenMode.ForRead)
[color=red] myBTR = myBT(DatabaseServices.BlockTableRecord.PaperSpace).GetObject( _
DatabaseServices.OpenMode.ForWrite)[/color]
'Draw the Table
Dim myTable As New DatabaseServices.Table
' myTable.Position = New Geometry.Point3d(6.478, 100, 0)
' myTable.Position = New Geometry.Point3d(20, 50, 0)
myTable.InsertRows(1, 2, 3)
'myTable.InsertColumns(1, 12, 1)
'myTable.Height = 5
myTable.Width = 120
myTable.SetValue(0, 0, " 1) LAID OUT AT " & iModulesPerUnit & " PER " & UCase(sUnits) & ", " & inchesOnCenter & " ON CENTER", DatabaseServices.ParseOption.ParseOptionNone)
myTable.SetAlignment(0, 0, CellAlignment.MiddleLeft)
myTable.SetTextHeight(0, 0, 2)
myTable.SetGridVisibility(0, 0, GridLineType.AllGridLines, Visibility.Invisible)
'**************************
myTable.SetValue(1, 0, " 2) EACH MODULAR 60 POWER SUPPLY CAN RUN UP TO ## XX MODULES", DatabaseServices.ParseOption.ParseOptionNone)
myTable.SetAlignment(1, 0, DatabaseServices.CellAlignment.TopLeft)
myTable.SetAlignment(1, 0, CellAlignment.MiddleLeft)
myTable.SetTextHeight(1, 0, 2)
myTable.SetGridVisibility(1, 0, GridLineType.AllGridLines, Visibility.Invisible)
'**************************
myTable.SetValue(2, 0, " 3) LAYOUT BASED ON A " & UCase(sCanDepth) & " CAN DEPTH", DatabaseServices.ParseOption.ParseOptionNone)
myTable.SetAlignment(2, 0, DatabaseServices.CellAlignment.TopLeft)
myTable.SetAlignment(2, 0, CellAlignment.MiddleLeft)
myTable.SetTextHeight(2, 0, 2)
myTable.SetGridVisibility(2, 0, GridLineType.AllGridLines, Visibility.Invisible)
'**************************
myTable.SetValue(3, 0, " 4) THESE DIMENSIONS ARE CALCULATED IN " & UCase(sUnits), DatabaseServices.ParseOption.ParseOptionNone)
myTable.SetAlignment(3, 0, DatabaseServices.CellAlignment.TopLeft)
myTable.SetAlignment(3, 0, CellAlignment.MiddleLeft)
myTable.SetTextHeight(3, 0, 2)
myTable.SetGridVisibility(3, 0, GridLineType.AllGridLines, Visibility.Invisible)
myBTR.AppendEntity(myTable)
myTrans.AddNewlyCreatedDBObject(myTable, True)
'Commit the Transaction
myTrans.Commit()
myTrans.Dispose()
myTransMan.Dispose()
Any thoughts would truly be appreciated.
Thanks,
Proctor