From a962c0bed5290fdd65e5d85f42c1125e64a26bbc Mon Sep 17 00:00:00 2001 From: vsr Date: Sat, 27 Dec 2014 11:24:34 +0300 Subject: [PATCH] Bug in 2D sketcher: a) Improper set of command parameters (notebook variables) in "rectangle" mode. b) Added support of notebook variables in the Python API class Sketcher2D. --- src/EntityGUI/EntityGUI_SketcherDlg.cxx | 2 +- src/GEOM_SWIG/gsketcher.py | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.cxx b/src/EntityGUI/EntityGUI_SketcherDlg.cxx index fde880b43..c4d6cd219 100644 --- a/src/EntityGUI/EntityGUI_SketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_SketcherDlg.cxx @@ -2258,7 +2258,7 @@ QString EntityGUI_SketcherDlg::GetNewCommand( QString& theParameters ) + ":TT " + QString::number( myX2, Format, DigNum) + " " + QString::number( myY1, Format, DigNum) + ":WW"; - theParameters = myX1Str + ":" + myY1Str + ":" + myX2Str + ":" + myY2Str ; + theParameters = myX1Str + ":" + myY1Str + ":" + myX1Str + ":" + myY2Str + ":" + myX2Str + ":" + myY2Str + ":" + myX2Str + ":" + myY1Str; } return myNewCommand; } diff --git a/src/GEOM_SWIG/gsketcher.py b/src/GEOM_SWIG/gsketcher.py index 004e8e63e..67fbaca57 100644 --- a/src/GEOM_SWIG/gsketcher.py +++ b/src/GEOM_SWIG/gsketcher.py @@ -1160,11 +1160,16 @@ class Sketcher2D: if self.closed: self.myCommand = self.myCommand + ":WW" + from salome.geom.geomBuilder import ParseSketcherCommand, RaiseIfFailed + Command,Parameters = ParseSketcherCommand(self.myCommand) + import GEOM - if isinstance(WorkingPlane, list): wire = self.geompyD.CurvesOp.MakeSketcher(self.myCommand, WorkingPlane) - if isinstance(WorkingPlane, GEOM._objref_GEOM_Object): wire = self.geompyD.CurvesOp.MakeSketcherOnPlane(self.myCommand, WorkingPlane) + if isinstance(WorkingPlane, list): wire = self.geompyD.CurvesOp.MakeSketcher(Command, WorkingPlane) + if isinstance(WorkingPlane, GEOM._objref_GEOM_Object): wire = self.geompyD.CurvesOp.MakeSketcherOnPlane(Command, WorkingPlane) self.myCommand = "Sketcher" + RaiseIfFailed("Sketcher", self.geompyD.CurvesOp) + wire.SetParameters(Parameters) self.geompyD._autoPublish(wire, theName, "wire") return wire @@ -1204,11 +1209,16 @@ class Sketcher2D: else: raise RuntimeError, "Sketcher2D.close() : can't build face on unclosed wire" + from salome.geom.geomBuilder import ParseSketcherCommand, RaiseIfFailed + Command,Parameters = ParseSketcherCommand(self.myCommand) + import GEOM - if isinstance(WorkingPlane, list): face = self.geompyD.CurvesOp.MakeSketcher(self.myCommand, WorkingPlane) - if isinstance(WorkingPlane, GEOM._objref_GEOM_Object): face = self.geompyD.CurvesOp.MakeSketcherOnPlane(self.myCommand, WorkingPlane) + if isinstance(WorkingPlane, list): face = self.geompyD.CurvesOp.MakeSketcher(Command, WorkingPlane) + if isinstance(WorkingPlane, GEOM._objref_GEOM_Object): face = self.geompyD.CurvesOp.MakeSketcherOnPlane(Command, WorkingPlane) self.myCommand = "Sketcher" + RaiseIfFailed("Sketcher", self.geompyD.CurvesOp) + face.SetParameters(Parameters) self.geompyD._autoPublish(face, theName, "face") return face -- 2.39.2