From cb939ec24d05de2dd83f7d2489feb807368464b5 Mon Sep 17 00:00:00 2001 From: dbv Date: Thu, 18 Aug 2016 16:26:48 +0300 Subject: [PATCH] Issue #1648: Dump Python in the High Level Parameterized Geometry API Tests fix --- src/Model/Model_Expression.cpp | 4 ++-- src/PythonAPI/examples/MakeBrick1.py | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/Model/Model_Expression.cpp b/src/Model/Model_Expression.cpp index 73484f328..7082bd60c 100644 --- a/src/Model/Model_Expression.cpp +++ b/src/Model/Model_Expression.cpp @@ -108,7 +108,7 @@ Model_ExpressionDouble::Model_ExpressionDouble(TDF_Label& theLabel) void Model_ExpressionDouble::setValue(const double theValue) { - if (!myIsInitialized) { + if (!myIsInitialized || myReal.IsNull()) { myReal = TDataStd_Real::Set(myText->Label(), theValue); myIsInitialized = true; } else if (value() != theValue) { @@ -149,7 +149,7 @@ Model_ExpressionInteger::Model_ExpressionInteger(TDF_Label& theLabel) void Model_ExpressionInteger::setValue(const int theValue) { - if (!myIsInitialized) { + if (!myIsInitialized || myInteger.IsNull()) { myInteger = TDataStd_Integer::Set(myText->Label(), theValue); myIsInitialized = true; } else if (value() != theValue) { diff --git a/src/PythonAPI/examples/MakeBrick1.py b/src/PythonAPI/examples/MakeBrick1.py index 74ce79686..2e0c10cab 100644 --- a/src/PythonAPI/examples/MakeBrick1.py +++ b/src/PythonAPI/examples/MakeBrick1.py @@ -35,26 +35,32 @@ mybase.setParallel(l2, l4) mybase.setPerpendicular(l1, l4) +mybase.setVertical(l1) +mybase.setFixed(l1.startPoint()) + mywidth = mybase.setLength(l1, 50) mylength = mybase.setDistance(l1.startPoint(), l3, 50) # Creating the extrusion mybox = model.addExtrusion(mypart, mybase.selectFace(), 50) +model.do() # Creating a cylinder on a face of the box thisface = "Extrusion_1_1/Generated_Face_2" -thisxmin = "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2" -thisxmax = "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1" -thiszmin = "Sketch_1/Edge5_1" +thisxmax = "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2" thiszmax = "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1_1" mystand = model.addSketch(mypart, thisface) c1 = mystand.addCircle(0, 25, 5) -mystand.setDistance(c1.center(), mystand.addLine(thisxmin), 10) -mystand.setDistance(c1.center(), mystand.addLine(thiszmax), 10) +l1 = mystand.addLine(thisxmax) +l2 = mystand.addLine(thiszmax) +model.do() +mystand.setDistance(c1.center(), l1, 10) +mystand.setDistance(c1.center(), l2, 10) +model.do() myboss = model.addExtrusion(mypart, mystand.selectFace(), -5) @@ -69,6 +75,7 @@ model.end() model.begin() mybase.setValue(mylength, 100) +model.do() mybox.setSize(80) model.end() -- 2.39.2