} else if (aFormatName == "STL") {
exportSTL(theFileName);
return;
- }else if (aFormatName == "STEP") {
+ } else if (aFormatName == "STEP") {
exportSTEP(theFileName);
return;
}
std::list<GeomShapePtr> aShapeList;
std::string anError;
std::map<GeomShapePtr, std::vector<int>> aColoredShapes;
- for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex)
- {
+ for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) {
AttributeSelectionPtr anAttrSelection = aSelectionList->value(anIndex);
std::shared_ptr<GeomAPI_Shape> aCurShape = anAttrSelection->value();
if (!aCurShape.get())
aCurShape = anAttrSelection->context()->shape();
+
if (!aCurShape.get())
continue;
- //#ifndef HAVE_SALOME
+
+ //#ifndef HAVE_SALOME
ResultPtr aRes = anAttrSelection->context();
std::vector<int> aColor;
ModelAPI_Tools::getColor(aRes, aColor);
ModelAPI_Tools::getColoredShapes(aRes, aColoredShapes);
if (aColor.size() == 3)
- {
aColoredShapes[aCurShape] = aColor;
- }
- //#endif
+
+ //#endif
aShapeList.push_back(aCurShape);
- }
+ }
+
std::shared_ptr<GeomAPI_Shape> aShape =
aShapeList.size() == 1 ? aShapeList.front() : GeomAlgoAPI_CompoundBuilder::compound(aShapeList);
#ifndef HAVE_SALOME
bool aRes = STEPExport(theFileName, aShape, aColoredShapes, anError);
#endif
- if (!anError.empty() || !aRes)
- {
+ if (!anError.empty() || !aRes) {
setError("An error occurred while exporting " + theFileName + ": " + anError);
return;
- }
}
+}
bool ExchangePlugin_ExportFeature::isMacro() const
{
FeaturePtr aFeature = feature(theLabel);
if (aFeature.get())
return feature(theLabel);
+
TDF_Label aFeatureLabel = theLabel; // let's suppose it is result of this feature
- TDF_LabelList aSubLabs; // sub - labels from higher level to lower level of result
+ TDF_LabelList aSubLabs; // sub - labels from higher level to lower level of result // Maybe these are superlabels?
while(!aFeature.get() && aFeatureLabel.Depth() > 1) {
aSubLabs.Prepend(aFeatureLabel);
aFeatureLabel = aFeatureLabel.Father().Father();
ResultBodyPtr anOwner = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aCurrentResult);
if (!anOwner)
return ObjectPtr(); // only Body can have sub-results
+
int a, aNumSubs = anOwner->numberOfSubs();
for(a = 0; a < aNumSubs; a++) {
ResultPtr aSub = anOwner->subResult(a);
}
if (a == aNumSubs) // not found an appropriate sub-result of result
return ObjectPtr();
- } else { // iterate results of feature
+ }
+ else { // iterate results of feature
const std::list<ResultPtr>& aResults = aFeature->results();
std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.cbegin();
for(; aRIter != aResults.cend(); aRIter++) {
TDF_Label Model_Objects::resultLabel(
const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theResultIndex)
{
- const std::shared_ptr<Model_Data>& aData =
- std::dynamic_pointer_cast<Model_Data>(theFeatureData);
+ const std::shared_ptr<Model_Data>& aData = std::dynamic_pointer_cast<Model_Data>(theFeatureData);
return aData->label().Father().FindChild(TAG_FEATURE_RESULTS).FindChild(theResultIndex + 1);
}
*
* Box creates a cuboid - Parallelepiped with 6 rectangular faces. It can be built via three
* methods : using two points that define a diagonal, a point that define a center and 3 lengths
- * that define the half-lengths on X, Y and Z-axes, or using 3 lengths that define the
+ * that define the half-lengths on X, Y and Z-axes, or using 3 lengths that define the
* rectangular dimensions.
*/
class PrimitivesPlugin_Box : public ModelAPI_Feature
return MY_CREATION_METHOD_ID;
}
- /// Attribute name for creation method
+ /// Attribute name for creation method// Load the result
+ theResultBox->store(theBoxAlgo->shape());
+
+ // Prepare the naming
+ theBoxAlgo->prepareNamingFaces();
+
+ // Insert to faces
+ std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
+ theBoxAlgo->getCreatedFaces();
+ for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator it = listOfFaces.begin();
+ it != listOfFaces.end();
+ ++it)
+ {
+ theResultBox->generated((*it).second, (*it).first);
+ }s
inline static const std::string& CREATION_METHOD_BY_TWO_POINTS()
{
static const std::string MY_CREATION_METHOD_ID("BoxByTwoPoints");