Using PlotDirect

Using PlotDirect

Anonymous
Not applicable
628 Views
1 Reply
Message 1 of 2

Using PlotDirect

Anonymous
Not applicable

I've come across an issue that I've been unable to resolve in using DirectPlot in ACAD 2016.  Let me state that the identical code runs as desired in 2014 & 2015.  I've searched for several days for something on this and have found nothing.  The error is in defining the layout it returns eNullObjectId.  Code below.  As stated this same code is error free in 2014 & 2015.  I have checked all returns and they are exactly as they should be.

 

Using acTrans As Transaction = AcDb.TransactionManager.StartTransaction()
            Try
                Dim acLayoutMgr As LayoutManager = LayoutManager.Current
                Dim acLayout As Layout = acTrans.GetObject(acLayoutMgr.GetLayoutId(acLayoutMgr.CurrentLayout), OpenMode.ForRead)

 

The stack is as such:

 

ERROR: eNullObjectId

at

Autodesk.AutoCAD.DatabaseServices.TransactionManager.GetObjectInternal(AcDbTransactionManager* pTM, ObjectId id, OpenMode mode, Boolean openErased, Boolean forceOpenOnLockedLayer)

at Autodesk.AutoCAD.DatabaseServices.Transaction.GetObject(ObjectId id, OpenMode mode)

at Forum_2016.SinglePlot.PlotDirect(String DeviceName, String LocMediaName, String CTBName, String plotrotation, String Copies)

 

 

Assistance is welcomed gratefully.

 

0 Likes
Accepted solutions (1)
629 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Accepted solution

Solved on my own though no idea why the previous works in versions prior to 2016 but not in 2016.

 

Using acTrans As Transaction = AcDb.TransactionManager.StartTransaction()
            Try
                Dim acLayout As Layout = Nothing
                Dim myDictionary As DBDictionary = TryCast(AcDb.LayoutDictionaryId.GetObject(OpenMode.ForRead), DBDictionary)
                Dim CurrentLayoutName As String = TryCast(LayoutManager.Current.CurrentLayout, String)
                If myDictionary.Contains(CurrentLayoutName) Then
                    Dim myLayoutID As ObjectId = myDictionary(CurrentLayoutName)

 

0 Likes