From: azv Date: Tue, 23 Aug 2016 13:01:13 +0000 (+0300) Subject: Adjust unit tests X-Git-Tag: V_2.5.0~137^2~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=15019ce764c94144586adab506dc5a5b348df722;p=modules%2Fshaper.git Adjust unit tests --- diff --git a/src/PythonAPI/examples/MakeBrick1.py b/src/PythonAPI/examples/MakeBrick1.py index 2e0c10cab..5ef2f3c45 100644 --- a/src/PythonAPI/examples/MakeBrick1.py +++ b/src/PythonAPI/examples/MakeBrick1.py @@ -20,10 +20,10 @@ mypart = model.addPart(mypartset).document() mybase = model.addSketch(mypart, model.defaultPlane("XOY")) -l1 = mybase.addLine(0, 0, 0, 1) -l2 = mybase.addLine(0, 1, 1, 1) -l3 = mybase.addLine(1, 1, 1, 0) -l4 = mybase.addLine(1, 0, 0, 0) +l1 = mybase.addLine(0, 0, 0, 25) +l2 = mybase.addLine(0, 25, 25, 25) +l3 = mybase.addLine(25, 25, 25, 0) +l4 = mybase.addLine(25, 0, 0, 0) mybase.setCoincident(l1.endPoint(), l2.startPoint()) mybase.setCoincident(l2.endPoint(), l3.startPoint()) @@ -40,6 +40,7 @@ mybase.setFixed(l1.startPoint()) mywidth = mybase.setLength(l1, 50) mylength = mybase.setDistance(l1.startPoint(), l3, 50) +model.do() # Creating the extrusion @@ -64,6 +65,7 @@ model.do() myboss = model.addExtrusion(mypart, mystand.selectFace(), -5) +model.do() # Subtracting the cylinder to the box diff --git a/src/PythonAPI/examples/MakeBrick2.py b/src/PythonAPI/examples/MakeBrick2.py index 9e74bf609..1be7e05fd 100644 --- a/src/PythonAPI/examples/MakeBrick2.py +++ b/src/PythonAPI/examples/MakeBrick2.py @@ -22,9 +22,9 @@ mypart = model.addPart(mypartset).document() mybase = model.addSketch(mypart, model.defaultPlane("XOY")) p1 = geom.Pnt2d(0, 0) -p2 = geom.Pnt2d(0, 1) -p3 = geom.Pnt2d(1, 1) -p4 = geom.Pnt2d(1, 0) +p2 = geom.Pnt2d(0, 25) +p3 = geom.Pnt2d(25, 25) +p4 = geom.Pnt2d(25, 0) line = model.addPolygon(mybase, p1, p2, p3, p4) @@ -37,7 +37,7 @@ mybase.setFixed(line[0].startPoint()) mywidth = mybase.setLength(line[0], 50) mylength = mybase.setDistance(line[0].startPoint(), line[2], 50) - +model.do() # Creating the extrusion @@ -58,7 +58,7 @@ mystand.setDistance(circle.center(), mystand.addLine(thiszmax), 10) model.do() myboss = model.addExtrusion(mypart, mystand.selectFace(), -5) - +model.do() # Subtracting the cylinder to the box diff --git a/src/PythonAddons/macros/box/feature.py b/src/PythonAddons/macros/box/feature.py index 7bfd90b76..01e39b9a5 100644 --- a/src/PythonAddons/macros/box/feature.py +++ b/src/PythonAddons/macros/box/feature.py @@ -67,16 +67,20 @@ class BoxFeature(model.Feature): line = model.addPolygon(self.base, p1, p2, p3, p4) - self.base.setParallel(line[0], line[2]) - self.base.setParallel(line[1], line[3]) - self.base.setPerpendicular(line[0], line[3]) - # Setting the size of the base with default values # Width self.width = self.base.setLength(line[0], 50) # Keeps the constraint for edition # Length self.length = self.base.setLength(line[3], 50) # Keeps the constraint for edition + # Keeping the rectangle + self.base.setParallel(line[0], line[2]) + self.base.setParallel(line[1], line[3]) + self.base.setPerpendicular(line[0], line[3]) + + # execute sketch + model.do() + # Creating the extrusion (the box) at default size # A box result self.box = model.addExtrusion(mypart, self.base.selectFace(), 50)