I am creating section view for each wall in a room using room boundary (viewer direction is perpendicular to room boundary segment). I was using BackSectionView (Revit 2011 SDK sample) as reference. Everything works fine, but problem is if in a model exists some additional Revit linked file. Then when I create section view, Outline property of created section view has this value
sectionView.Outline = '((Autodesk.Revit.DB.View)(view)).Outline' threw an exception of type 'System.AccessViolationException' Autodesk.Revit.DB.BoundingBoxUV {System.AccessViolationException}
When I try to add this section view to some view sheet I get the exception:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Can you give me some advice, what is causing this?
I've got the exact same fatal error occurring on a couple of our models (when adding an elevation to a sheet, outline property is corrupt and revit crashes). Did you find out what was causing this? It's a very frustrating problem that I haven't found a workaround for yet!
Hello Captain!
I managed to solve my problem by regenerating document after creation of all section views. After that I can place them on view sheets without any exception. I suggest you try the same, regenerate document before adding elements to sheet.
I still don't know what is the reason behind that sectionView.Outline exception.
Oh man, magic! That worked! Thankyou so much!
I had tried scattering document.Regenerate() around the place before but for whatever reason it never fixed this error. I must have missed placing it directly after section view generation.
I have to say, there isn't a great deal mentioned about when document.Regenerate() might be required. The little documentation there is about it is kinda fuzzy on the details.
For me this particular issue only started occurring recently on *some* of our models, so I must have been very lucky up until now heh.
Thanks RevitApprentice!