.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create Layout

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
452 Views, 2 Replies

Create Layout

Hi,
can anyone please tell me how to create a new layout with 'Autodesk.AutoCAD.DatabaseServices.LayoutManager.Current.CreateLayout'?
Regards, Jan
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

Hi,
seems to be a diffucult question, as I do not get an answer.
The only way creating a new layout was the following:

Dim acadApp As Autodesk.AutoCAD.Interop.AcadApplication = Application.AcadApplication
Dim lay As Autodesk.AutoCAD.Interop.Common.AcadLayout = acadApp.ActiveDocument.Layouts.Add("LayoutXY")

Is there a better way?
Regards, Jan
Message 3 of 3
Anonymous
in reply to: Anonymous

See how it will works for you

Public Shared Sub CreateNewLayout()
Dim doc As Document = Application.DocumentManager.MdiActiveDocument
Dim ed As Editor = doc.Editor
Dim doclock As DocumentLock = doc.LockDocument()
Dim db As Database = doc.Database
Dim trm As Autodesk.AutoCAD.DatabaseServices.TransactionManager = db.TransactionManager
Using tr As Transaction = trm.StartTransaction()
Try
Dim btr As BlockTableRecord = CType(tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite), BlockTableRecord)
Dim lman As Autodesk.AutoCAD.DatabaseServices.LayoutManager = Autodesk.AutoCAD.DatabaseServices.LayoutManager.Current
lman.CopyLayout("Layout1", "NewLayout1") '<-- change layout names to suit
Dim ltid = lman.GetLayoutId("NewLayout1")
Dim lt As Layout = CType(tr.GetObject(ltid, OpenMode.ForWrite), Layout)
With lt
.UpgradeOpen()
'// add some properties here
.TabOrder = 1
End With
ed.Regen()
tr.Commit()
Catch ex As Autodesk.AutoCAD.Runtime.Exception
MessageBox.Show(ex.StackTrace)
End Try
End Using
doclock.Dispose()
End Sub

~'J'~

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost