I am trying to create a small program that reads if someone wrote the tolerance class manually as a suffix and then convert it to class tolerance. So far i have managed to change the class, but i cant get the tolerance field to show.
When i later try to see the tolerances i don't get anything. The thing is that with this code i set the class fit but not the hole/shaft fit. (see picture below)
So I get this:
Instead of this:
SE Spy also didnt help because when i select both diensions (the ok one and the bad one), they have the same properties (I did update SE Spy ). My question now is how can i define hole and shaft fits via code, like the second picture?
To answer my own question, I had to set tolerance visibility to true, or something in that direction. Here is the code that worked for me, I don't know for sure if this is the right way to do this, but it worked for me:
objDimension.DisplayType = 3 objDimension.PrimaryToleranceSymbol = objDimension.SuffixString objDimension.ShaftClassString = objDimension.SuffixString 'or .HoleClassString depending on what you want objDimension.UseStandardLimitAndFitTolerance = True objDimension.SuffixString = ""