#include "ModelAPI_Validator.h"
#include "ModelAPI_AttributeRefList.h"
#include "ModelAPI_Result.h"
+ #include "ModelAPI_ResultConstruction.h"
+
+ template<class T> boost::shared_ptr<T> castTo(boost::shared_ptr<ModelAPI_Result> theObject)
+ {
+ return boost::dynamic_pointer_cast<T>(theObject);
+ }
+
+
%}
// to avoid error on this
#define MODELAPI_EXPORT
+#define GEOMAPI_EXPORT
// standard definitions
%include "typemaps.i"
%shared_ptr(ModelAPI_AttributeRefAttr)
%shared_ptr(ModelAPI_AttributeRefList)
%shared_ptr(ModelAPI_Result)
+%shared_ptr(ModelAPI_ResultConstruction)
// all supported interfaces
%include "ModelAPI_Document.h"
%include "ModelAPI_Validator.h"
%include "ModelAPI_AttributeRefList.h"
%include "ModelAPI_Result.h"
+%include "ModelAPI_ResultConstruction.h"
%template(ObjectList) std::list<boost::shared_ptr<ModelAPI_Object> >;
+%template(ResultList) std::list<boost::shared_ptr<ModelAPI_Result> >;
+
+template<class T> boost::shared_ptr<T> castTo(boost::shared_ptr<ModelAPI_Result> theObject);
+%template(modelAPI_ResultConstruction) castTo<ModelAPI_ResultConstruction>;
from GeomDataAPI import *
from ModelAPI import *
-__updated__ = "2014-07-23"
+__updated__ = "2014-07-24"
aPluginManager = ModelAPI_PluginManager.get()
aDocument = aPluginManager.rootDocument()
-aDocument.startOperation()
#===============================================================================
# Test ModelAPI static methods
# TODO: Move this test in the ModelAPI progect
#=========================================================================
# Creation of a sketch
#=========================================================================
+aDocument.startOperation()
aSketchFeature = aDocument.addFeature("Sketch")
assert (aSketchFeature.getKind() == "Sketch")
aSketchFeatureData = aSketchFeature.data()
assert (norm.x() == 0)
assert (norm.y() == 0)
assert (norm.z() == 1)
+aDocument.finishOperation()
#=========================================================================
# Creation of a point
#=========================================================================
+aDocument.startOperation()
aSketchReflist = aSketchFeatureData.reflist("Features")
assert (not aSketchReflist.isInitialized())
assert(aSketchReflist.size() == 0)
coords = geomDataAPI_Point2D(aSketchPointData.attribute("PointCoordindates"))
assert (coords.x() == 10.0)
assert (coords.y() == 10.0)
+aDocument.finishOperation()
#===============================================================================
# Creation of a line
#===============================================================================
+aDocument.startOperation()
aSketchLine = aDocument.addFeature("SketchLine")
aSketchReflist.append(aSketchLine)
assert (aSketchReflist.size() == 2)
assert (aLineStartPoint.y() == 50.0)
assert (aLineEndPoint.x() == 60.0)
assert (aLineEndPoint.y() == 60.0)
-aSketchLine.firstResult()
+aDocument.finishOperation()
+#===============================================================================
+# Check results
+#===============================================================================
+aResult = aSketchLine.firstResult()
+assert (aResult is not None)
+aResultConstruction = modelAPI_ResultConstruction(aResult)
+aShape = aResult.shape()
+assert (aShape is not None)
+assert (not aShape.isNull())
#==============================================================================
# Finish the test
#==============================================================================
-aDocument.finishOperation()
-