<!-- Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
<source>
- <shape_selector id="extrusion_face"
- label="Select a face"
- icon=":icons/sketch.png"
+ <shape_selector id="extrusion_face"
+ label="Select a face"
+ icon=":icons/sketch.png"
tooltip="Select a face"
activate="true"
shape_types="face"
- object_types="construction"
- />
+ object_types="construction">
+ <validator id="PartSet_SketchValidator"/>
+ </shape_selector>
<doublevalue
id="extrusion_size"
label="Size"
aFactory->registerValidator("PartSet_RadiusValidator", new PartSet_RadiusValidator);
aFactory->registerValidator("PartSet_RigidValidator", new PartSet_RigidValidator);
aFactory->registerValidator("PartSet_DifferentObjects", new PartSet_DifferentObjectsValidator);
+ aFactory->registerValidator("PartSet_SketchValidator", new PartSet_SketchValidator);
}
void PartSet_Module::registerFilters()
#include <ModelAPI_AttributeSelection.h>
#include <ModelAPI_AttributeReference.h>
+#include <SketchPlugin_Sketch.h>
+
#include <list>
#ifdef _DEBUG
#include <iostream>
// not implemented
return true;
}
+
+bool PartSet_SketchValidator::isValid(const ObjectPtr theObject) const
+{
+ FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
+ return aFeature->getKind() == SketchPlugin_Sketch::ID();
+}
#include <ModuleBase_SelectionValidator.h>
#include <ModuleBase_ISelection.h>
#include <ModelAPI_RefAttrValidator.h>
+#include <ModelAPI_ResultValidator.h>
/*
* Selector validators
const std::list<std::string>& theArguments) const;
};
+/**
+* aValidator which validates tha selected object is a Sketch
+*/
+class PartSet_SketchValidator : public ModelAPI_ResultValidator
+{
+ public:
+ virtual bool isValid(const ObjectPtr theObject) const;
+};
+
#endif