.NET

Reply
Active Contributor
Littlerubarbwk
Posts: 38
Registered: ‎09-08-2006
Message 1 of 4 (44 Views)

Layer creation error

44 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
Littlerubarbwk
Posts: 38
Registered: ‎09-08-2006
Message 2 of 4 (44 Views)

Re: Layer creation error

12-14-2006 09:45 AM in reply to: Littlerubarbwk
Autocad 2005 only
Distinguished Contributor
NathTay
Posts: 1,691
Registered: ‎12-15-2003
Message 3 of 4 (44 Views)

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
Littlerubarbwk
Posts: 38
Registered: ‎09-08-2006
Message 4 of 4 (44 Views)

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
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!