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.
This commit is contained in:
vsr 2014-12-27 11:24:34 +03:00
parent 3d1e657101
commit a962c0bed5
2 changed files with 15 additions and 5 deletions

View File

@ -2258,7 +2258,7 @@ QString EntityGUI_SketcherDlg::GetNewCommand( QString& theParameters )
+ ":TT " + QString::number( myX2, Format, DigNum) + " " + QString::number( myY1, Format, DigNum) + ":TT " + QString::number( myX2, Format, DigNum) + " " + QString::number( myY1, Format, DigNum)
+ ":WW"; + ":WW";
theParameters = myX1Str + ":" + myY1Str + ":" + myX2Str + ":" + myY2Str ; theParameters = myX1Str + ":" + myY1Str + ":" + myX1Str + ":" + myY2Str + ":" + myX2Str + ":" + myY2Str + ":" + myX2Str + ":" + myY1Str;
} }
return myNewCommand; return myNewCommand;
} }

View File

@ -1160,11 +1160,16 @@ class Sketcher2D:
if self.closed: if self.closed:
self.myCommand = self.myCommand + ":WW" self.myCommand = self.myCommand + ":WW"
from salome.geom.geomBuilder import ParseSketcherCommand, RaiseIfFailed
Command,Parameters = ParseSketcherCommand(self.myCommand)
import GEOM import GEOM
if isinstance(WorkingPlane, list): wire = self.geompyD.CurvesOp.MakeSketcher(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(self.myCommand, WorkingPlane) if isinstance(WorkingPlane, GEOM._objref_GEOM_Object): wire = self.geompyD.CurvesOp.MakeSketcherOnPlane(Command, WorkingPlane)
self.myCommand = "Sketcher" self.myCommand = "Sketcher"
RaiseIfFailed("Sketcher", self.geompyD.CurvesOp)
wire.SetParameters(Parameters)
self.geompyD._autoPublish(wire, theName, "wire") self.geompyD._autoPublish(wire, theName, "wire")
return wire return wire
@ -1204,11 +1209,16 @@ class Sketcher2D:
else: else:
raise RuntimeError, "Sketcher2D.close() : can't build face on unclosed wire" 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 import GEOM
if isinstance(WorkingPlane, list): face = self.geompyD.CurvesOp.MakeSketcher(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(self.myCommand, WorkingPlane) if isinstance(WorkingPlane, GEOM._objref_GEOM_Object): face = self.geompyD.CurvesOp.MakeSketcherOnPlane(Command, WorkingPlane)
self.myCommand = "Sketcher" self.myCommand = "Sketcher"
RaiseIfFailed("Sketcher", self.geompyD.CurvesOp)
face.SetParameters(Parameters)
self.geompyD._autoPublish(face, theName, "face") self.geompyD._autoPublish(face, theName, "face")
return face return face