- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am using Revit Api 2019.2 and have encountered this strange problem.
I tried to duplicate a dimension type and assign a red color to it as follow:
// I tried to set red color to dimension type
System.Drawing.Color sysColor = System.Drawing.Color .FromArgb(255, 0,0);
int intValue = sysColor.ToArgb();
dimType = originalDimType.Duplicate(typeName) as DimensionType;
Parameter param = dimType.get_Parameter(BuiltInParameter.LINE_COLOR);
param.Set(intValue); // the value is 16711680, which is blue
And I get a new dimension type with blue color.
However if I hardcode the int value as 255, I get a red color
param.Set(255); // red color
I don't understand what happened here and why there is a difference between System.Drawing.Color and Autodesk.Revit.DB.Color converting RGB value to int value?
How does this conversion process happen? Is there an other way to set line color for dimension type using Color / RGB value directly? Thank you all very much.
Solved! Go to Solution.