.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Operation is not valid due to the current state of the object.

1 REPLY 1
Reply
Message 1 of 2
scott.ferguson
1929 Views, 1 Reply

Operation is not valid due to the current state of the object.

Hi,

I am trying to Plot multiple layouts but when I loop through BlockTableRecord object the second time to print the next layout I get the "Operation is not valid due to the current state of the object." error.

I have attached the file, this came from Kean Walmsley "Through the Interface" http://through-the-interface.typepad.com/through_the_interface/2007/09/driving-a-multi.html

I believe this came out in Sep 2007, so I suspect the way we are supposed to access the block table records has changed in that time??

Can someone please look over the code? If you'll notice there are two sections that interate/loop over the block table records, one to gather all of the viewports and the second to plot them out one at a time.

The problem is with the second loop through the block table records. It will go through the loop once and on the second go I get the error.

I have comment the code in the attachment to say where the error is happening.

Any help would be great!
1 REPLY 1
Message 2 of 2

my guess is that you opened the same object for read twice in one transaction. The object was still flagged as open for read when you tried to open for read again. Try using downgrade open before you finish in your first loop instead of dispose (which dispose is not supposed to be called on acad entities, there is erase for making it go away, but if you wish to just clean up your variable for reuse then obj = nothing will do)

or you can commit one transaction and start another in the same routine.

jvj

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost