AccessViolationException on Above, Below, Prefix, and Suffix for Dimension

AccessViolationException on Above, Below, Prefix, and Suffix for Dimension

Anonymous
Not applicable
648 Views
4 Replies
Message 1 of 5

AccessViolationException on Above, Below, Prefix, and Suffix for Dimension

Anonymous
Not applicable

In Revit 2013 I have tool that I'm making that copies dimensions from one drafting view to another. I've got it to properly create a new version of a dimension including the Curve, DimensionType, andReferences but I'm having trouble with the properties Above, Below, Prefix, and Suffix. They copy just fine if at least one of them has a value. However, if none of them have a value then it will throw an AccessViolationException when I try to access them. I have tried to catch that exception but it bubbles up and it crashes Revit (I'm assuming it's caused by native code that fails).

 

How can I check to see if these properties have any value when I do my copying without triggering this AccessViolationException?

0 Likes
649 Views
4 Replies
Replies (4)
Message 2 of 5

saikat
Autodesk
Autodesk

Hi

 

I would like to look into this behavior in depth and so can I request you to provide a minimal buildable VS project with the code which copies the dimension from one view to another and then can display the access violation exception, like you have mentioned. If required, please also include a minimal RVT file for testing purposes.


When you attach the minimal VS project and RVT, please ensure it does not contain any confidential information.

 

Thank you. 



Saikat Bhattacharya
Senior Manager - Technology Consulting
0 Likes
Message 3 of 5

Anonymous
Not applicable

Attached is a copy of a simple Revit command that just tries to access the Dimension.Prefix property.  If you run it on the Test.rvt file then it should produce an AccessViolationException.

0 Likes
Message 4 of 5

saikat
Autodesk
Autodesk

Thanks for the sample and the RVT. Using your files, I have been able to reproduce the exception with Revit 2013 and am discussing this with the Development team.

 

thanks



Saikat Bhattacharya
Senior Manager - Technology Consulting
0 Likes
Message 5 of 5

atiefenbach
Advocate
Advocate
Sorry for pulling up an old post, but:
It appears this was resolved with the Dimension Class, as I'm able to get;set those Properties. However, I'm having a similiar issue with the DimensionSegment Class. If I try to access those Properties, Revit crashes. Even when using a try block to catch the exception, it won't display the exception.
Anthony Tiefenbach
BIM Manager
HuntonBrady Architects
0 Likes