[skip ci] fix more -Wgnu-zero-variadic-macro-arguments
This commit is contained in:
@@ -77,7 +77,7 @@ public:
|
||||
* @endcode
|
||||
*/
|
||||
template<typename T>
|
||||
void _cmdDocument(Gui::Command::DoCmd_Type cmdType, App::Document* doc, const std::string& mod, T&& cmd) {
|
||||
void _cmdDocument(Gui::Command::DoCmd_Type cmdType, const App::Document* doc, const std::string& mod, T&& cmd) {
|
||||
if (doc && doc->getName()) {
|
||||
std::stringstream str;
|
||||
str << mod << ".getDocument('" << doc->getName() << "')."
|
||||
@@ -105,7 +105,7 @@ void _cmdDocument(Gui::Command::DoCmd_Type cmdType, App::Document* doc, const st
|
||||
* @endcode
|
||||
*/
|
||||
template<typename T>
|
||||
inline void cmdAppDocument(App::Document* doc, T&& cmd) {
|
||||
inline void cmdAppDocument(const App::Document* doc, T&& cmd) {
|
||||
_cmdDocument(Gui::Command::Doc, doc, "App", std::forward<T>(cmd));
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ inline void cmdAppDocument(App::Document* doc, T&& cmd) {
|
||||
* @endcode
|
||||
*/
|
||||
template<typename T>
|
||||
inline void cmdGuiDocument(App::Document* doc, T&& cmd) {
|
||||
inline void cmdGuiDocument(const App::Document* doc, T&& cmd) {
|
||||
_cmdDocument(Gui::Command::Gui, doc, "Gui", std::forward<T>(cmd));
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ inline void cmdGuiDocument(App::Document* doc, T&& cmd) {
|
||||
* @param cmd: command string, streamable
|
||||
*/
|
||||
template<typename T>
|
||||
inline void _cmdDocument(Gui::Command::DoCmd_Type cmdType, App::DocumentObject* obj, const std::string& mod, T&& cmd) {
|
||||
inline void _cmdDocument(Gui::Command::DoCmd_Type cmdType, const App::DocumentObject* obj, const std::string& mod, T&& cmd) {
|
||||
if (obj) _cmdDocument(cmdType, obj->getDocument(), mod, std::forward<T>(cmd));
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ inline void _cmdDocument(Gui::Command::DoCmd_Type cmdType, App::DocumentObject*
|
||||
* @param cmd: command string, streamable
|
||||
*/
|
||||
template<typename T>
|
||||
inline void cmdAppDocument(App::DocumentObject* obj, T&& cmd) {
|
||||
inline void cmdAppDocument(const App::DocumentObject* obj, T&& cmd) {
|
||||
_cmdDocument(Gui::Command::Doc, obj, "App", std::forward<T>(cmd));
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ inline void cmdAppDocument(App::DocumentObject* obj, T&& cmd) {
|
||||
* @param cmd: command string, streamable
|
||||
*/
|
||||
template<typename T>
|
||||
inline void cmdGuiDocument(App::DocumentObject* obj, T&& cmd) {
|
||||
inline void cmdGuiDocument(const App::DocumentObject* obj, T&& cmd) {
|
||||
_cmdDocument(Gui::Command::Gui, obj, "Gui", std::forward<T>(cmd));
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ inline void cmdGuiDocument(App::DocumentObject* obj, T&& cmd) {
|
||||
* @endcode
|
||||
*/
|
||||
template<typename T>
|
||||
void _cmdObject(Gui::Command::DoCmd_Type cmdType, App::DocumentObject* obj, const std::string& mod, T&& cmd) {
|
||||
void _cmdObject(Gui::Command::DoCmd_Type cmdType, const App::DocumentObject* obj, const std::string& mod, T&& cmd) {
|
||||
if (obj && obj->getNameInDocument()) {
|
||||
std::ostringstream str;
|
||||
str << mod << ".getDocument('" << obj->getDocument()->getName() << "')"
|
||||
@@ -198,7 +198,7 @@ void _cmdObject(Gui::Command::DoCmd_Type cmdType, App::DocumentObject* obj, cons
|
||||
* @sa _cmdObject()
|
||||
*/
|
||||
template<typename T>
|
||||
inline void cmdAppObject(App::DocumentObject* obj, T&& cmd) {
|
||||
inline void cmdAppObject(const App::DocumentObject* obj, T&& cmd) {
|
||||
_cmdObject(Gui::Command::Doc, obj, "App", std::forward<T>(cmd));
|
||||
}
|
||||
|
||||
@@ -209,17 +209,17 @@ inline void cmdAppObject(App::DocumentObject* obj, T&& cmd) {
|
||||
* @sa _cmdObject()
|
||||
*/
|
||||
template<typename T>
|
||||
inline void cmdGuiObject(App::DocumentObject* obj, T&& cmd) {
|
||||
inline void cmdGuiObject(const App::DocumentObject* obj, T&& cmd) {
|
||||
_cmdObject(Gui::Command::Gui, obj, "Gui", std::forward<T>(cmd));
|
||||
}
|
||||
|
||||
/// Hides an object
|
||||
inline void cmdAppObjectHide(App::DocumentObject* obj) {
|
||||
inline void cmdAppObjectHide(const App::DocumentObject* obj) {
|
||||
cmdAppObject(obj, "Visibility = False");
|
||||
}
|
||||
|
||||
/// Shows an object
|
||||
inline void cmdAppObjectShow(App::DocumentObject* obj) {
|
||||
inline void cmdAppObjectShow(const App::DocumentObject* obj) {
|
||||
cmdAppObject(obj, "Visibility = True");
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ inline void cmdAppObjectShow(App::DocumentObject* obj) {
|
||||
* in-place editing an object, which may be brought in through linking to an
|
||||
* external group.
|
||||
*/
|
||||
inline void cmdSetEdit(App::DocumentObject* obj) {
|
||||
inline void cmdSetEdit(const App::DocumentObject* obj) {
|
||||
if (obj && obj->getNameInDocument()) {
|
||||
Gui::Command::doCommand(Gui::Command::Gui,
|
||||
"Gui.ActiveDocument.setEdit(App.getDocument('%s').getObject('%s'))",
|
||||
@@ -257,7 +257,7 @@ inline void cmdSetEdit(App::DocumentObject* obj) {
|
||||
* @endcode
|
||||
*/
|
||||
template<typename...Args>
|
||||
void cmdAppObjectArgs(App::DocumentObject* obj, const std::string& cmd, Args&&... args) {
|
||||
void cmdAppObjectArgs(const App::DocumentObject* obj, const std::string& cmd, Args&&... args) {
|
||||
std::string _cmd;
|
||||
try {
|
||||
boost::format fmt(cmd);
|
||||
@@ -282,7 +282,7 @@ void cmdAppObjectArgs(App::DocumentObject* obj, const std::string& cmd, Args&&..
|
||||
* @sa cmdAppObjectArgs()
|
||||
*/
|
||||
template<typename...Args>
|
||||
void cmdGuiObjectArgs(App::DocumentObject* obj, const std::string& cmd, Args&&... args) {
|
||||
void cmdGuiObjectArgs(const App::DocumentObject* obj, const std::string& cmd, Args&&... args) {
|
||||
std::string _cmd;
|
||||
try {
|
||||
boost::format fmt(cmd);
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <App/OriginFeature.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/CommandT.h>
|
||||
#include <Gui/Control.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
#include <Gui/DlgEditFileIncludePropertyExternal.h>
|
||||
@@ -400,8 +400,8 @@ void CmdSketcherReorientSketch::activated(int iMsg)
|
||||
}
|
||||
|
||||
openCommand("Reorient Sketch");
|
||||
FCMD_OBJ_CMD2("Placement = App.Placement(App.Vector(%f,%f,%f),App.Rotation(%f,%f,%f,%f))"
|
||||
,sketch,p.x,p.y,p.z,r[0],r[1],r[2],r[3]);
|
||||
Gui::cmdAppObjectArgs(sketch, "Placement = App.Placement(App.Vector(%f,%f,%f),App.Rotation(%f,%f,%f,%f))"
|
||||
, p.x,p.y,p.z,r[0],r[1],r[2],r[3]);
|
||||
doCommand(Gui,"Gui.ActiveDocument.setEdit('%s')",sketch->getNameInDocument());
|
||||
}
|
||||
|
||||
@@ -456,7 +456,7 @@ void CmdSketcherMapSketch::activated(int iMsg)
|
||||
items, 0, false, &ok);
|
||||
if (!ok) return;
|
||||
int index = items.indexOf(text);
|
||||
Part2DObject &sketch = *(static_cast<Part2DObject*>(sketches[index]));
|
||||
Part2DObject* sketch = static_cast<Part2DObject*>(sketches[index]);
|
||||
|
||||
|
||||
// check circular dependency
|
||||
@@ -468,7 +468,7 @@ void CmdSketcherMapSketch::activated(int iMsg)
|
||||
throw Base::ValueError("Unexpected null pointer in CmdSketcherMapSketch::activated");
|
||||
}
|
||||
std::vector<App::DocumentObject*> input = part->getOutList();
|
||||
if (std::find(input.begin(), input.end(), &sketch) != input.end()) {
|
||||
if (std::find(input.begin(), input.end(), sketch) != input.end()) {
|
||||
throw ExceptionWrongInput(QT_TR_NOOP("Some of the selected objects depend on the sketch to be mapped. Circular dependencies are not allowed!"));
|
||||
}
|
||||
}
|
||||
@@ -485,7 +485,7 @@ void CmdSketcherMapSketch::activated(int iMsg)
|
||||
bool bAttach = true;
|
||||
bool bCurIncompatible = false;
|
||||
// * find out the modes that are compatible with selection.
|
||||
eMapMode curMapMode = eMapMode(sketch.MapMode.getValue());
|
||||
eMapMode curMapMode = eMapMode(sketch->MapMode.getValue());
|
||||
// * Test if current mode is OK.
|
||||
if (std::find(validModes.begin(), validModes.end(), curMapMode) == validModes.end())
|
||||
bCurIncompatible = true;
|
||||
@@ -547,13 +547,13 @@ void CmdSketcherMapSketch::activated(int iMsg)
|
||||
std::string supportString = support.getPyReprString();
|
||||
|
||||
openCommand("Attach Sketch");
|
||||
FCMD_OBJ_CMD2("MapMode = \"%s\"",&sketch,AttachEngine::getModeName(suggMapMode).c_str());
|
||||
FCMD_OBJ_CMD2("Support = %s",&sketch,supportString.c_str());
|
||||
Gui::cmdAppObjectArgs(sketch, "MapMode = \"%s\"",AttachEngine::getModeName(suggMapMode).c_str());
|
||||
Gui::cmdAppObjectArgs(sketch, "Support = %s",supportString.c_str());
|
||||
commitCommand();
|
||||
} else {
|
||||
openCommand("Detach Sketch");
|
||||
FCMD_OBJ_CMD2("MapMode = \"%s\"",&sketch,AttachEngine::getModeName(suggMapMode).c_str());
|
||||
FCMD_OBJ_CMD2("Support = None",&sketch);
|
||||
Gui::cmdAppObjectArgs(sketch, "MapMode = \"%s\"",AttachEngine::getModeName(suggMapMode).c_str());
|
||||
Gui::cmdAppObjectArgs(sketch, "Support = None");
|
||||
commitCommand();
|
||||
}
|
||||
} catch (ExceptionWrongInput &e) {
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/Selection.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/CommandT.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/DlgEditFileIncludePropertyExternal.h>
|
||||
@@ -142,7 +142,7 @@ void CmdSketcherToggleConstruction::activated(int iMsg)
|
||||
if (it->size() > 4 && it->substr(0,4) == "Edge") {
|
||||
int GeoId = std::atoi(it->substr(4,4000).c_str()) - 1;
|
||||
// issue the actual commands to toggle
|
||||
FCMD_OBJ_CMD2("toggleConstruction(%d) ",selection[0].getObject(),GeoId);
|
||||
Gui::cmdAppObjectArgs(selection[0].getObject(), "toggleConstruction(%d) ", GeoId);
|
||||
}
|
||||
}
|
||||
// finish the transaction and update
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -43,7 +43,7 @@
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/CommandT.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
#include <Gui/DlgEditFileIncludePropertyExternal.h>
|
||||
#include <Gui/Selection.h>
|
||||
@@ -350,8 +350,7 @@ public:
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch line");
|
||||
FCMD_OBJ_CMD2("addGeometry(Part.LineSegment(App.Vector(%f,%f,0),App.Vector(%f,%f,0)),%s)",
|
||||
sketchgui->getObject(),
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.LineSegment(App.Vector(%f,%f,0),App.Vector(%f,%f,0)),%s)",
|
||||
EditCurve[0].x,EditCurve[0].y,EditCurve[1].x,EditCurve[1].y,
|
||||
geometryCreationMode==Construction?"True":"False");
|
||||
|
||||
@@ -1093,8 +1092,7 @@ public:
|
||||
try {
|
||||
// open the transaction
|
||||
Gui::Command::openCommand("Add line to sketch wire");
|
||||
FCMD_OBJ_CMD2("addGeometry(Part.LineSegment(App.Vector(%f,%f,0),App.Vector(%f,%f,0)),%s)",
|
||||
sketchgui->getObject(),
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.LineSegment(App.Vector(%f,%f,0),App.Vector(%f,%f,0)),%s)",
|
||||
EditCurve[0].x,EditCurve[0].y,EditCurve[1].x,EditCurve[1].y,
|
||||
geometryCreationMode==Construction?"True":"False");
|
||||
}
|
||||
@@ -1114,9 +1112,8 @@ public:
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add arc to sketch wire");
|
||||
FCMD_OBJ_CMD2("addGeometry(Part.ArcOfCircle"
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.ArcOfCircle"
|
||||
"(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),%f,%f),%s)",
|
||||
sketchgui->getObject(),
|
||||
CenterPoint.x, CenterPoint.y, std::abs(arcRadius),
|
||||
std::min(startAngle,endAngle), std::max(startAngle,endAngle),
|
||||
geometryCreationMode==Construction?"True":"False");
|
||||
@@ -1146,9 +1143,8 @@ public:
|
||||
TransitionMode == TRANSITION_MODE_Perpendicular_R)
|
||||
constrType = "Perpendicular";
|
||||
}
|
||||
FCMD_OBJ_CMD2("addConstraint(Sketcher.Constraint('%s',%i,%i,%i,%i)) ",
|
||||
sketchgui->getObject(), constrType.c_str(),
|
||||
previousCurve, previousPosId, lastCurve, lastStartPosId);
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('%s',%i,%i,%i,%i)) ",
|
||||
constrType.c_str(), previousCurve, previousPosId, lastCurve, lastStartPosId);
|
||||
|
||||
if(SnapMode == SNAP_MODE_45Degree && Mode != STATUS_Close) {
|
||||
// -360, -315, -270, -225, -180, -135, -90, -45, 0, 45, 90, 135, 180, 225, 270, 315, 360
|
||||
@@ -1157,15 +1153,13 @@ public:
|
||||
// #3974: if in radians, the printf %f defaults to six decimals, which leads to loss of precision
|
||||
double arcAngle = abs(round( (endAngle - startAngle) / (M_PI/4)) * 45); // in degrees
|
||||
|
||||
FCMD_OBJ_CMD2("addConstraint(Sketcher.Constraint('Angle',%i,App.Units.Quantity('%f deg'))) ",
|
||||
sketchgui->getObject(),
|
||||
lastCurve, arcAngle);
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('Angle',%i,App.Units.Quantity('%f deg'))) ",
|
||||
lastCurve, arcAngle);
|
||||
}
|
||||
if (Mode == STATUS_Close) {
|
||||
// close the loop by constrain to the first curve point
|
||||
FCMD_OBJ_CMD2("addConstraint(Sketcher.Constraint('Coincident',%i,%i,%i,%i)) ",
|
||||
sketchgui->getObject(),
|
||||
lastCurve,lastEndPosId,firstCurve,firstPosId);
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('Coincident',%i,%i,%i,%i)) ",
|
||||
lastCurve,lastEndPosId,firstCurve,firstPosId);
|
||||
}
|
||||
Gui::Command::commitCommand();
|
||||
|
||||
@@ -1601,10 +1595,8 @@ public:
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch arc");
|
||||
FCMD_OBJ_CMD2("addGeometry(Part.ArcOfCircle"
|
||||
"(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),"
|
||||
"%f,%f),%s)",
|
||||
sketchgui->getObject(),
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.ArcOfCircle"
|
||||
"(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),%f,%f),%s)",
|
||||
CenterPoint.x, CenterPoint.y, sqrt(rx*rx + ry*ry),
|
||||
startAngle, endAngle,
|
||||
geometryCreationMode==Construction?"True":"False"); //arcAngle > 0 ? 0 : 1);
|
||||
@@ -1912,10 +1904,8 @@ public:
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch arc");
|
||||
FCMD_OBJ_CMD2("addGeometry(Part.ArcOfCircle"
|
||||
"(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),"
|
||||
"%f,%f),%s)",
|
||||
sketchgui->getObject(),
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.ArcOfCircle"
|
||||
"(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),%f,%f),%s)",
|
||||
CenterPoint.x, CenterPoint.y, radius,
|
||||
startAngle, endAngle,
|
||||
geometryCreationMode==Construction?"True":"False");
|
||||
@@ -2223,9 +2213,8 @@ public:
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch circle");
|
||||
FCMD_OBJ_CMD2("addGeometry(Part.Circle"
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.Circle"
|
||||
"(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),%s)",
|
||||
sketchgui->getObject(),
|
||||
EditCurve[0].x, EditCurve[0].y,
|
||||
sqrt(rx*rx + ry*ry),
|
||||
geometryCreationMode==Construction?"True":"False");
|
||||
@@ -3024,9 +3013,8 @@ private:
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch ellipse");
|
||||
FCMD_OBJ_CMD2("addGeometry(Part.Ellipse"
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.Ellipse"
|
||||
"(App.Vector(%f,%f,0),App.Vector(%f,%f,0),App.Vector(%f,%f,0)),%s)",
|
||||
sketchgui->getObject(),
|
||||
periapsis.x, periapsis.y,
|
||||
positiveB.x, positiveB.y,
|
||||
centroid.x, centroid.y,
|
||||
@@ -3034,9 +3022,7 @@ private:
|
||||
|
||||
currentgeoid++;
|
||||
|
||||
FCMD_OBJ_CMD2("exposeInternalGeometry(%d)",
|
||||
sketchgui->getObject(),
|
||||
currentgeoid);
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "exposeInternalGeometry(%d)", currentgeoid);
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
@@ -3437,10 +3423,8 @@ public:
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch arc of ellipse");
|
||||
|
||||
FCMD_OBJ_CMD2("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(),
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.ArcOfEllipse"
|
||||
"(Part.Ellipse(App.Vector(%f,%f,0),App.Vector(%f,%f,0),App.Vector(%f,%f,0)),%f,%f),%s)",
|
||||
majAxisPoint.x, majAxisPoint.y,
|
||||
minAxisPoint.x, minAxisPoint.y,
|
||||
centerPoint.x, centerPoint.y,
|
||||
@@ -3449,9 +3433,7 @@ public:
|
||||
|
||||
currentgeoid++;
|
||||
|
||||
FCMD_OBJ_CMD2("exposeInternalGeometry(%d)",
|
||||
sketchgui->getObject(),
|
||||
currentgeoid);
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "exposeInternalGeometry(%d)", currentgeoid);
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
@@ -3817,27 +3799,22 @@ public:
|
||||
|
||||
try {
|
||||
|
||||
Gui::Command::openCommand("Add sketch arc of hyperbola");
|
||||
Gui::Command::openCommand("Add sketch arc of hyperbola");
|
||||
|
||||
//Add arc of hyperbola, point and constrain point as focus2. We add focus2 for it to balance
|
||||
//the intrinsic focus1, in order to balance out the intrinsic invisible focus1 when AOE is
|
||||
//dragged by its center
|
||||
FCMD_OBJ_CMD2("addGeometry(Part.ArcOfHyperbola"
|
||||
"(Part.Hyperbola(App.Vector(%f,%f,0),App.Vector(%f,%f,0),App.Vector(%f,%f,0)),"
|
||||
"%f,%f),%s)",
|
||||
sketchgui->getObject(),
|
||||
//Add arc of hyperbola, point and constrain point as focus2. We add focus2 for it to balance
|
||||
//the intrinsic focus1, in order to balance out the intrinsic invisible focus1 when AOE is
|
||||
//dragged by its center
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.ArcOfHyperbola"
|
||||
"(Part.Hyperbola(App.Vector(%f,%f,0),App.Vector(%f,%f,0),App.Vector(%f,%f,0)),%f,%f),%s)",
|
||||
majAxisPoint.x, majAxisPoint.y,
|
||||
minAxisPoint.x, minAxisPoint.y,
|
||||
centerPoint.x, centerPoint.y,
|
||||
startAngle, endAngle,
|
||||
geometryCreationMode==Construction?"True":"False");
|
||||
|
||||
currentgeoid++;
|
||||
|
||||
FCMD_OBJ_CMD2("exposeInternalGeometry(%d)",
|
||||
sketchgui->getObject(),
|
||||
currentgeoid);
|
||||
currentgeoid++;
|
||||
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "exposeInternalGeometry(%d)", currentgeoid);
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
@@ -4167,10 +4144,8 @@ public:
|
||||
Gui::Command::openCommand("Add sketch arc of Parabola");
|
||||
|
||||
//Add arc of parabola
|
||||
FCMD_OBJ_CMD2("addGeometry(Part.ArcOfParabola"
|
||||
"(Part.Parabola(App.Vector(%f,%f,0),App.Vector(%f,%f,0),App.Vector(0,0,1)),"
|
||||
"%f,%f),%s)",
|
||||
sketchgui->getObject(),
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.ArcOfParabola"
|
||||
"(Part.Parabola(App.Vector(%f,%f,0),App.Vector(%f,%f,0),App.Vector(0,0,1)),%f,%f),%s)",
|
||||
focusPoint.x, focusPoint.y,
|
||||
axisPoint.x, axisPoint.y,
|
||||
startAngle, endAngle,
|
||||
@@ -4178,10 +4153,7 @@ public:
|
||||
|
||||
currentgeoid++;
|
||||
|
||||
FCMD_OBJ_CMD2("exposeInternalGeometry(%d)",
|
||||
sketchgui->getObject(),
|
||||
currentgeoid);
|
||||
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "exposeInternalGeometry(%d)", currentgeoid);
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
@@ -4535,9 +4507,8 @@ public:
|
||||
Gui::Command::openCommand("Add Pole circle");
|
||||
|
||||
//Add pole
|
||||
FCMD_OBJ_CMD2("addGeometry(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),10),True)",
|
||||
sketchgui->getObject(),
|
||||
EditCurve[0].x,EditCurve[0].y);
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),10),True)",
|
||||
EditCurve[0].x,EditCurve[0].y);
|
||||
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
@@ -4618,18 +4589,16 @@ public:
|
||||
|
||||
guess = normalize(guess);
|
||||
|
||||
FCMD_OBJ_CMD2("addGeometry(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),10),True)",
|
||||
sketchgui->getObject(),
|
||||
EditCurve[EditCurve.size()-1].x,EditCurve[EditCurve.size()-1].y);
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),10),True)",
|
||||
EditCurve[EditCurve.size()-1].x,EditCurve[EditCurve.size()-1].y);
|
||||
|
||||
if(EditCurve.size() == 2) {
|
||||
FCMD_OBJ_CMD2("addConstraint(Sketcher.Constraint('Radius',%d,%f)) ",
|
||||
sketchgui->getObject(), FirstPoleGeoId, guess );
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('Radius',%d,%f)) ",
|
||||
FirstPoleGeoId, guess );
|
||||
}
|
||||
|
||||
FCMD_OBJ_CMD2("addConstraint(Sketcher.Constraint('Equal',%d,%d)) ",
|
||||
sketchgui->getObject(), FirstPoleGeoId, FirstPoleGeoId+ EditCurve.size()-1);
|
||||
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('Equal',%d,%d)) ",
|
||||
FirstPoleGeoId, FirstPoleGeoId+ EditCurve.size()-1);
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
@@ -4690,19 +4659,16 @@ public:
|
||||
|
||||
//Gui::Command::openCommand("Add B-spline curve");
|
||||
|
||||
/*FCMD_OBJ_CMD2("addGeometry(Part.BSplineCurve"
|
||||
/*Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.BSplineCurve"
|
||||
"(%s,%s),"
|
||||
"%s)",
|
||||
sketchgui->getObject(),
|
||||
controlpoints.c_str(),
|
||||
ConstrMethod == 0 ?"False":"True",
|
||||
geometryCreationMode==Construction?"True":"False"); */
|
||||
|
||||
// {"poles", "mults", "knots", "periodic", "degree", "weights", "CheckRational", NULL};
|
||||
FCMD_OBJ_CMD2("addGeometry(Part.BSplineCurve"
|
||||
"(%s,None,None,%s,3,None,False),"
|
||||
"%s)",
|
||||
sketchgui->getObject(),
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.BSplineCurve"
|
||||
"(%s,None,None,%s,3,None,False),%s)",
|
||||
controlpoints.c_str(),
|
||||
ConstrMethod == 0 ?"False":"True",
|
||||
geometryCreationMode==Construction?"True":"False");
|
||||
@@ -4744,10 +4710,7 @@ public:
|
||||
Gui::Command::doCommand(Gui::Command::Doc, cstream.str().c_str());
|
||||
|
||||
// for showing the knots on creation
|
||||
FCMD_OBJ_CMD2("exposeInternalGeometry(%d)",
|
||||
sketchgui->getObject(),
|
||||
currentgeoid);
|
||||
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "exposeInternalGeometry(%d)", currentgeoid);
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
@@ -5198,9 +5161,8 @@ public:
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch circle");
|
||||
FCMD_OBJ_CMD2("addGeometry(Part.Circle"
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.Circle"
|
||||
"(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),%s)",
|
||||
sketchgui->getObject(),
|
||||
CenterPoint.x, CenterPoint.y,
|
||||
radius,
|
||||
geometryCreationMode==Construction?"True":"False");
|
||||
@@ -5466,8 +5428,7 @@ public:
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch point");
|
||||
FCMD_OBJ_CMD2("addGeometry(Part.Point(App.Vector(%f,%f,0)))",
|
||||
sketchgui->getObject(),
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.Point(App.Vector(%f,%f,0)))",
|
||||
EditPoint.x,EditPoint.y);
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
@@ -5751,14 +5712,10 @@ public:
|
||||
// create fillet at point
|
||||
try {
|
||||
Gui::Command::openCommand("Create fillet");
|
||||
FCMD_OBJ_CMD2("fillet(%d,%d,%f)",
|
||||
sketchgui->getObject(),
|
||||
GeoId, PosId, radius);
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "fillet(%d,%d,%f)", GeoId, PosId, radius);
|
||||
|
||||
if(construction) {
|
||||
FCMD_OBJ_CMD2("toggleConstruction(%d) ",
|
||||
sketchgui->getObject(),
|
||||
currentgeoid+1);
|
||||
if (construction) {
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "toggleConstruction(%d) ", currentgeoid+1);
|
||||
}
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
@@ -5831,8 +5788,7 @@ public:
|
||||
// create fillet between lines
|
||||
try {
|
||||
Gui::Command::openCommand("Create fillet");
|
||||
FCMD_OBJ_CMD2("fillet(%d,%d,App.Vector(%f,%f,0),App.Vector(%f,%f,0),%f)",
|
||||
sketchgui->getObject(),
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "fillet(%d,%d,App.Vector(%f,%f,0),App.Vector(%f,%f,0),%f)",
|
||||
firstCurve, secondCurve,
|
||||
firstPos.x, firstPos.y,
|
||||
secondPos.x, secondPos.y, radius);
|
||||
@@ -5858,8 +5814,7 @@ public:
|
||||
tryAutoRecompute(static_cast<Sketcher::SketchObject *>(sketchgui->getObject()));
|
||||
|
||||
if(construction) {
|
||||
FCMD_OBJ_CMD2("toggleConstruction(%d) ",
|
||||
sketchgui->getObject(),
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "toggleConstruction(%d) ",
|
||||
currentgeoid+1);
|
||||
}
|
||||
|
||||
@@ -6026,8 +5981,7 @@ public:
|
||||
geom->getTypeId() == Part::GeomEllipse::getClassTypeId()) {
|
||||
try {
|
||||
Gui::Command::openCommand("Trim edge");
|
||||
FCMD_OBJ_CMD2("trim(%d,App.Vector(%f,%f,0))",
|
||||
sketchgui->getObject(),
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "trim(%d,App.Vector(%f,%f,0))",
|
||||
GeoId, onSketchPos.x, onSketchPos.y);
|
||||
Gui::Command::commitCommand();
|
||||
tryAutoRecompute(static_cast<Sketcher::SketchObject *>(sketchgui->getObject()));
|
||||
@@ -6338,9 +6292,8 @@ public:
|
||||
} else if (Mode == STATUS_SEEK_Second) {
|
||||
try {
|
||||
Gui::Command::openCommand("Extend edge");
|
||||
FCMD_OBJ_CMD2("extend(%d, %f, %d)\n", // GeoId, increment, PointPos
|
||||
sketchgui->getObject(), BaseGeoId, Increment,
|
||||
ExtendFromStart ? Sketcher::start : Sketcher::end);
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "extend(%d, %f, %d)\n", // GeoId, increment, PointPos
|
||||
BaseGeoId, Increment, ExtendFromStart ? Sketcher::start : Sketcher::end);
|
||||
Gui::Command::commitCommand();
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
|
||||
@@ -6596,8 +6549,7 @@ public:
|
||||
(subName.size() > 4 && subName.substr(0,4) == "Face")) {
|
||||
try {
|
||||
Gui::Command::openCommand("Add external geometry");
|
||||
FCMD_OBJ_CMD2("addExternal(\"%s\",\"%s\")",
|
||||
sketchgui->getObject(),
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addExternal(\"%s\",\"%s\")",
|
||||
msg.pObjectName, msg.pSubName);
|
||||
Gui::Command::commitCommand();
|
||||
|
||||
@@ -6818,9 +6770,8 @@ static const char *cursor_carboncopy[]={
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add carbon copy");
|
||||
FCMD_OBJ_CMD2("carbonCopy(\"%s\",%s)",
|
||||
sketchgui->getObject(),
|
||||
msg.pObjectName, geometryCreationMode==Construction?"True":"False");
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "carbonCopy(\"%s\",%s)",
|
||||
msg.pObjectName, geometryCreationMode==Construction?"True":"False");
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/Selection.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/CommandT.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
#include <Gui/DlgEditFileIncludePropertyExternal.h>
|
||||
|
||||
@@ -380,19 +380,13 @@ void CmdSketcherConvertToNURB::activated(int iMsg)
|
||||
if (SubNames[i].size() > 4 && SubNames[i].substr(0,4) == "Edge") {
|
||||
|
||||
int GeoId = std::atoi(SubNames[i].substr(4,4000).c_str()) - 1;
|
||||
|
||||
FCMD_OBJ_CMD2("convertToNURBS(%d) ",
|
||||
selection[0].getObject(),GeoId);
|
||||
|
||||
Gui::cmdAppObjectArgs(selection[0].getObject(), "convertToNURBS(%d) ", GeoId);
|
||||
nurbsized = true;
|
||||
}
|
||||
else if (SubNames[i].size() > 12 && SubNames[i].substr(0,12) == "ExternalEdge") {
|
||||
|
||||
int GeoId = - (std::atoi(SubNames[i].substr(12,4000).c_str()) + 2);
|
||||
|
||||
FCMD_OBJ_CMD2("convertToNURBS(%d) ",
|
||||
selection[0].getObject(),GeoId);
|
||||
|
||||
Gui::cmdAppObjectArgs(selection[0].getObject(), "convertToNURBS(%d) ", GeoId);
|
||||
nurbsized = true;
|
||||
}
|
||||
|
||||
@@ -463,13 +457,10 @@ void CmdSketcherIncreaseDegree::activated(int iMsg)
|
||||
const Part::Geometry * geo = Obj->getGeometry(GeoId);
|
||||
|
||||
if (geo->getTypeId() == Part::GeomBSplineCurve::getClassTypeId()) {
|
||||
FCMD_OBJ_CMD2("increaseBSplineDegree(%d) ",
|
||||
selection[0].getObject(),GeoId);
|
||||
Gui::cmdAppObjectArgs(selection[0].getObject(), "increaseBSplineDegree(%d) ", GeoId);
|
||||
|
||||
// add new control points
|
||||
FCMD_OBJ_CMD2("exposeInternalGeometry(%d)",
|
||||
selection[0].getObject(),
|
||||
GeoId);
|
||||
Gui::cmdAppObjectArgs(selection[0].getObject(), "exposeInternalGeometry(%d)", GeoId);
|
||||
}
|
||||
else {
|
||||
ignored=true;
|
||||
@@ -564,8 +555,8 @@ void CmdSketcherIncreaseKnotMultiplicity::activated(int iMsg)
|
||||
notaknot = false;
|
||||
|
||||
try {
|
||||
FCMD_OBJ_CMD2("modifyBSplineKnotMultiplicity(%d,%d,%d) ",
|
||||
selection[0].getObject(),(*it)->Second, (*it)->InternalAlignmentIndex + 1, 1);
|
||||
Gui::cmdAppObjectArgs(selection[0].getObject(), "modifyBSplineKnotMultiplicity(%d,%d,%d) ",
|
||||
(*it)->Second, (*it)->InternalAlignmentIndex + 1, 1);
|
||||
|
||||
applied = true;
|
||||
|
||||
@@ -623,9 +614,7 @@ void CmdSketcherIncreaseKnotMultiplicity::activated(int iMsg)
|
||||
if(ngfound) {
|
||||
try {
|
||||
// add internalalignment for new pole
|
||||
FCMD_OBJ_CMD2("exposeInternalGeometry(%d)",
|
||||
selection[0].getObject(),
|
||||
ngeoid);
|
||||
Gui::cmdAppObjectArgs(selection[0].getObject(), "exposeInternalGeometry(%d)", ngeoid);
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
@@ -723,8 +712,8 @@ void CmdSketcherDecreaseKnotMultiplicity::activated(int iMsg)
|
||||
notaknot = false;
|
||||
|
||||
try {
|
||||
FCMD_OBJ_CMD2("modifyBSplineKnotMultiplicity(%d,%d,%d) ",
|
||||
selection[0].getObject(),(*it)->Second, (*it)->InternalAlignmentIndex + 1, -1);
|
||||
Gui::cmdAppObjectArgs(selection[0].getObject(), "modifyBSplineKnotMultiplicity(%d,%d,%d) ",
|
||||
(*it)->Second, (*it)->InternalAlignmentIndex + 1, -1);
|
||||
|
||||
applied = true;
|
||||
|
||||
@@ -769,15 +758,12 @@ void CmdSketcherDecreaseKnotMultiplicity::activated(int iMsg)
|
||||
if(ngfound) {
|
||||
try {
|
||||
// add internalalignment for new pole
|
||||
FCMD_OBJ_CMD2("exposeInternalGeometry(%d)",
|
||||
selection[0].getObject(),
|
||||
ngeoid);
|
||||
Gui::cmdAppObjectArgs(selection[0].getObject(), "exposeInternalGeometry(%d)", ngeoid);
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
getSelection().clearSelection();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/Selection.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/CommandT.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
#include <Gui/DlgEditFileIncludePropertyExternal.h>
|
||||
|
||||
@@ -169,14 +169,14 @@ void CmdSketcherCloseShape::activated(int iMsg)
|
||||
return;
|
||||
}
|
||||
|
||||
FCMD_OBJ_CMD2("addConstraint(Sketcher.Constraint('Coincident',%d,%d,%d,%d)) ",
|
||||
selection[0].getObject(),GeoId1,Sketcher::end,GeoId2,Sketcher::start);
|
||||
Gui::cmdAppObjectArgs(selection[0].getObject(), "addConstraint(Sketcher.Constraint('Coincident',%d,%d,%d,%d)) ",
|
||||
GeoId1,Sketcher::end,GeoId2,Sketcher::start);
|
||||
}
|
||||
}
|
||||
|
||||
// Close Last Edge with First Edge
|
||||
FCMD_OBJ_CMD2("addConstraint(Sketcher.Constraint('Coincident',%d,%d,%d,%d)) ",
|
||||
selection[0].getObject(),GeoIdLast,Sketcher::end,GeoIdFirst,Sketcher::start);
|
||||
Gui::cmdAppObjectArgs(selection[0].getObject(),"addConstraint(Sketcher.Constraint('Coincident',%d,%d,%d,%d)) ",
|
||||
GeoIdLast,Sketcher::end,GeoIdFirst,Sketcher::start);
|
||||
|
||||
// finish the transaction and update
|
||||
commitCommand();
|
||||
@@ -257,8 +257,8 @@ void CmdSketcherConnect::activated(int iMsg)
|
||||
return;
|
||||
}
|
||||
|
||||
FCMD_OBJ_CMD2("addConstraint(Sketcher.Constraint('Coincident',%d,%d,%d,%d)) ",
|
||||
selection[0].getObject(),GeoId1,Sketcher::end,GeoId2,Sketcher::start);
|
||||
Gui::cmdAppObjectArgs(selection[0].getObject(),"addConstraint(Sketcher.Constraint('Coincident',%d,%d,%d,%d)) ",
|
||||
GeoId1,Sketcher::end,GeoId2,Sketcher::start);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -872,12 +872,12 @@ void CmdSketcherRestoreInternalAlignmentGeometry::activated(int iMsg)
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Exposing Internal Geometry");
|
||||
FCMD_OBJ_CMD2("exposeInternalGeometry(%d)", Obj, GeoId);
|
||||
Gui::cmdAppObjectArgs(Obj, "exposeInternalGeometry(%d)", GeoId);
|
||||
|
||||
int aftergeoid = Obj->getHighestCurveIndex();
|
||||
|
||||
if(aftergeoid == currentgeoid) { // if we did not expose anything, deleteunused
|
||||
FCMD_OBJ_CMD2("deleteUnusedInternalGeometry(%d)", Obj, GeoId);
|
||||
Gui::cmdAppObjectArgs(Obj, "deleteUnusedInternalGeometry(%d)", GeoId);
|
||||
}
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
@@ -1076,7 +1076,7 @@ void CmdSketcherSymmetry::activated(int iMsg)
|
||||
Gui::Command::openCommand("Create Symmetric geometry");
|
||||
|
||||
try{
|
||||
FCMD_OBJ_CMD2("addSymmetric(%s,%d,%d)", Obj, geoIdList.c_str(), LastGeoId, LastPointPos);
|
||||
Gui::cmdAppObjectArgs(Obj, "addSymmetric(%s,%d,%d)", geoIdList.c_str(), LastGeoId, LastPointPos);
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
}
|
||||
@@ -1220,14 +1220,12 @@ static const char *cursor_createcopy[]={
|
||||
|
||||
try{
|
||||
if( Op != SketcherCopy::Move) {
|
||||
FCMD_OBJ_CMD2("addCopy(%s,App.Vector(%f,%f,0),%s)",
|
||||
sketchgui->getObject(),
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addCopy(%s,App.Vector(%f,%f,0),%s)",
|
||||
geoIdList.c_str(), vector.x, vector.y,
|
||||
(Op == SketcherCopy::Clone?"True":"False"));
|
||||
}
|
||||
else {
|
||||
FCMD_OBJ_CMD2("addMove(%s,App.Vector(%f,%f,0))",
|
||||
sketchgui->getObject(),
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addMove(%s,App.Vector(%f,%f,0))",
|
||||
geoIdList.c_str(), vector.x, vector.y);
|
||||
}
|
||||
|
||||
@@ -1743,13 +1741,12 @@ static const char *cursor_createrectangulararray[]={
|
||||
Gui::Command::openCommand("Create copy of geometry");
|
||||
|
||||
try {
|
||||
FCMD_OBJ_CMD2("addRectangularArray(%s, App.Vector(%f,%f,0),%s,%d,%d,%s,%f)",
|
||||
sketchgui->getObject(),
|
||||
geoIdList.c_str(), vector.x, vector.y,
|
||||
(Clone?"True":"False"),
|
||||
Cols, Rows,
|
||||
(ConstraintSeparation?"True":"False"),
|
||||
(EqualVerticalHorizontalSpacing?1.0:0.5));
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addRectangularArray(%s, App.Vector(%f,%f,0),%s,%d,%d,%s,%f)",
|
||||
geoIdList.c_str(), vector.x, vector.y,
|
||||
(Clone?"True":"False"),
|
||||
Cols, Rows,
|
||||
(ConstraintSeparation?"True":"False"),
|
||||
(EqualVerticalHorizontalSpacing?1.0:0.5));
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
}
|
||||
@@ -1965,7 +1962,7 @@ void CmdSketcherDeleteAllGeometry::activated(int iMsg)
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Delete All Geometry");
|
||||
FCMD_OBJ_CMD2("deleteAllGeometry()", Obj);
|
||||
Gui::cmdAppObjectArgs(Obj, "deleteAllGeometry()");
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
}
|
||||
@@ -2028,7 +2025,7 @@ void CmdSketcherDeleteAllConstraints::activated(int iMsg)
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Delete All Constraints");
|
||||
FCMD_OBJ_CMD2("deleteAllConstraints()", Obj);
|
||||
Gui::cmdAppObjectArgs(Obj, "deleteAllConstraints()");
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/Selection.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/CommandT.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
#include <Gui/DlgEditFileIncludePropertyExternal.h>
|
||||
|
||||
@@ -169,7 +169,7 @@ void CmdSketcherSwitchVirtualSpace::activated(int iMsg)
|
||||
int ConstrId = Sketcher::PropertyConstraintList::getIndexFromConstraintName(*it);
|
||||
Gui::Command::openCommand("Update constraint's virtual space");
|
||||
try {
|
||||
FCMD_OBJ_CMD2("toggleVirtualSpace(%d)", Obj, ConstrId);
|
||||
Gui::cmdAppObjectArgs(Obj, "toggleVirtualSpace(%d)", ConstrId);
|
||||
}
|
||||
catch(const Base::Exception&) {
|
||||
successful--;
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/CommandT.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/Macro.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
@@ -407,10 +407,8 @@ void DrawSketchHandler::createAutoConstraints(const std::vector<AutoConstraint>
|
||||
if (posId1 == Sketcher::none)
|
||||
continue;
|
||||
// If the auto constraint has a point create a coincident otherwise it is an edge on a point
|
||||
FCMD_OBJ_CMD2("addConstraint(Sketcher.Constraint('Coincident',%i,%i,%i,%i)) "
|
||||
,sketchgui->getObject()
|
||||
,geoId1, posId1, it->GeoId, it->PosId
|
||||
);
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('Coincident',%i,%i,%i,%i)) "
|
||||
, geoId1, posId1, it->GeoId, it->PosId);
|
||||
} break;
|
||||
case Sketcher::PointOnObject: {
|
||||
int geoId2 = it->GeoId;
|
||||
@@ -421,26 +419,14 @@ void DrawSketchHandler::createAutoConstraints(const std::vector<AutoConstraint>
|
||||
std::swap(posId1,posId2);
|
||||
}
|
||||
|
||||
FCMD_OBJ_CMD2("addConstraint(Sketcher.Constraint('PointOnObject',%i,%i,%i)) "
|
||||
,sketchgui->getObject()
|
||||
,geoId1, posId1, geoId2
|
||||
);
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('PointOnObject',%i,%i,%i)) "
|
||||
, geoId1, posId1, geoId2);
|
||||
} break;
|
||||
case Sketcher::Horizontal: {
|
||||
|
||||
FCMD_OBJ_CMD2("addConstraint(Sketcher.Constraint('Horizontal',%i)) "
|
||||
,sketchgui->getObject()
|
||||
,geoId1
|
||||
);
|
||||
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('Horizontal',%i)) ", geoId1);
|
||||
} break;
|
||||
case Sketcher::Vertical: {
|
||||
|
||||
FCMD_OBJ_CMD2("addConstraint(Sketcher.Constraint('Vertical',%i)) "
|
||||
,sketchgui->getObject()
|
||||
,geoId1
|
||||
);
|
||||
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('Vertical',%i)) ", geoId1);
|
||||
} break;
|
||||
case Sketcher::Tangent: {
|
||||
Sketcher::SketchObject* Obj = static_cast<Sketcher::SketchObject*>(sketchgui->getObject());
|
||||
@@ -496,10 +482,8 @@ void DrawSketchHandler::createAutoConstraints(const std::vector<AutoConstraint>
|
||||
}
|
||||
}
|
||||
|
||||
FCMD_OBJ_CMD2("addConstraint(Sketcher.Constraint('Tangent',%i, %i)) "
|
||||
,sketchgui->getObject()
|
||||
,geoId1, it->GeoId
|
||||
);
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('Tangent',%i, %i)) "
|
||||
, geoId1, it->GeoId);
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/CommandT.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/View3DInventor.h>
|
||||
#include <Gui/View3DInventorViewer.h>
|
||||
@@ -153,17 +153,15 @@ void EditDatumDialog::exec(bool atCursor)
|
||||
if (ui_ins_datum.labelEdit->hasExpression())
|
||||
ui_ins_datum.labelEdit->apply();
|
||||
else
|
||||
FCMD_OBJ_CMD2("setDatum(%i,App.Units.Quantity('%f %s'))",
|
||||
sketch,
|
||||
ConstrNbr, newDatum, (const char*)newQuant.getUnit().getString().toUtf8());
|
||||
Gui::cmdAppObjectArgs(sketch, "setDatum(%i,App.Units.Quantity('%f %s'))",
|
||||
ConstrNbr, newDatum, (const char*)newQuant.getUnit().getString().toUtf8());
|
||||
}
|
||||
|
||||
QString constraintName = ui_ins_datum.name->text().trimmed();
|
||||
if (Base::Tools::toStdString(constraintName) != sketch->Constraints[ConstrNbr]->Name) {
|
||||
std::string escapedstr = Base::Tools::escapedUnicodeFromUtf8(constraintName.toUtf8().constData());
|
||||
FCMD_OBJ_CMD2("renameConstraint(%d, u'%s')",
|
||||
sketch,
|
||||
ConstrNbr, escapedstr.c_str());
|
||||
Gui::cmdAppObjectArgs(sketch, "renameConstraint(%d, u'%s')",
|
||||
ConstrNbr, escapedstr.c_str());
|
||||
}
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
#include <Gui/Selection.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/ViewProvider.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/CommandT.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
#include <Gui/PrefWidgets.h>
|
||||
|
||||
@@ -603,15 +603,12 @@ void ConstraintView::swapNamedOfSelectedItems()
|
||||
std::string tmpname = ss.str();
|
||||
|
||||
Gui::Command::openCommand("Swap constraint names");
|
||||
FCMD_OBJ_CMD2("renameConstraint(%d, u'%s')",
|
||||
item1->sketch,
|
||||
item1->ConstraintNbr, tmpname.c_str());
|
||||
FCMD_OBJ_CMD2("renameConstraint(%d, u'%s')",
|
||||
item2->sketch,
|
||||
item2->ConstraintNbr, escapedstr1.c_str());
|
||||
FCMD_OBJ_CMD2("renameConstraint(%d, u'%s')",
|
||||
item1->sketch,
|
||||
item1->ConstraintNbr, escapedstr2.c_str());
|
||||
Gui::cmdAppObjectArgs(item1->sketch, "renameConstraint(%d, u'%s')",
|
||||
item1->ConstraintNbr, tmpname.c_str());
|
||||
Gui::cmdAppObjectArgs(item2->sketch, "renameConstraint(%d, u'%s')",
|
||||
item2->ConstraintNbr, escapedstr1.c_str());
|
||||
Gui::cmdAppObjectArgs(item1->sketch, "renameConstraint(%d, u'%s')",
|
||||
item1->ConstraintNbr, escapedstr2.c_str());
|
||||
Gui::Command::commitCommand();
|
||||
}
|
||||
|
||||
@@ -775,7 +772,6 @@ void TaskSketcherConstrains::on_listWidgetConstraints_itemActivated(QListWidgetI
|
||||
|
||||
// if its the right constraint
|
||||
if (it->isDimensional()) {
|
||||
|
||||
EditDatumDialog *editDatumDialog = new EditDatumDialog(this->sketchView, it->ConstraintNbr);
|
||||
editDatumDialog->exec(false);
|
||||
delete editDatumDialog;
|
||||
@@ -831,9 +827,8 @@ void TaskSketcherConstrains::on_listWidgetConstraints_itemChanged(QListWidgetIte
|
||||
|
||||
Gui::Command::openCommand("Rename sketch constraint");
|
||||
try {
|
||||
FCMD_OBJ_CMD2("renameConstraint(%d, u'%s')",
|
||||
sketch,
|
||||
it->ConstraintNbr, escapedstr.c_str());
|
||||
Gui::cmdAppObjectArgs(sketch ,"renameConstraint(%d, u'%s')",
|
||||
it->ConstraintNbr, escapedstr.c_str());
|
||||
Gui::Command::commitCommand();
|
||||
}
|
||||
catch (const Base::Exception & e) {
|
||||
@@ -847,10 +842,9 @@ void TaskSketcherConstrains::on_listWidgetConstraints_itemChanged(QListWidgetIte
|
||||
// update constraint virtual space status
|
||||
Gui::Command::openCommand("Update constraint's virtual space");
|
||||
try {
|
||||
FCMD_OBJ_CMD2("setVirtualSpace(%d, %s)",
|
||||
sketch,
|
||||
it->ConstraintNbr,
|
||||
((item->checkState() == Qt::Checked) != sketchView->getIsShownVirtualSpace())?"False":"True");
|
||||
Gui::cmdAppObjectArgs(sketch, "setVirtualSpace(%d, %s)",
|
||||
it->ConstraintNbr,
|
||||
((item->checkState() == Qt::Checked) != sketchView->getIsShownVirtualSpace())?"False":"True");
|
||||
Gui::Command::commitCommand();
|
||||
}
|
||||
catch (const Base::Exception & e) {
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/CommandT.h>
|
||||
#include <Gui/Control.h>
|
||||
#include <Gui/Selection.h>
|
||||
#include <Gui/Utilities.h>
|
||||
@@ -789,8 +789,7 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe
|
||||
if (GeoId != Sketcher::Constraint::GeoUndef && PosId != Sketcher::none) {
|
||||
getDocument()->openCommand("Drag Point");
|
||||
try {
|
||||
FCMD_OBJ_CMD2("movePoint(%i,%i,App.Vector(%f,%f,0),%i)"
|
||||
,getObject()
|
||||
Gui::cmdAppObjectArgs(getObject(), "movePoint(%i,%i,App.Vector(%f,%f,0),%i)"
|
||||
,GeoId, PosId, x-xInit, y-yInit, 0);
|
||||
getDocument()->commitCommand();
|
||||
|
||||
@@ -821,8 +820,7 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe
|
||||
geo->getTypeId() == Part::GeomBSplineCurve::getClassTypeId()) {
|
||||
getDocument()->openCommand("Drag Curve");
|
||||
try {
|
||||
FCMD_OBJ_CMD2("movePoint(%i,%i,App.Vector(%f,%f,0),%i)"
|
||||
,getObject()
|
||||
Gui::cmdAppObjectArgs(getObject(), "movePoint(%i,%i,App.Vector(%f,%f,0),%i)"
|
||||
,edit->DragCurve, Sketcher::none, x-xInit, y-yInit, relative ? 1 : 0);
|
||||
getDocument()->commitCommand();
|
||||
|
||||
@@ -1019,7 +1017,7 @@ void ViewProviderSketch::editDoubleClicked(void)
|
||||
if (Constr->isDimensional()) {
|
||||
|
||||
if(!Constr->isDriving) {
|
||||
FCMD_OBJ_CMD2("setDriving(%i,%s)", getObject(),id,"True");
|
||||
Gui::cmdAppObjectArgs(getObject(), "setDriving(%i,%s)", id, "True");
|
||||
}
|
||||
|
||||
// Coin's SoIdleSensor causes problems on some platform while Qt seems to work properly (#0001517)
|
||||
@@ -6431,7 +6429,7 @@ bool ViewProviderSketch::onDelete(const std::vector<std::string> &subList)
|
||||
|
||||
for (rit = delConstraints.rbegin(); rit != delConstraints.rend(); ++rit) {
|
||||
try {
|
||||
FCMD_OBJ_CMD2("delConstraint(%i)" ,getObject(), *rit);
|
||||
Gui::cmdAppObjectArgs(getObject(), "delConstraint(%i)", *rit);
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
@@ -6454,7 +6452,7 @@ bool ViewProviderSketch::onDelete(const std::vector<std::string> &subList)
|
||||
if (((*it)->Type == Sketcher::Coincident) && (((*it)->First == GeoId && (*it)->FirstPos == PosId) ||
|
||||
((*it)->Second == GeoId && (*it)->SecondPos == PosId)) ) {
|
||||
try {
|
||||
FCMD_OBJ_CMD2("delConstraintOnPoint(%i,%i)" ,getObject(), GeoId, (int)PosId);
|
||||
Gui::cmdAppObjectArgs(getObject(), "delConstraintOnPoint(%i,%i)", GeoId, (int)PosId);
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
@@ -6467,7 +6465,7 @@ bool ViewProviderSketch::onDelete(const std::vector<std::string> &subList)
|
||||
|
||||
for (rit = delInternalGeometries.rbegin(); rit != delInternalGeometries.rend(); ++rit) {
|
||||
try {
|
||||
FCMD_OBJ_CMD2("delGeometry(%i)" ,getObject(), *rit);
|
||||
Gui::cmdAppObjectArgs(getObject(), "delGeometry(%i)", *rit);
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
@@ -6476,7 +6474,7 @@ bool ViewProviderSketch::onDelete(const std::vector<std::string> &subList)
|
||||
|
||||
for (rit = delExternalGeometries.rbegin(); rit != delExternalGeometries.rend(); ++rit) {
|
||||
try {
|
||||
FCMD_OBJ_CMD2("delExternal(%i)",getObject(), *rit);
|
||||
Gui::cmdAppObjectArgs(getObject(), "delExternal(%i)", *rit);
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
|
||||
Reference in New Issue
Block a user