void Model_AttributeBoolean::setValue(bool theValue)
{
- Standard_Boolean aValue = theValue ? Standard_True : Standard_False;
+ Standard_Integer aValue = theValue ? 1 : 0;
if (!myIsInitialized || myBool->Get() != aValue) {
if (myBool.IsNull())
myBool = TDataStd_Integer::Set(myLab, 0);
bool Model_AttributeBoolean::value()
{
- return myIsInitialized && myBool->Get() == Standard_True ;
+ return myIsInitialized && myBool->Get() == 1;
}
Model_AttributeBoolean::Model_AttributeBoolean(TDF_Label& theLabel)
//--------------------------------------------------------------------------------------
#include <ModelHighAPI_Dumper.h>
#include <ModelHighAPI_Tools.h>
+#include <ModelAPI_ResultParameter.h>
//--------------------------------------------------------------------------------------
ParametersAPI_Parameter::ParametersAPI_Parameter(
const std::shared_ptr<ModelAPI_Feature> & theFeature)
}
}
+void ParametersAPI_Parameter::setValue(const double theValue)
+{
+ // convert value to the expression string
+ std::ostringstream aValueStr;
+ aValueStr<<theValue;
+ fillAttribute(aValueStr.str(), expression());
+ execute();
+}
+
+double ParametersAPI_Parameter::value() {
+ ResultParameterPtr aRes =
+ std::dynamic_pointer_cast<ModelAPI_ResultParameter>(feature()->firstResult());
+ // it may raise an exception if result is invalid
+ return aRes->data()->real(ModelAPI_ResultParameter::VALUE())->value();
+}
+
ParametersAPI_Parameter::~ParametersAPI_Parameter()
{
}
class SketcherAddArc(SketcherTestCase):
def test_arc_by_coords(self):
- arc = self.sketch.addArc(0, 1, 0, 0, 1, 1, 0)
+ arc = self.sketch.addArc(0, 1, 0, 0, 1, 1, False)
model.do()
self.assertEqual(arc.startPoint().x(), 0)
self.assertEqual(arc.startPoint().y(), 0)
center = geom.Pnt2d(0, 1)
start = geom.Pnt2d(0, 0)
end = geom.Pnt2d(1, 1)
- arc = self.sketch.addArc(center, start, end, 0)
+ arc = self.sketch.addArc(center, start, end, False)
model.do()
self.assertEqual(arc.startPoint().x(), 0)
self.assertEqual(arc.startPoint().y(), 0)
def test_modify_arc(self):
# Note: arc will modify startPoint and endPoint to be in circle
- arc = self.sketch.addArc(0, 1, 0, 0, 1, 1, 0)
- arc.setByCenterStartEnd(0, 0, 1, 1, -1, -1, 0)
+ arc = self.sketch.addArc(0, 1, 0, 0, 1, 1, False)
+ arc.setByCenterStartEnd(0, 0, 1, 1, -1, -1, False)
model.do()
self.assertEqual(arc.center().x(), 0)
self.assertEqual(arc.center().y(), 0)