+ fixes #0002117: problems with rendering an arc - NAN
This commit is contained in:
parent
2a569497b9
commit
7dc59751cc
|
@ -240,13 +240,19 @@ public:
|
|||
unsetCursor();
|
||||
resetPositionText();
|
||||
|
||||
Gui::Command::openCommand("Add sketch line");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addGeometry(Part.Line(App.Vector(%f,%f,0),App.Vector(%f,%f,0)),%s)",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
EditCurve[0].fX,EditCurve[0].fY,EditCurve[1].fX,EditCurve[1].fY,
|
||||
geometryCreationMode==Construction?"True":"False");
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch line");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addGeometry(Part.Line(App.Vector(%f,%f,0),App.Vector(%f,%f,0)),%s)",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
EditCurve[0].fX,EditCurve[0].fY,EditCurve[1].fX,EditCurve[1].fY,
|
||||
geometryCreationMode==Construction?"True":"False");
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
Gui::Command::commitCommand();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("Failed to add line: %s\n", e.what());
|
||||
Gui::Command::abortCommand();
|
||||
}
|
||||
|
||||
// add auto constraints for the line segment start
|
||||
if (sugConstr1.size() > 0) {
|
||||
|
@ -444,43 +450,50 @@ public:
|
|||
if (Mode==STATUS_End){
|
||||
unsetCursor();
|
||||
resetPositionText();
|
||||
Gui::Command::openCommand("Add sketch box");
|
||||
int firstCurve = getHighestCurveIndex() + 1;
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"geoList = []\n"
|
||||
"geoList.append(Part.Line(App.Vector(%f,%f,0),App.Vector(%f,%f,0)))\n"
|
||||
"geoList.append(Part.Line(App.Vector(%f,%f,0),App.Vector(%f,%f,0)))\n"
|
||||
"geoList.append(Part.Line(App.Vector(%f,%f,0),App.Vector(%f,%f,0)))\n"
|
||||
"geoList.append(Part.Line(App.Vector(%f,%f,0),App.Vector(%f,%f,0)))\n"
|
||||
"App.ActiveDocument.%s.addGeometry(geoList,%s)\n"
|
||||
"conList = []\n"
|
||||
"conList.append(Sketcher.Constraint('Coincident',%i,2,%i,1))\n"
|
||||
"conList.append(Sketcher.Constraint('Coincident',%i,2,%i,1))\n"
|
||||
"conList.append(Sketcher.Constraint('Coincident',%i,2,%i,1))\n"
|
||||
"conList.append(Sketcher.Constraint('Coincident',%i,2,%i,1))\n"
|
||||
"conList.append(Sketcher.Constraint('Horizontal',%i))\n"
|
||||
"conList.append(Sketcher.Constraint('Horizontal',%i))\n"
|
||||
"conList.append(Sketcher.Constraint('Vertical',%i))\n"
|
||||
"conList.append(Sketcher.Constraint('Vertical',%i))\n"
|
||||
"App.ActiveDocument.%s.addConstraint(conList)\n",
|
||||
EditCurve[0].fX,EditCurve[0].fY,EditCurve[1].fX,EditCurve[1].fY, // line 1
|
||||
EditCurve[1].fX,EditCurve[1].fY,EditCurve[2].fX,EditCurve[2].fY, // line 2
|
||||
EditCurve[2].fX,EditCurve[2].fY,EditCurve[3].fX,EditCurve[3].fY, // line 3
|
||||
EditCurve[3].fX,EditCurve[3].fY,EditCurve[0].fX,EditCurve[0].fY, // line 4
|
||||
sketchgui->getObject()->getNameInDocument(), // the sketch
|
||||
geometryCreationMode==Construction?"True":"False", // geometry as construction or not
|
||||
firstCurve,firstCurve+1, // coincident1
|
||||
firstCurve+1,firstCurve+2, // coincident2
|
||||
firstCurve+2,firstCurve+3, // coincident3
|
||||
firstCurve+3,firstCurve, // coincident4
|
||||
firstCurve, // horizontal1
|
||||
firstCurve+2, // horizontal2
|
||||
firstCurve+1, // vertical1
|
||||
firstCurve+3, // vertical2
|
||||
sketchgui->getObject()->getNameInDocument()); // the sketch
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch box");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"geoList = []\n"
|
||||
"geoList.append(Part.Line(App.Vector(%f,%f,0),App.Vector(%f,%f,0)))\n"
|
||||
"geoList.append(Part.Line(App.Vector(%f,%f,0),App.Vector(%f,%f,0)))\n"
|
||||
"geoList.append(Part.Line(App.Vector(%f,%f,0),App.Vector(%f,%f,0)))\n"
|
||||
"geoList.append(Part.Line(App.Vector(%f,%f,0),App.Vector(%f,%f,0)))\n"
|
||||
"App.ActiveDocument.%s.addGeometry(geoList,%s)\n"
|
||||
"conList = []\n"
|
||||
"conList.append(Sketcher.Constraint('Coincident',%i,2,%i,1))\n"
|
||||
"conList.append(Sketcher.Constraint('Coincident',%i,2,%i,1))\n"
|
||||
"conList.append(Sketcher.Constraint('Coincident',%i,2,%i,1))\n"
|
||||
"conList.append(Sketcher.Constraint('Coincident',%i,2,%i,1))\n"
|
||||
"conList.append(Sketcher.Constraint('Horizontal',%i))\n"
|
||||
"conList.append(Sketcher.Constraint('Horizontal',%i))\n"
|
||||
"conList.append(Sketcher.Constraint('Vertical',%i))\n"
|
||||
"conList.append(Sketcher.Constraint('Vertical',%i))\n"
|
||||
"App.ActiveDocument.%s.addConstraint(conList)\n",
|
||||
EditCurve[0].fX,EditCurve[0].fY,EditCurve[1].fX,EditCurve[1].fY, // line 1
|
||||
EditCurve[1].fX,EditCurve[1].fY,EditCurve[2].fX,EditCurve[2].fY, // line 2
|
||||
EditCurve[2].fX,EditCurve[2].fY,EditCurve[3].fX,EditCurve[3].fY, // line 3
|
||||
EditCurve[3].fX,EditCurve[3].fY,EditCurve[0].fX,EditCurve[0].fY, // line 4
|
||||
sketchgui->getObject()->getNameInDocument(), // the sketch
|
||||
geometryCreationMode==Construction?"True":"False", // geometry as construction or not
|
||||
firstCurve,firstCurve+1, // coincident1
|
||||
firstCurve+1,firstCurve+2, // coincident2
|
||||
firstCurve+2,firstCurve+3, // coincident3
|
||||
firstCurve+3,firstCurve, // coincident4
|
||||
firstCurve, // horizontal1
|
||||
firstCurve+2, // horizontal2
|
||||
firstCurve+1, // vertical1
|
||||
firstCurve+3, // vertical2
|
||||
sketchgui->getObject()->getNameInDocument()); // the sketch
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("Failed to add box: %s\n", e.what());
|
||||
Gui::Command::abortCommand();
|
||||
}
|
||||
|
||||
// add auto constraints at the start of the first side
|
||||
if (sugConstr1.size() > 0) {
|
||||
createAutoConstraints(sugConstr1, getHighestCurveIndex() - 3 , Sketcher::start);
|
||||
|
@ -928,12 +941,12 @@ public:
|
|||
virtual bool releaseButton(Base::Vector2D onSketchPos)
|
||||
{
|
||||
if (Mode == STATUS_Do || Mode == STATUS_Close) {
|
||||
bool addedGeometry = true;
|
||||
bool addedGeometry = true;
|
||||
if (SegmentMode == SEGMENT_MODE_Line) {
|
||||
// open the transaction
|
||||
Gui::Command::openCommand("Add line to sketch wire");
|
||||
// issue the geometry
|
||||
try {
|
||||
// open the transaction
|
||||
Gui::Command::openCommand("Add line to sketch wire");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.addGeometry(Part.Line(App.Vector(%f,%f,0),App.Vector(%f,%f,0)),%s)",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
|
@ -951,8 +964,9 @@ public:
|
|||
Mode = STATUS_SEEK_Second;
|
||||
return true;
|
||||
}
|
||||
Gui::Command::openCommand("Add arc to sketch wire");
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add arc to sketch wire");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.addGeometry(Part.ArcOfCircle"
|
||||
"(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),%f,%f),%s)",
|
||||
|
@ -967,6 +981,7 @@ public:
|
|||
Gui::Command::abortCommand();
|
||||
}
|
||||
}
|
||||
|
||||
int lastCurve = getHighestCurveIndex();
|
||||
// issue the constraint
|
||||
if (addedGeometry && (previousPosId != Sketcher::none)) {
|
||||
|
@ -1018,14 +1033,14 @@ public:
|
|||
}
|
||||
|
||||
unsetCursor();
|
||||
|
||||
|
||||
resetPositionText();
|
||||
EditCurve.clear();
|
||||
sketchgui->drawEdit(EditCurve);
|
||||
|
||||
sketchgui->drawEdit(EditCurve);
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
|
||||
bool continuousMode = hGrp->GetBool("ContinuousCreationMode",true);
|
||||
|
||||
|
||||
if(continuousMode){
|
||||
// This code enables the continuous creation mode.
|
||||
Mode=STATUS_SEEK_First;
|
||||
|
@ -1350,19 +1365,25 @@ public:
|
|||
if (Mode==STATUS_End) {
|
||||
unsetCursor();
|
||||
resetPositionText();
|
||||
|
||||
Gui::Command::openCommand("Add sketch arc");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.addGeometry(Part.ArcOfCircle"
|
||||
"(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),"
|
||||
"%f,%f),%s)",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
CenterPoint.fX, CenterPoint.fY, sqrt(rx*rx + ry*ry),
|
||||
startAngle, endAngle,
|
||||
geometryCreationMode==Construction?"True":"False"); //arcAngle > 0 ? 0 : 1);
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch arc");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.addGeometry(Part.ArcOfCircle"
|
||||
"(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),"
|
||||
"%f,%f),%s)",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
CenterPoint.fX, CenterPoint.fY, sqrt(rx*rx + ry*ry),
|
||||
startAngle, endAngle,
|
||||
geometryCreationMode==Construction?"True":"False"); //arcAngle > 0 ? 0 : 1);
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("Failed to add arc: %s\n", e.what());
|
||||
Gui::Command::abortCommand();
|
||||
}
|
||||
|
||||
// Auto Constraint center point
|
||||
if (sugConstr1.size() > 0) {
|
||||
createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::mid);
|
||||
|
@ -1406,7 +1427,7 @@ public:
|
|||
}
|
||||
else{
|
||||
sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1648,18 +1669,24 @@ public:
|
|||
unsetCursor();
|
||||
resetPositionText();
|
||||
|
||||
Gui::Command::openCommand("Add sketch arc");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.addGeometry(Part.ArcOfCircle"
|
||||
"(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),"
|
||||
"%f,%f),%s)",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
CenterPoint.fX, CenterPoint.fY, radius,
|
||||
startAngle, endAngle,
|
||||
geometryCreationMode==Construction?"True":"False");
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch arc");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.addGeometry(Part.ArcOfCircle"
|
||||
"(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),"
|
||||
"%f,%f),%s)",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
CenterPoint.fX, CenterPoint.fY, radius,
|
||||
startAngle, endAngle,
|
||||
geometryCreationMode==Construction?"True":"False");
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("Failed to add arc: %s\n", e.what());
|
||||
Gui::Command::abortCommand();
|
||||
}
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
|
||||
// Auto Constraint first picked point
|
||||
if (sugConstr1.size() > 0) {
|
||||
createAutoConstraints(sugConstr1, getHighestCurveIndex(), arcPos1);
|
||||
|
@ -1954,17 +1981,23 @@ public:
|
|||
double ry = EditCurve[1].fY - EditCurve[0].fY;
|
||||
unsetCursor();
|
||||
resetPositionText();
|
||||
|
||||
Gui::Command::openCommand("Add sketch circle");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.addGeometry(Part.Circle"
|
||||
"(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),%s)",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
EditCurve[0].fX, EditCurve[0].fY,
|
||||
sqrt(rx*rx + ry*ry),
|
||||
geometryCreationMode==Construction?"True":"False");
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch circle");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.addGeometry(Part.Circle"
|
||||
"(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),%s)",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
EditCurve[0].fX, EditCurve[0].fY,
|
||||
sqrt(rx*rx + ry*ry),
|
||||
geometryCreationMode==Construction?"True":"False");
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("Failed to add circle: %s\n", e.what());
|
||||
Gui::Command::abortCommand();
|
||||
}
|
||||
|
||||
// add auto constraints for the center point
|
||||
if (sugConstr1.size() > 0) {
|
||||
|
@ -1988,7 +2021,7 @@ public:
|
|||
|
||||
//ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
|
||||
bool continuousMode = hGrp->GetBool("ContinuousCreationMode",true);
|
||||
|
||||
|
||||
if(continuousMode){
|
||||
// This code enables the continuous creation mode.
|
||||
Mode=STATUS_SEEK_First;
|
||||
|
@ -2297,7 +2330,7 @@ public:
|
|||
saveEllipse();
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
|
||||
bool continuousMode = hGrp->GetBool("ContinuousCreationMode",true);
|
||||
|
||||
|
||||
if(continuousMode){
|
||||
if (constrMethod == 0) {
|
||||
method = CENTER_PERIAPSIS_B;
|
||||
|
@ -2751,19 +2784,19 @@ private:
|
|||
|
||||
int currentgeoid = getHighestCurveIndex(); // index of the ellipse we just created
|
||||
|
||||
Gui::Command::openCommand("Add sketch ellipse");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.addGeometry(Part.Ellipse"
|
||||
"(App.Vector(%f,%f,0),App.Vector(%f,%f,0),App.Vector(%f,%f,0)),%s)",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
periapsis.fX, periapsis.fY,
|
||||
positiveB.fX, positiveB.fY,
|
||||
centroid.fX, centroid.fY,
|
||||
geometryCreationMode==Construction?"True":"False");
|
||||
|
||||
currentgeoid++;
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch ellipse");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.addGeometry(Part.Ellipse"
|
||||
"(App.Vector(%f,%f,0),App.Vector(%f,%f,0),App.Vector(%f,%f,0)),%s)",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
periapsis.fX, periapsis.fY,
|
||||
positiveB.fX, positiveB.fY,
|
||||
centroid.fX, centroid.fY,
|
||||
geometryCreationMode==Construction?"True":"False");
|
||||
|
||||
currentgeoid++;
|
||||
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.ExposeInternalGeometry(%d)",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
|
@ -2772,7 +2805,7 @@ private:
|
|||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
Gui::Command::abortCommand();
|
||||
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
|
||||
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
|
||||
|
||||
|
@ -3165,25 +3198,25 @@ public:
|
|||
phi-=M_PI/2;
|
||||
double t=a; a=b; b=t;//swap a,b
|
||||
}
|
||||
|
||||
|
||||
int currentgeoid = getHighestCurveIndex();
|
||||
|
||||
Gui::Command::openCommand("Add sketch arc of ellipse");
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch arc of ellipse");
|
||||
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.addGeometry(Part.ArcOfEllipse"
|
||||
"(Part.Ellipse(App.Vector(%f,%f,0),App.Vector(%f,%f,0),App.Vector(%f,%f,0)),"
|
||||
"%f,%f),%s)",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
majAxisPoint.fX, majAxisPoint.fY,
|
||||
minAxisPoint.fX, minAxisPoint.fY,
|
||||
centerPoint.fX, centerPoint.fY,
|
||||
startAngle, endAngle,
|
||||
geometryCreationMode==Construction?"True":"False");
|
||||
|
||||
currentgeoid++;
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.addGeometry(Part.ArcOfEllipse"
|
||||
"(Part.Ellipse(App.Vector(%f,%f,0),App.Vector(%f,%f,0),App.Vector(%f,%f,0)),"
|
||||
"%f,%f),%s)",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
majAxisPoint.fX, majAxisPoint.fY,
|
||||
minAxisPoint.fX, minAxisPoint.fY,
|
||||
centerPoint.fX, centerPoint.fY,
|
||||
startAngle, endAngle,
|
||||
geometryCreationMode==Construction?"True":"False");
|
||||
|
||||
currentgeoid++;
|
||||
|
||||
try {
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.ExposeInternalGeometry(%d)",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
|
@ -3192,7 +3225,7 @@ public:
|
|||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
Gui::Command::abortCommand();
|
||||
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
|
||||
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
|
||||
|
||||
|
@ -3324,7 +3357,7 @@ void CmdSketcherCompCreateConic::activated(int iMsg)
|
|||
} else if (iMsg == 2) {
|
||||
ActivateHandler(getActiveGuiDocument(), new DrawSketchHandlerArcOfEllipse());
|
||||
} else {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
// Since the default icon is reset when enabing/disabling the command we have
|
||||
|
@ -3563,16 +3596,23 @@ public:
|
|||
if (Mode==STATUS_End) {
|
||||
unsetCursor();
|
||||
resetPositionText();
|
||||
Gui::Command::openCommand("Add sketch circle");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.addGeometry(Part.Circle"
|
||||
"(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),%s)",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
CenterPoint.fX, CenterPoint.fY,
|
||||
radius,
|
||||
geometryCreationMode==Construction?"True":"False");
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch circle");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.addGeometry(Part.Circle"
|
||||
"(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),%s)",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
CenterPoint.fX, CenterPoint.fY,
|
||||
radius,
|
||||
geometryCreationMode==Construction?"True":"False");
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("Failed to add circle: %s\n", e.what());
|
||||
Gui::Command::abortCommand();
|
||||
}
|
||||
|
||||
// Auto Constraint first picked point
|
||||
if (sugConstr1.size() > 0) {
|
||||
|
@ -3827,12 +3867,18 @@ public:
|
|||
unsetCursor();
|
||||
resetPositionText();
|
||||
|
||||
Gui::Command::openCommand("Add sketch point");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addGeometry(Part.Point(App.Vector(%f,%f,0)))",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
EditPoint.fX,EditPoint.fY);
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch point");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addGeometry(Part.Point(App.Vector(%f,%f,0)))",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
EditPoint.fX,EditPoint.fY);
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("Failed to add point: %s\n", e.what());
|
||||
Gui::Command::abortCommand();
|
||||
}
|
||||
|
||||
// add auto constraints for the line segment start
|
||||
if (sugConstr.size() > 0) {
|
||||
|
@ -4106,20 +4152,26 @@ public:
|
|||
|
||||
int currentgeoid= getHighestCurveIndex();
|
||||
// create fillet at point
|
||||
Gui::Command::openCommand("Create fillet");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.fillet(%d,%d,%f)",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
GeoId, PosId, radius);
|
||||
try {
|
||||
Gui::Command::openCommand("Create fillet");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.fillet(%d,%d,%f)",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
GeoId, PosId, radius);
|
||||
|
||||
if(construction) {
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.toggleConstruction(%d) ",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
currentgeoid+1);
|
||||
if(construction) {
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.toggleConstruction(%d) ",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
currentgeoid+1);
|
||||
}
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
}
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("Failed to create fillet: %s\n", e.what());
|
||||
Gui::Command::abortCommand();
|
||||
}
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
|
||||
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
|
||||
|
||||
|
@ -4165,22 +4217,28 @@ public:
|
|||
return false;
|
||||
|
||||
construction=lineSeg1->Construction && lineSeg2->Construction;
|
||||
int currentgeoid= getHighestCurveIndex();
|
||||
|
||||
// create fillet between lines
|
||||
Gui::Command::openCommand("Create fillet");
|
||||
int currentgeoid= getHighestCurveIndex();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.fillet(%d,%d,App.Vector(%f,%f,0),App.Vector(%f,%f,0),%f)",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
firstCurve, secondCurve,
|
||||
firstPos.fX, firstPos.fY,
|
||||
secondPos.fX, secondPos.fY, radius);
|
||||
Gui::Command::commitCommand();
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Create fillet");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.fillet(%d,%d,App.Vector(%f,%f,0),App.Vector(%f,%f,0),%f)",
|
||||
sketchgui->getObject()->getNameInDocument(),
|
||||
firstCurve, secondCurve,
|
||||
firstPos.fX, firstPos.fY,
|
||||
secondPos.fX, secondPos.fY, radius);
|
||||
Gui::Command::commitCommand();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("Failed to create fillet: %s\n", e.what());
|
||||
Gui::Command::abortCommand();
|
||||
}
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
|
||||
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
|
||||
|
||||
if(autoRecompute)
|
||||
Gui::Command::updateActive();
|
||||
Gui::Command::updateActive();
|
||||
|
||||
if(construction) {
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
|
@ -4360,7 +4418,8 @@ public:
|
|||
Gui::Command::updateActive();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
Base::Console().Error("Failed to trim edge: %s\n", e.what());
|
||||
Gui::Command::abortCommand();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4553,7 +4612,8 @@ public:
|
|||
* right button of the mouse */
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
Base::Console().Error("Failed to add external geometry: %s\n", e.what());
|
||||
Gui::Command::abortCommand();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -4714,7 +4774,7 @@ public:
|
|||
if (Mode==STATUS_End){
|
||||
unsetCursor();
|
||||
resetPositionText();
|
||||
Gui::Command::openCommand("Add slot");
|
||||
|
||||
int firstCurve = getHighestCurveIndex() + 1;
|
||||
// add the geometry to the sketch
|
||||
double start, end;
|
||||
|
@ -4732,6 +4792,7 @@ public:
|
|||
}
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add slot");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"geoList = []\n"
|
||||
"geoList.append(Part.ArcOfCircle(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),%f,%f))\n"
|
||||
|
@ -4788,7 +4849,7 @@ public:
|
|||
static_cast<Sketcher::SketchObject *>(sketchgui->getObject())->solve();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
Base::Console().Error("Failed to add slot: %s\n", e.what());
|
||||
Gui::Command::abortCommand();
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
|
||||
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
|
||||
|
@ -5022,7 +5083,7 @@ public:
|
|||
static_cast<Sketcher::SketchObject *>(sketchgui->getObject())->solve();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
Base::Console().Error("Failed to add hexagon: %s\n", e.what());
|
||||
Gui::Command::abortCommand();
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
|
||||
|
|
Loading…
Reference in New Issue
Block a user