1) 遍历特征树
// get the feature type name
featureTypeName = swFeature.GetTypeName();
2)判断是否为草图类型
if ( 0 != featureTypeName.Compare(_T("OriginProfileFeature")) )
3)从草图获取sketchSegment
vSketchSegments = swSketch.GetSketchSegments();
4)获取草图的颜色
ISketchSegment::GetColor
一、设置面的颜色
要考虑颜色获取的优先级
1)得到系统级别的颜色设置
//Use the integer user-preference enumerations to get and set system-level or document-level settings and options. [url=http://mkMSITStore<img src=]SldWorks::GetUserPreferenceIntegerValue[/url] and [url=http://mkMSITStore<img src=]SldWorks::SetUserPreferenceIntegerValue[/url] get and set system-level settings and options; [url=http://mkMSITStore<img src=]ModelDoc2::GetUserPreferenceIntegerValue[/url] and [url=http://mkMSITStore<img src=]ModelDoc2::SetUserPreferenceIntegerValue[/url] get and set document-level settings and options. ((from SW_API help doc))
// system option: get the default shading color for the body
defaultRGBColor = swModelDoc.GetUserPreferenceIntegerValue (185 /*swDocumentColorShading*/);
2)得到模型的材质
//This property gets or sets a material's properties in the active configuration. The material values include the color (R,G,B values), reflectivity (ambient, diffuse, specular, shininess), transparency and emission. (from SW_API help doc)
// // get the default display properties of the model If one exists, it's
// color overrides the default shading color
m_vParameters = swModelDoc.GetMaterialPropertyValues();
3)得到feature的材质
4)得到face的材质