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