#define EDGE 6
#define DEBUG_COMPSOLID
+//#define DEBUG_COMPSOLID_SHAPE
//=================================================================================================
FeaturesPlugin_Extrusion::FeaturesPlugin_Extrusion()
ResultCompSolidPtr aCompSolidResult = document()->createCompSolid(data(), aResultIndex);
setResult(aCompSolidResult, aResultIndex);
aResultIndex++;
+#endif
+#ifdef DEBUG_COMPSOLID_SHAPE
+ bool aFirstShapeInCompsolid = aFaceRefs->size() > 0;
+ if (aFirstShapeInCompsolid)
+ aResultIndex--;
#endif
for(; anIndex < aFaceRefs->size(); anIndex++) {
std::shared_ptr<ModelAPI_AttributeSelection> aFaceRef = aFaceRefs->value(anIndex);
}
}
for(int aFaceIndex = 0; aFaceIndex < aFacesNum || aFacesNum == -1; aFaceIndex++) {
+ ResultBodyPtr aResultBody;
+
+#ifdef DEBUG_COMPSOLID_SHAPE
+ if (aFirstShapeInCompsolid && anIndex == 0)
+ aResultBody = aCompSolidResult;
+ else {
+#endif
+
#ifdef DEBUG_COMPSOLID
- ResultBodyPtr aResultBody = aCompSolidResult->addResult(aResultIndex);
+ aResultBody = aCompSolidResult->addResult(aResultIndex);
#else
- ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
+ aResultBody = document()->createBody(data(), aResultIndex);
+#endif
+
+#ifdef DEBUG_COMPSOLID_SHAPE
+ }
#endif
std::shared_ptr<GeomAPI_Shape> aBaseShape;
if (aFacesNum == -1) {
int Model_ResultCompSolid::numberOfSubs(bool forTree) const
{
- return 0;
+ if (forTree)
+ return 0;
+ return data()->reflist(Model_ResultCompSolid::BODIES_ID())->size();
}
std::shared_ptr<ModelAPI_ResultBody> Model_ResultCompSolid::subResult(const int theIndex,
#include <ModelAPI_ResultParameter.h>
#include <ModelAPI_Session.h>
#include <ModelAPI_Validator.h>
+#include <ModelAPI_ResultCompSolid.h>
//#include <PartSetPlugin_Part.h>
std::vector<int> aColor;
foreach(ObjectPtr anObject, theObjects) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
- if (aResult.get())
+ if (aResult.get()) {
XGUI_CustomPrs::getResultColor(aResult, aColor);
+ }
else {
// TODO: remove the obtaining a color from the AIS object
// this does not happen never because:
}
// 4. set the value to all results
+ std::vector<int> aColorResult = aDlg->getColor();
foreach(ObjectPtr anObj, theObjects) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
if (aResult.get() != NULL) {
- std::vector<int> aColorResult = aDlg->getColor();
+ ResultCompSolidPtr aCompsolidResult = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aResult);
+ if (aCompsolidResult.get() != NULL) { // change colors for all sub-solids
+ for(int i = 0; i < aCompsolidResult->numberOfSubs(); i++) {
+ ResultPtr aSubResult = aCompsolidResult->subResult(i);
+ if (aSubResult.get())
+ setColor(aSubResult, aColorResult);
+ }
+ }
setColor(aResult, aColorResult);
}
}