.NET

Reply
Active Contributor
38 Posts
0 Kudos
Registered: ‎09-08-2006
Post 1 of 4

Layer creation error

45 Views, 3 Replies
12-14-2006 09:45 AM
Does anyone have a question why this would be erroring at this point;
"im lt As LayerTable = tm.GetObject(db.LayerTableId, OpenMode.ForWrite, True)"

Dim db As Database = HostApplicationServices.WorkingDatabase
Dim tm As DBTransMan = db.TransactionManager
'start a transaction
Dim myT As Transaction = tm.StartTransaction()
Dim ltr As LayerTableRecord = New LayerTableRecord
ltr.Name = namLay
Dim myColor As New Color()
myColor.ColorIndex() = colLay
ltr.Color() = myColor
If Linetype <> "Continuous" Then ltr.LinetypeObjectId = CheckForLineType(Linetype)
MsgBox("5")
Dim lt As LayerTable = tm.GetObject(db.LayerTableId, OpenMode.ForWrite, True)
lt.Add(ltr)
tm.AddNewlyCreatedDBObject(ltr, True)
ltr.Description = Descrip
myT.Commit()
tm.Dispose()
Active Contributor
38 Posts
0 Kudos
Registered: ‎09-08-2006
Post 2 of 4

Re: Layer creation error

12-14-2006 09:45 AM in reply to: Littlerubarbwk
Autocad 2005 only
Distinguished Contributor
1,691 Posts
3 Kudos
Registered: ‎12-15-2003
Post 3 of 4

Re: Layer creation error

12-14-2006 01:42 PM in reply to: Littlerubarbwk
You are using the transaction manager to get the table instead of the transaction.

Try changing
Dim lt As LayerTable = tm.GetObject(db.LayerTableId, OpenMode.ForWrite, True)
to
Dim lt As LayerTable = myT.GetObject(db.LayerTableId, OpenMode.ForWrite, True)

Regards - Nathan
Active Contributor
38 Posts
0 Kudos
Registered: ‎09-08-2006
Post 4 of 4

Re: Layer creation error

12-15-2006 07:39 AM in reply to: Littlerubarbwk
It tried your suggestions and still same error...I evn tried autodesk layer create example for 2005 and still get this error
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post