#include <ModelHighAPI_Double.h>
#include <ModelHighAPI_Dumper.h>
+#include <ModelHighAPI_Reference.h>
#include <ModelHighAPI_Tools.h>
//==================================================================================================
}
+//==================================================================================================
+void FeaturesAPI_Revolution::setNestedSketch(const ModelHighAPI_Reference& theSketch)
+{
+ mysketch->setValue(theSketch.feature());
+ mybaseObjects->clear();
+ mybaseObjects->append(theSketch.feature()->firstResult(), GeomShapePtr());
+
+ execIfBaseNotEmpty();
+}
+
//==================================================================================================
void FeaturesAPI_Revolution::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
{
+ mysketch->setValue(ObjectPtr());
+ mybaseObjects->clear();
fillAttribute(theBaseObjects, mybaseObjects);
- execute();
+ execIfBaseNotEmpty();
}
//==================================================================================================
{
fillAttribute(theAxis, myaxis);
- execute();
+ execIfBaseNotEmpty();
}
//==================================================================================================
fillAttribute(theToAngle, mytoAngle);
fillAttribute(theFromAngle, myfromAngle);
- execute();
+ execIfBaseNotEmpty();
}
//==================================================================================================
fillAttribute(theAngle, mytoAngle);
fillAttribute(ModelHighAPI_Double(), myfromAngle);
- execute();
+ execIfBaseNotEmpty();
}
//==================================================================================================
fillAttribute(theFromObject, myfromObject);
fillAttribute(theFromOffset, myfromOffset);
- execute();
+ execIfBaseNotEmpty();
}
//==================================================================================================
FeaturePtr aBase = feature();
const std::string& aDocName = theDumper.name(aBase->document());
- AttributeSelectionListPtr anObjects = aBase->selectionList(FeaturesPlugin_Revolution::BASE_OBJECTS_ID());
- AttributeSelectionPtr anAxis = aBase->selection(FeaturesPlugin_Revolution::AXIS_OBJECT_ID());
+ AttributeReferencePtr anAttrSketch = aBase->reference(FeaturesPlugin_Revolution::SKETCH_ID());
+ AttributeSelectionListPtr anAttrObjects = aBase->selectionList(FeaturesPlugin_Revolution::BASE_OBJECTS_ID());
+ AttributeSelectionPtr anAttrAxis = aBase->selection(FeaturesPlugin_Revolution::AXIS_OBJECT_ID());
- theDumper << aBase << " = model.addRevolution(" << aDocName << ", " << anObjects << ", " << anAxis;
+ theDumper << aBase << " = model.addRevolution(" << aDocName << ", ";
+ anAttrSketch->isInitialized() ? theDumper << "[]" : theDumper << anAttrObjects;
+ theDumper << ", " << anAttrAxis;
std::string aCreationMethod = aBase->string(FeaturesPlugin_Revolution::CREATION_METHOD())->value();
}
theDumper << ")" << std::endl;
+
+ if(anAttrSketch->isInitialized()) {
+ theDumper << aBase << ".setNestedSketch(" << anAttrSketch << ")" << std::endl;
+ }
+}
+
+//==================================================================================================
+void FeaturesAPI_Revolution::execIfBaseNotEmpty()
+{
+ if(mybaseObjects->size() > 0) {
+ execute();
+ }
}
//==================================================================================================
#include <ModelHighAPI_Macro.h>
class ModelHighAPI_Double;
+class ModelHighAPI_Reference;
class ModelHighAPI_Selection;
/// \class FeaturesAPI_Revolution
virtual ~FeaturesAPI_Revolution();
INTERFACE_10(FeaturesPlugin_Revolution::ID(),
+ sketch, FeaturesPlugin_Revolution::SKETCH_ID(), ModelAPI_AttributeReference, /** Sketch launcher */,
baseObjects, FeaturesPlugin_Revolution::BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Base objects */,
axis, FeaturesPlugin_Revolution::AXIS_OBJECT_ID(), ModelAPI_AttributeSelection, /** Axis */,
creationMethod, FeaturesPlugin_Revolution::CREATION_METHOD(), ModelAPI_AttributeString, /** Creation method */,
toObject, FeaturesPlugin_Revolution::TO_OBJECT_ID(), ModelAPI_AttributeSelection, /** To object */,
toOffset, FeaturesPlugin_Revolution::TO_OFFSET_ID(), ModelAPI_AttributeDouble, /** To offset */,
fromObject, FeaturesPlugin_Revolution::FROM_OBJECT_ID(), ModelAPI_AttributeSelection, /** From object */,
- fromOffset, FeaturesPlugin_Revolution::FROM_OFFSET_ID(), ModelAPI_AttributeDouble, /** From offset */,
- sketchLauncher, FeaturesPlugin_Revolution::SKETCH_ID(), ModelAPI_AttributeReference, /** Sketch launcher */)
+ fromOffset, FeaturesPlugin_Revolution::FROM_OFFSET_ID(), ModelAPI_AttributeDouble, /** From offset */)
+
+ /// Modify base attribute of the feature.
+ FEATURESAPI_EXPORT
+ void setNestedSketch(const ModelHighAPI_Reference& theSketch);
/// Modify base attribute of the feature.
FEATURESAPI_EXPORT
/// Dump wrapped feature
FEATURESAPI_EXPORT
virtual void dump(ModelHighAPI_Dumper& theDumper) const;
+
+private:
+ void execIfBaseNotEmpty();
};
/// Pointer on Revolution object.