Passing Blockreference-object between methods
Hello all,
Quick question:
I've got a .Net solution that was designed on AutoCAD2009 wich makes extensive use of functions returning BlockReference-objects.
dummy example :
[code] Sub A()
End Function[/code]
Dim dummBlockRef As BlockReference = B()
'Continue code able to refer to dummBlockRef and its members/properties
End Sub
Function B() As BlockReference
Dim returnBlockRef As BlockReference
' Get the current document and database, and start a transaction
Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
Dim acCurDb As Database = acDoc.Database
' Lock the document
Using acLckDoc As DocumentLock = acDoc.LockDocument()
' Start a transaction in the new database
Using acTrans = acDoc.TransactionManager.StartOpenCloseTransaction()
'Find/get/set/modify returnBlockRef goes here
returnBlockRef =
End Using
End Using
Return returnBlockRef
This worked very well, altoughmight not be best-practice.
In BricsCAD however, I find that the returned BlockReference is no longer use-able once the transaction responsible for getting the Blockreference was closed.
How come AutoCAD left me with a usable BlockReference after the transaction was closed but BricsCAD does not ?
I have alot of code passing trough BlockReferences & entities this way. What is the best action i can take to adept my code to make it run on BricsCAD ?
Cheers,
Bert
0
Comments
-
Sorry for the code-layout did not show up as intended above !0
-
I've got the same problem. After adding objects by one method I need to use them in a second method.Can someone help?0
This discussion has been closed.