.NET

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

Layer creation error

41 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 (41 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 (41 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 (41 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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community