%{
#include "ModelHighAPI_swig.h"
+
+ // fix for SWIG v2.0.4
+ #define SWIGPY_SLICE_ARG(obj) ((PySliceObject*)(obj))
%}
%include "doxyhelp.i"
%include "ModelHighAPI_RefAttr.h"
%include "ModelHighAPI_Selection.h"
%include "ModelHighAPI_Tools.h"
+
+%template(SelectionList) std::list<ModelHighAPI_Selection>;
#include <Events_Error.h>
#include <ModelAPI_Feature.h>
+
+#include "ModelHighAPI_Selection.h"
//--------------------------------------------------------------------------------------
ModelHighAPI_Interface::ModelHighAPI_Interface(const std::shared_ptr<ModelAPI_Feature> & theFeature)
: myFeature(theFeature)
feature()->execute();
}
+std::list<ModelHighAPI_Selection> ModelHighAPI_Interface::result() const
+{
+ std::list<ModelHighAPI_Selection> aSelectionList;
+
+ std::list<std::shared_ptr<ModelAPI_Result> > aResults = feature()->results();
+ for (auto it = aResults.begin(), end = aResults.end(); it != end; ++it) {
+ aSelectionList.push_back(ModelHighAPI_Selection(*it));
+ }
+
+ return aSelectionList;
+}
+
void ModelHighAPI_Interface::throwException(const std::string & theDescription)
{
Events_Error::send(theDescription);
//--------------------------------------------------------------------------------------
#include "ModelHighAPI.h"
+#include <list>
#include <memory>
#include <string>
//--------------------------------------------------------------------------------------
class ModelAPI_Feature;
+class ModelHighAPI_Selection;
//--------------------------------------------------------------------------------------
/**\class ModelHighAPI_Interface
* \ingroup CPPHighAPI
MODELHIGHAPI_EXPORT
void execute();
+ /// Return all objects of the feature
+ MODELHIGHAPI_EXPORT
+ virtual std::list<ModelHighAPI_Selection> result() const;
+
/// Throw exception to event loop
MODELHIGHAPI_EXPORT
void throwException(const std::string & theDescription);
mybase.setCoincident(l3.endPoint(), l4.startPoint())
mybase.setCoincident(l4.endPoint(), l1.startPoint())
-mybase.setParallel(l1.result(), l3.result())
-mybase.setParallel(l2.result(), l4.result())
+mybase.setParallel(l1, l3)
+mybase.setParallel(l2, l4)
-mybase.setPerpendicular(l1.result(), l4.result())
+mybase.setPerpendicular(l1, l4)
-mywidth = mybase.setLength(l1.result(), 50)
-mylength = mybase.setDistance(l1.startPoint(), l3.result(), 50)
+mywidth = mybase.setLength(l1, 50)
+mylength = mybase.setDistance(l1.startPoint(), l3, 50)
+
+mybase.execute()
# Creating the extrusion
mystand = model.addSketch(mypart, thisface)
c1 = mystand.addCircle(0, 25, 5)
-mystand.setDistance(c1.center(), thisxmin, 10)
-mystand.setDistance(c1.center(), thiszmax, 10)
+mystand.setDistance(c1.center(), mystand.addLine(thisxmin), 10)
+mystand.setDistance(c1.center(), mystand.addLine(thiszmax), 10)
-myboss = model.addExtrusion(mypart, mystand.selectFace(c1.result()), -5)
+myboss = model.addExtrusion(mypart, mystand.selectFace(), -5)
# Subtracting the cylinder to the box
-model.addSubtraction(mypart, mybox.result(), myboss.result())
+model.addCut(mypart, mybox.result(), myboss.result())
model.end()
#include <SketchPlugin_ConstraintVertical.h>
//--------------------------------------------------------------------------------------
#include <ModelAPI_CompositeFeature.h>
+#include <ModelAPI_ResultConstruction.h>
#include <ModelHighAPI_RefAttr.h>
#include <ModelHighAPI_Selection.h>
#include <ModelHighAPI_Tools.h>
theConstraint->execute();
}
+//--------------------------------------------------------------------------------------
+std::list<ModelHighAPI_Selection> SketchAPI_Sketch::selectFace() const
+{
+ std::list<ModelHighAPI_Selection> aSelectionList;
+
+ ResultConstructionPtr aResultConstruction =
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(feature()->firstResult());
+ if (aResultConstruction.get() == NULL)
+ return aSelectionList;
+
+ for (int anIndex = 0; anIndex < aResultConstruction->facesNum(); ++anIndex) {
+ aSelectionList.push_back(
+ ModelHighAPI_Selection(aResultConstruction,
+ aResultConstruction->face(anIndex)));
+ }
+
+ return aSelectionList;
+}
+
//--------------------------------------------------------------------------------------
SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
const std::shared_ptr<GeomAPI_Ax3> & thePlane)
//--------------------------------------------------------------------------------------
#include "SketchAPI.h"
+#include <list>
+
#include <SketchPlugin_Sketch.h>
#include <SketchPlugin_SketchEntity.h>
// TODO(spo): setText. Is it necessary as setValue accepts text expressions?
+ // TODO(spo): rename to selectFaces() or faces() (or add faces() -> list to SWIG)
+ /// Select face
+ SKETCHAPI_EXPORT
+ std::list<ModelHighAPI_Selection> selectFace() const;
+
protected:
std::shared_ptr<ModelAPI_CompositeFeature> compositeFeature() const;