// Pass the results into the model
loadNamingDS(aGeomShape, aResult);
- if (aResult->shape().get())
- std::cout << "5 YES\n";
- else
- std::cout << "5 NO\n";
// create color group
if (anColorGroupSelected)
setResult(aResult);
aResult->clearShapeNameAndColor();
-
}
void ExchangePlugin_ImportFeature::setColorGroups(
Handle_XCAFDoc_ShapeTool shapeTool = XCAFDoc_DocumentTool::ShapeTool(mainLabel);
Handle_XCAFDoc_ColorTool colorTool = XCAFDoc_DocumentTool::ColorTool(mainLabel);
Handle(XCAFDoc_MaterialTool) materialTool = XCAFDoc_DocumentTool::MaterialTool(mainLabel);
- TDF_LabelSequence aLabels, aLabelSS;
- colorTool->GetColors(aLabels);
- Standard_Integer i, nbc = aLabels.Length();
- for (i = 1; i <= nbc; ++i)
- {
- Quantity_Color aColorQ;
- TDF_Label aLabel = aLabels.Value(i);
- colorTool->GetColor(aLabel, aColorQ);
- }
-
- shapeTool->GetShapes(aLabels);
- Quantity_Color aColorR;
- for (TDF_LabelSequence::Iterator aLabIt(aLabels); aLabIt.More(); aLabIt.Next())
- {
- const TDF_Label& aShapeLabel = aLabIt.Value();
- TopoDS_Shape aSubShape = shapeTool->GetShape(aShapeLabel);
- shapeTool->GetSubShapes(aShapeLabel, aLabelSS);
- colorTool->GetColor(aShapeLabel, XCAFDoc_ColorGen, aColorR);
- for (TDF_LabelSequence::Iterator aLabIt2(aLabelSS); aLabIt2.More(); aLabIt2.Next())
- {
- const TDF_Label& aSubShapeLab = aLabIt.Value();
- TopoDS_Shape aSubShape = shapeTool->GetShape(aSubShapeLab);
- colorTool->GetColor(aSubShapeLab, XCAFDoc_ColorSurf, aColorR);
- }
- }
// traverse the labels recursively to set attributes on shapes
setShapeAttributes(shapeTool, colorTool, materialTool, mainLabel,
return aGeomShape;
}
}
+
//=============================================================================
void setShapeAttributes(const Handle(XCAFDoc_ShapeTool) &theShapeTool,
const Handle(XCAFDoc_ColorTool) &theColorTool,
}
}
-void Model_ResultBody::addShapeColor( const std::wstring& theName,std::vector<int>& color) {
-
+void Model_ResultBody::addShapeColor( const std::wstring& theName,std::vector<int>& color)
+{
if (myColorsShape.find(theName) == myColorsShape.end())
myColorsShape[ theName ] = color;
}
break;
}
aSub = anObjects->createBody(this->data(), aSubIndex,thenameshape);
- //finf color read
+ //find color read
std::map< std::wstring, std::vector<int>>::iterator itColor =
myColorsShape.find(thenameshape);
if (itColor != myColorsShape.end()){
}
else if (!aThisShape.IsNull() && (aThisShape.ShapeType() == TopAbs_SOLID ||
aThisShape.ShapeType() == TopAbs_SHELL)) {
- //std::cout << ".....subshape is a SOLID or SHELL" << std::endl;
// Iterate on all faces
- //MBS:
ResultBodyPtr anOwner = std::dynamic_pointer_cast<ModelAPI_ResultBody>(data()->owner());
TopExp_Explorer aExp(aThisShape, TopAbs_FACE);
for (; aExp.More(); aExp.Next()) {
///
if (!aName.empty()) {
const std::vector<int>& aColor = findShapeColor(aName);
- std::vector<int> aColor2 = {};
if (!aColor.empty()) {
ModelAPI_Tools::setColor(anOwner, aGeomFace, aColor);
- ModelAPI_Tools::getColor(anOwner, aGeomFace, aColor2);
- //std::cout << std::endl << aColor[0] << " " << aColor[1] << " " << aColor[2] << std::endl;
- //if (!aColor2.empty())
- // std::cout << aColor2[0] << " " << aColor2[1] << " " << aColor2[2] << std::endl;
}
}
}