Hello All,
I can place dimension in MS, but the value is always metric, I'd like to know how to place imperial dimension. I have tried the following codes(I tried them by each row, not all the codes together)
UnitDefinition MyUnit= new UnitDefinition( UnitBase.None , UnitSystem.English ,35,45,"MyUnit"); dimStyle.SetUnitsProp(MyUnit, MyUnit, DimStyleProp.Value_Unit_UNITS); dimStyle.SetOneUnitProp(MyUnit, DimStyleProp.Value_UnitMaster_ONEUNIT); dimStyle.SetOneUnitProp(MyUnit, DimStyleProp.Value_UnitSub_ONEUNIT ); StatusInt mytest= dimStyle.SetUnitsProp(UnitDefinition.GetStandardUnit(Bentley.DgnPlatformNET.StandardUnit.EnglishFeet), UnitDefinition.GetStandardUnit(Bentley.DgnPlatformNET.StandardUnit.EnglishInches), DimStyleProp.Value_Unit_UNITS);
I checked the value of MyUnit, it is inch already, but it is the metric value placed still. Anyone can tell me how to place imperial dimension(the file unit is metric)? Thanks a lot.
Also how to set the accurracy for imperial dimension, for example, 0.001 and 1/16".
Hi Changsong,
it's not clear from your code snippet, what you do further with the dimension style. Is it written to DGN file, applied to a dimension somehow or anything different is done?
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Hello Jan,
Yes the dimension style will assign to a dimension element, and the dimension element will write to DGN file. The other part of the code are OK, so I didn't show them again. The only problem is the dimensional value is always be metric. I need imperial value. Thanks.
Changsong Ling said:Yes the dimension style will assign to a dimension element
I am not sure, because I did not change the style in this way (yet ;-.), whether it is enough to apply the style, when the changed state exists in memory only. My first thought is to write the style to DGN at first, so it is persistent, or to update the original style (maybe to use ReplaceSetings?), before it is applied to the dimension.
Just set General_DimensionScale_DOUBLE, the value will be imperial.
dimStyle.SetDoubleProp(1 / 25.4, DimStyleProp.General_DimensionScale_DOUBLE);
Answer Verified By: Changsong Ling