Merge branch 'master' of git://free-cad.git.sourceforge.net/gitroot/free-cad/free-cad

This commit is contained in:
jrheinlaender 2013-01-06 12:09:13 +04:30
commit 26735ef19b
38 changed files with 271 additions and 148 deletions

View File

@ -182,12 +182,14 @@ PyObject* DocumentPy::removeObject(PyObject *args)
PyObject* DocumentPy::copyObject(PyObject *args) PyObject* DocumentPy::copyObject(PyObject *args)
{ {
PyObject *obj, *rec=0, *keep=0; PyObject *obj, *rec=Py_False, *keep=Py_False;
if (!PyArg_ParseTuple(args, "O!|O!O!",&(DocumentObjectPy::Type),&obj,&PyBool_Type,&rec,&PyBool_Type,&keep)) if (!PyArg_ParseTuple(args, "O!|O!O!",&(DocumentObjectPy::Type),&obj,&PyBool_Type,&rec,&PyBool_Type,&keep))
return NULL; // NULL triggers exception return NULL; // NULL triggers exception
DocumentObjectPy* docObj = static_cast<DocumentObjectPy*>(obj); DocumentObjectPy* docObj = static_cast<DocumentObjectPy*>(obj);
DocumentObject* copy = getDocumentPtr()->copyObject(docObj->getDocumentObjectPtr(), rec==Py_True, keep==Py_True); DocumentObject* copy = getDocumentPtr()->copyObject(docObj->getDocumentObjectPtr(),
PyObject_IsTrue(rec) ? true : false,
PyObject_IsTrue(keep)? true : false);
if (copy) { if (copy) {
return copy->getPyObject(); return copy->getPyObject();
} }
@ -199,12 +201,12 @@ PyObject* DocumentPy::copyObject(PyObject *args)
PyObject* DocumentPy::moveObject(PyObject *args) PyObject* DocumentPy::moveObject(PyObject *args)
{ {
PyObject *obj, *rec=0; PyObject *obj, *rec=Py_False;
if (!PyArg_ParseTuple(args, "O!|O!",&(DocumentObjectPy::Type),&obj,&PyBool_Type,&rec)) if (!PyArg_ParseTuple(args, "O!|O!",&(DocumentObjectPy::Type),&obj,&PyBool_Type,&rec))
return NULL; // NULL triggers exception return NULL; // NULL triggers exception
DocumentObjectPy* docObj = static_cast<DocumentObjectPy*>(obj); DocumentObjectPy* docObj = static_cast<DocumentObjectPy*>(obj);
DocumentObject* move = getDocumentPtr()->moveObject(docObj->getDocumentObjectPtr(), rec==Py_True); DocumentObject* move = getDocumentPtr()->moveObject(docObj->getDocumentObjectPtr(), PyObject_IsTrue(rec) ? true : false);
if (move) { if (move) {
return move->getPyObject(); return move->getPyObject();
} }
@ -309,36 +311,36 @@ PyObject* DocumentPy::findObjects(PyObject *args)
char *sType="App::DocumentObject", *sName=0; char *sType="App::DocumentObject", *sName=0;
if (!PyArg_ParseTuple(args, "|ss",&sType, &sName)) // convert args: Python->C if (!PyArg_ParseTuple(args, "|ss",&sType, &sName)) // convert args: Python->C
return NULL; // NULL triggers exception return NULL; // NULL triggers exception
Base::Type type = Base::Type::fromName(sType); Base::Type type = Base::Type::fromName(sType);
if (type == Base::Type::badType()) { if (type == Base::Type::badType()) {
PyErr_Format(PyExc_Exception, "'%s' is not a valid type", sType); PyErr_Format(PyExc_Exception, "'%s' is not a valid type", sType);
return NULL; return NULL;
} }
if (!type.isDerivedFrom(App::DocumentObject::getClassTypeId())) { if (!type.isDerivedFrom(App::DocumentObject::getClassTypeId())) {
PyErr_Format(PyExc_Exception, "Type '%s' does not inherit from 'App::DocumentObject'", sType); PyErr_Format(PyExc_Exception, "Type '%s' does not inherit from 'App::DocumentObject'", sType);
return NULL; return NULL;
} }
std::vector<DocumentObject*> res; std::vector<DocumentObject*> res;
if (sName) { if (sName) {
try { try {
res = getDocumentPtr()->findObjects(type, sName); res = getDocumentPtr()->findObjects(type, sName);
} }
catch (const boost::regex_error& e) { catch (const boost::regex_error& e) {
PyErr_SetString(PyExc_RuntimeError, e.what()); PyErr_SetString(PyExc_RuntimeError, e.what());
return 0; return 0;
} }
} }
else { else {
res = getDocumentPtr()->getObjectsOfType(type); res = getDocumentPtr()->getObjectsOfType(type);
} }
Py_ssize_t index=0; Py_ssize_t index=0;
PyObject* list = PyList_New((Py_ssize_t)res.size()); PyObject* list = PyList_New((Py_ssize_t)res.size());
for (std::vector<DocumentObject*>::const_iterator It = res.begin();It != res.end();++It, index++) for (std::vector<DocumentObject*>::const_iterator It = res.begin();It != res.end();++It, index++)
PyList_SetItem(list, index, (*It)->getPyObject()); PyList_SetItem(list, index, (*It)->getPyObject());
return list; return list;
} }

View File

@ -51,7 +51,8 @@ PyObject* FeaturePythonPy::addProperty(PyObject *args)
return NULL; // NULL triggers exception return NULL; // NULL triggers exception
Property* prop=0; Property* prop=0;
prop = getFeaturePythonPtr()->addDynamicProperty(sType,sName,sGroup,sDoc,attr,ro==Py_True,hd==Py_True); prop = getFeaturePythonPtr()->addDynamicProperty(sType,sName,sGroup,sDoc,attr,
PyObject_IsTrue(ro) ? true : false, PyObject_IsTrue(hd) ? true : false);
if (!prop) { if (!prop) {
std::stringstream str; std::stringstream str;

View File

@ -1347,7 +1347,7 @@ PyObject *PropertyBool::getPyObject(void)
void PropertyBool::setPyObject(PyObject *value) void PropertyBool::setPyObject(PyObject *value)
{ {
if (PyBool_Check(value)) if (PyBool_Check(value))
setValue(value == Py_True); setValue(PyObject_IsTrue(value)!=0);
else if(PyInt_Check(value)) else if(PyInt_Check(value))
setValue(PyInt_AsLong(value)!=0); setValue(PyInt_AsLong(value)!=0);
else { else {

View File

@ -97,25 +97,26 @@
#include <xercesc/sax2/SAX2XMLReader.hpp> #include <xercesc/sax2/SAX2XMLReader.hpp>
#include <xercesc/sax2/XMLReaderFactory.hpp> #include <xercesc/sax2/XMLReaderFactory.hpp>
#include <boost/filesystem/path.hpp> #include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp> #include <boost/filesystem/operations.hpp>
#include <boost/filesystem/exception.hpp> #include <boost/filesystem/exception.hpp>
#include <boost/regex.hpp> #include <boost/regex.hpp>
// QtCore // QtCore
#include <QBuffer> #include <QBuffer>
#include <QByteArray> #include <QByteArray>
#include <QCoreApplication> #include <QCoreApplication>
#include <QEvent> #include <QEvent>
#include <QIODevice> #include <QIODevice>
#include <QDataStream> #include <QDataStream>
#include <QWriteLocker> #include <QWriteLocker>
#include <QReadLocker> #include <QReadLocker>
#include <QReadWriteLock> #include <QReadWriteLock>
#include <QMutex> #include <QMutex>
#include <QMutexLocker> #include <QMutexLocker>
#include <QUuid>
#endif //_PreComp_ #endif //_PreComp_
#endif // BASE_PRECOMPILED_H #endif // BASE_PRECOMPILED_H

View File

@ -26,6 +26,8 @@
#ifndef _PreComp_ #ifndef _PreComp_
# ifdef FC_OS_WIN32 # ifdef FC_OS_WIN32
# include <Rpc.h> # include <Rpc.h>
# else
# include <QUuid>
# endif # endif
#endif #endif
@ -63,7 +65,6 @@ Uuid::~Uuid()
//************************************************************************** //**************************************************************************
// Get the UUID // Get the UUID
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
std::string Uuid::CreateUuid(void) std::string Uuid::CreateUuid(void)
{ {
#ifdef FC_OS_WIN32 #ifdef FC_OS_WIN32
@ -82,6 +83,12 @@ std::string Uuid::CreateUuid(void)
/* convert it from rcp memory to our own */ /* convert it from rcp memory to our own */
//container = nssUTF8_Duplicate(uuidStr, NULL); //container = nssUTF8_Duplicate(uuidStr, NULL);
RpcStringFree(&uuidStr); RpcStringFree(&uuidStr);
#elif 1
std::string Uuid;
QString uuid = QUuid::createUuid().toString();
uuid = uuid.mid(1);
uuid.chop(1);
Uuid = (const char*)uuid.toAscii();
#else #else
// use Python's implemententation // use Python's implemententation
std::string Uuid; std::string Uuid;
@ -100,3 +107,4 @@ std::string Uuid::CreateUuid(void)
#endif #endif
return Uuid; return Uuid;
} }

View File

@ -83,6 +83,9 @@ SbBool BlenderNavigationStyle::processSoEvent(const SoEvent * const ev)
// which influence the seek mode itself -- these are handled further // which influence the seek mode itself -- these are handled further
// up the inheritance hierarchy. // up the inheritance hierarchy.
if (this->isSeekMode()) { return inherited::processSoEvent(ev); } if (this->isSeekMode()) { return inherited::processSoEvent(ev); }
// Switch off viewing mode (Bug #0000911)
if (!this->isSeekMode() && this->isViewing())
this->setViewing(false); // by default disable viewing mode to render the scene
const SoType type(ev->getTypeId()); const SoType type(ev->getTypeId());

View File

@ -85,6 +85,7 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
// up the inheritance hierarchy. // up the inheritance hierarchy.
if (this->isSeekMode()) { return inherited::processSoEvent(ev); } if (this->isSeekMode()) { return inherited::processSoEvent(ev); }
#else #else
// Switch off viewing mode (Bug #0000911)
if (!this->isSeekMode() && this->isViewing()) if (!this->isSeekMode() && this->isViewing())
this->setViewing(false); // by default disable viewing mode to render the scene this->setViewing(false); // by default disable viewing mode to render the scene
#endif #endif

View File

@ -164,14 +164,16 @@ StdCmdMacroStartDebug::StdCmdMacroStartDebug()
void StdCmdMacroStartDebug::activated(int iMsg) void StdCmdMacroStartDebug::activated(int iMsg)
{ {
doCommand(Command::Gui,"Gui.SendMsgToActiveView(\"StartDebug\")"); PythonDebugger* dbg = Application::Instance->macroManager()->debugger();
if (!dbg->isRunning())
doCommand(Command::Gui,"Gui.SendMsgToActiveView(\"StartDebug\")");
else
dbg->stepRun();
} }
bool StdCmdMacroStartDebug::isActive(void) bool StdCmdMacroStartDebug::isActive(void)
{ {
static PythonDebugger* dbg = Application::Instance->macroManager()->debugger(); return getGuiApplication()->sendHasMsgToActiveView("StartDebug");
return (!dbg->isRunning() &&
getGuiApplication()->sendHasMsgToActiveView("StartDebug"));
} }
DEF_STD_CMD_A(StdCmdMacroStopDebug); DEF_STD_CMD_A(StdCmdMacroStopDebug);
@ -226,6 +228,32 @@ bool StdCmdMacroStepOver::isActive(void)
return dbg->isRunning(); return dbg->isRunning();
} }
DEF_STD_CMD_A(StdCmdMacroStepInto);
StdCmdMacroStepInto::StdCmdMacroStepInto()
: Command("Std_MacroStepInto")
{
sGroup = QT_TR_NOOP("Macro");
sMenuText = QT_TR_NOOP("Step into");
sToolTipText = QT_TR_NOOP("Step into");
//sWhatsThis = "Std_MacroStepOver";
sStatusTip = QT_TR_NOOP("Step into");
sPixmap = 0;
sAccel = "F11";
eType = 0;
}
void StdCmdMacroStepInto::activated(int iMsg)
{
Application::Instance->macroManager()->debugger()->stepInto();
}
bool StdCmdMacroStepInto::isActive(void)
{
static PythonDebugger* dbg = Application::Instance->macroManager()->debugger();
return dbg->isRunning();
}
DEF_STD_CMD_A(StdCmdToggleBreakpoint); DEF_STD_CMD_A(StdCmdToggleBreakpoint);
StdCmdToggleBreakpoint::StdCmdToggleBreakpoint() StdCmdToggleBreakpoint::StdCmdToggleBreakpoint()
@ -263,6 +291,7 @@ void CreateMacroCommands(void)
rcCmdMgr.addCommand(new StdCmdMacroStartDebug()); rcCmdMgr.addCommand(new StdCmdMacroStartDebug());
rcCmdMgr.addCommand(new StdCmdMacroStopDebug()); rcCmdMgr.addCommand(new StdCmdMacroStopDebug());
rcCmdMgr.addCommand(new StdCmdMacroStepOver()); rcCmdMgr.addCommand(new StdCmdMacroStepOver());
rcCmdMgr.addCommand(new StdCmdMacroStepInto());
rcCmdMgr.addCommand(new StdCmdToggleBreakpoint()); rcCmdMgr.addCommand(new StdCmdToggleBreakpoint());
} }

View File

@ -507,7 +507,7 @@ bool PythonEditorView::onMsg(const char* pMsg,const char** ppReturn)
return true; return true;
} }
else if (strcmp(pMsg,"StartDebug")==0) { else if (strcmp(pMsg,"StartDebug")==0) {
startDebug(); QTimer::singleShot(300, this, SLOT(startDebug()));
return true; return true;
} }
else if (strcmp(pMsg,"ToggleBreakpoint")==0) { else if (strcmp(pMsg,"ToggleBreakpoint")==0) {

View File

@ -83,6 +83,9 @@ SbBool InventorNavigationStyle::processSoEvent(const SoEvent * const ev)
// which influence the seek mode itself -- these are handled further // which influence the seek mode itself -- these are handled further
// up the inheritance hierarchy. // up the inheritance hierarchy.
if (this->isSeekMode()) { return inherited::processSoEvent(ev); } if (this->isSeekMode()) { return inherited::processSoEvent(ev); }
// Switch off viewing mode (Bug #0000911)
if (!this->isSeekMode() && this->isViewing())
this->setViewing(false); // by default disable viewing mode to render the scene
const SoType type(ev->getTypeId()); const SoType type(ev->getTypeId());

View File

@ -236,9 +236,10 @@ Py::Object PythonDebugStderr::repr()
Py::Object PythonDebugStderr::write(const Py::Tuple& args) Py::Object PythonDebugStderr::write(const Py::Tuple& args)
{ {
char *msg; char *msg;
PyObject* pObj; //PyObject* pObj;
//args contains a single parameter which is the string to write. //args contains a single parameter which is the string to write.
if (!PyArg_ParseTuple(args.ptr(), "Os:OutputDebugString", &pObj, &msg)) //if (!PyArg_ParseTuple(args.ptr(), "Os:OutputDebugString", &pObj, &msg))
if (!PyArg_ParseTuple(args.ptr(), "s:OutputDebugString", &msg))
throw Py::Exception(); throw Py::Exception();
if (strlen(msg) > 0) if (strlen(msg) > 0)
@ -248,6 +249,7 @@ Py::Object PythonDebugStderr::write(const Py::Tuple& args)
//send it to the debugger as well //send it to the debugger as well
//g_DebugSocket.SendMessage(eMSG_TRACE, msg); //g_DebugSocket.SendMessage(eMSG_TRACE, msg);
Base::Console().Error("%s", msg);
} }
return Py::None(); return Py::None();
@ -417,9 +419,42 @@ void PythonDebugger::runFile(const QString& fn)
{ {
try { try {
RunningState state(d->running); RunningState state(d->running);
Base::Interpreter().runFile((const char*)fn.toUtf8(), true); QByteArray pxFileName = fn.toUtf8();
#ifdef FC_OS_WIN32
Base::FileInfo fi((const char*)pxFileName);
FILE *fp = _wfopen(fi.toStdWString().c_str(),L"r");
#else
FILE *fp = fopen((const char*)pxFileName,"r");
#endif
if (!fp) return;
Base::PyGILStateLocker locker;
PyObject *module, *dict;
module = PyImport_AddModule("__main__");
dict = PyModule_GetDict(module);
dict = PyDict_Copy(dict);
if (PyDict_GetItemString(dict, "__file__") == NULL) {
PyObject *f = PyString_FromString((const char*)pxFileName);
if (f == NULL)
return;
if (PyDict_SetItemString(dict, "__file__", f) < 0) {
Py_DECREF(f);
return;
}
Py_DECREF(f);
}
PyObject *result = PyRun_File(fp, (const char*)pxFileName, Py_file_input, dict, dict);
fclose(fp);
Py_DECREF(dict);
if (!result)
PyErr_Print();
else
Py_DECREF(result);
} }
catch (const Base::PyException&) { catch (const Base::PyException&/* e*/) {
//PySys_WriteStderr("Exception: %s\n", e.what());
} }
catch (...) { catch (...) {
Base::Console().Warning("Unknown exception thrown during macro debugging\n"); Base::Console().Warning("Unknown exception thrown during macro debugging\n");
@ -474,6 +509,16 @@ void PythonDebugger::stepOver()
signalNextStep(); signalNextStep();
} }
void PythonDebugger::stepInto()
{
signalNextStep();
}
void PythonDebugger::stepRun()
{
signalNextStep();
}
void PythonDebugger::showDebugMarker(const QString& fn, int line) void PythonDebugger::showDebugMarker(const QString& fn, int line)
{ {
PythonEditorView* edit = 0; PythonEditorView* edit = 0;
@ -524,7 +569,7 @@ int PythonDebugger::tracer_callback(PyObject *obj, PyFrameObject *frame, int wha
//int no; //int no;
//no = frame->f_tstate->recursion_depth; //no = frame->f_tstate->recursion_depth;
//char* name = PyString_AsString(frame->f_code->co_name); //std::string funcname = PyString_AsString(frame->f_code->co_name);
QString file = QString::fromUtf8(PyString_AsString(frame->f_code->co_filename)); QString file = QString::fromUtf8(PyString_AsString(frame->f_code->co_filename));
switch (what) { switch (what) {
case PyTrace_CALL: case PyTrace_CALL:

View File

@ -169,6 +169,8 @@ public:
bool stop(); bool stop();
void tryStop(); void tryStop();
void stepOver(); void stepOver();
void stepInto();
void stepRun();
void showDebugMarker(const QString&, int line); void showDebugMarker(const QString&, int line);
void hideDebugMarker(const QString&); void hideDebugMarker(const QString&);

View File

@ -45,7 +45,6 @@ public:
PythonEditor(QWidget *parent = 0); PythonEditor(QWidget *parent = 0);
~PythonEditor(); ~PythonEditor();
void startDebug();
void toggleBreakpoint(); void toggleBreakpoint();
void showDebugMarker(int line); void showDebugMarker(int line);
void hideDebugMarker(); void hideDebugMarker();
@ -62,6 +61,7 @@ public Q_SLOTS:
*/ */
void onUncomment(); void onUncomment();
void setFileName(const QString&); void setFileName(const QString&);
void startDebug();
protected: protected:
/** Pops up the context menu with some extensions */ /** Pops up the context menu with some extensions */

View File

@ -1,3 +1,24 @@
/***************************************************************************
* Copyright (c) 2009 Juergen Riegel (FreeCAD@juergen-riegel.net) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h" #include "PreCompiled.h"

View File

@ -105,8 +105,6 @@ SoFCUnifiedSelection::SoFCUnifiedSelection() : viewer(0)
SO_NODE_SET_SF_ENUM_TYPE (highlightMode, HighlightModes); SO_NODE_SET_SF_ENUM_TYPE (highlightMode, HighlightModes);
highlighted = FALSE; highlighted = FALSE;
bShift = FALSE;
bCtrl = FALSE;
} }
/*! /*!
@ -414,22 +412,6 @@ SoFCUnifiedSelection::handleEvent(SoHandleEventAction * action)
} }
} }
} }
// key press events
else if (event->isOfType(SoKeyboardEvent ::getClassTypeId())) {
SoKeyboardEvent * const e = (SoKeyboardEvent *) event;
if (SoKeyboardEvent::isKeyPressEvent(e,SoKeyboardEvent::LEFT_SHIFT) ||
SoKeyboardEvent::isKeyPressEvent(e,SoKeyboardEvent::RIGHT_SHIFT) )
bShift = true;
if (SoKeyboardEvent::isKeyReleaseEvent(e,SoKeyboardEvent::LEFT_SHIFT) ||
SoKeyboardEvent::isKeyReleaseEvent(e,SoKeyboardEvent::RIGHT_SHIFT) )
bShift = false;
if (SoKeyboardEvent::isKeyPressEvent(e,SoKeyboardEvent::LEFT_CONTROL) ||
SoKeyboardEvent::isKeyPressEvent(e,SoKeyboardEvent::RIGHT_CONTROL) )
bCtrl = true;
if (SoKeyboardEvent::isKeyReleaseEvent(e,SoKeyboardEvent::LEFT_CONTROL) ||
SoKeyboardEvent::isKeyReleaseEvent(e,SoKeyboardEvent::RIGHT_CONTROL) )
bCtrl = false;
}
// mouse press events for (de)selection // mouse press events for (de)selection
else if (event->isOfType(SoMouseButtonEvent::getClassTypeId()) && else if (event->isOfType(SoMouseButtonEvent::getClassTypeId()) &&
selectionMode.getValue() == SoFCUnifiedSelection::ON) { selectionMode.getValue() == SoFCUnifiedSelection::ON) {
@ -449,7 +431,7 @@ SoFCUnifiedSelection::handleEvent(SoHandleEventAction * action)
std::string documentName = vpd->getObject()->getDocument()->getName(); std::string documentName = vpd->getObject()->getDocument()->getName();
std::string objectName = vpd->getObject()->getNameInDocument(); std::string objectName = vpd->getObject()->getNameInDocument();
std::string subElementName = vpd->getElement(pp ? pp->getDetail() : 0); std::string subElementName = vpd->getElement(pp ? pp->getDetail() : 0);
if (bCtrl) { if (event->wasCtrlDown()) {
if (Gui::Selection().isSelected(documentName.c_str() if (Gui::Selection().isSelected(documentName.c_str()
,objectName.c_str() ,objectName.c_str()
,subElementName.c_str())) { ,subElementName.c_str())) {

View File

@ -107,9 +107,6 @@ private:
SbBool highlighted; SbBool highlighted;
SoColorPacker colorpacker; SoColorPacker colorpacker;
SbBool bShift;
SbBool bCtrl;
}; };
/** /**

View File

@ -83,6 +83,9 @@ SbBool TouchpadNavigationStyle::processSoEvent(const SoEvent * const ev)
// which influence the seek mode itself -- these are handled further // which influence the seek mode itself -- these are handled further
// up the inheritance hierarchy. // up the inheritance hierarchy.
if (this->isSeekMode()) { return inherited::processSoEvent(ev); } if (this->isSeekMode()) { return inherited::processSoEvent(ev); }
// Switch off viewing mode (Bug #0000911)
if (!this->isSeekMode() && this->isViewing())
this->setViewing(false); // by default disable viewing mode to render the scene
const SoType type(ev->getTypeId()); const SoType type(ev->getTypeId());

View File

@ -525,9 +525,14 @@ void View3DInventorViewer::savePicture(const char* filename, int w, int h,
// if we use transparency then we must not set a background color // if we use transparency then we must not set a background color
switch(eBackgroundType){ switch(eBackgroundType){
case Current: case Current:
useBackground = true; if (backgroundroot->findChild(pcBackGround) == -1) {
cb = new SoCallback; renderer.setBackgroundColor(this->getBackgroundColor());
cb->setCallback(clearBuffer); }
else {
useBackground = true;
cb = new SoCallback;
cb->setCallback(clearBuffer);
}
break; break;
case White: case White:
renderer.setBackgroundColor( SbColor(1.0, 1.0, 1.0) ); renderer.setBackgroundColor( SbColor(1.0, 1.0, 1.0) );
@ -595,9 +600,14 @@ void View3DInventorViewer::savePicture(int w, int h, int eBackgroundType, QImage
// if we use transparency then we must not set a background color // if we use transparency then we must not set a background color
switch(eBackgroundType){ switch(eBackgroundType){
case Current: case Current:
useBackground = true; if (backgroundroot->findChild(pcBackGround) == -1) {
cb = new SoCallback; renderer.setBackgroundColor(this->getBackgroundColor());
cb->setCallback(clearBuffer); }
else {
useBackground = true;
cb = new SoCallback;
cb->setCallback(clearBuffer);
}
break; break;
case White: case White:
renderer.setBackgroundColor( SbColor(1.0, 1.0, 1.0) ); renderer.setBackgroundColor( SbColor(1.0, 1.0, 1.0) );

View File

@ -464,7 +464,7 @@ Py::Object View3DInventorPy::viewRotateRight(const Py::Tuple& args)
Py::Object View3DInventorPy::setCameraOrientation(const Py::Tuple& args) Py::Object View3DInventorPy::setCameraOrientation(const Py::Tuple& args)
{ {
PyObject* o; PyObject* o;
PyObject* m=0; PyObject* m=Py_False;
if (!PyArg_ParseTuple(args.ptr(), "O!|O!", &PyTuple_Type, &o, &PyBool_Type, &m)) if (!PyArg_ParseTuple(args.ptr(), "O!|O!", &PyTuple_Type, &o, &PyBool_Type, &m))
throw Py::Exception(); throw Py::Exception();
@ -474,7 +474,7 @@ Py::Object View3DInventorPy::setCameraOrientation(const Py::Tuple& args)
float q1 = (float)Py::Float(tuple[1]); float q1 = (float)Py::Float(tuple[1]);
float q2 = (float)Py::Float(tuple[2]); float q2 = (float)Py::Float(tuple[2]);
float q3 = (float)Py::Float(tuple[3]); float q3 = (float)Py::Float(tuple[3]);
_view->getViewer()->setCameraOrientation(SbRotation(q0, q1, q2, q3), m==Py_True); _view->getViewer()->setCameraOrientation(SbRotation(q0, q1, q2, q3), PyObject_IsTrue(m));
} }
catch (const Base::Exception& e) { catch (const Base::Exception& e) {
throw Py::Exception(e.what()); throw Py::Exception(e.what());

View File

@ -290,6 +290,11 @@ void ViewProviderGeometryObject::unsetEdit(int ModNum)
// The manipulator has a sensor as user data and this sensor contains the view provider // The manipulator has a sensor as user data and this sensor contains the view provider
SoCenterballManip * manip = static_cast<SoCenterballManip*>(path->getTail()); SoCenterballManip * manip = static_cast<SoCenterballManip*>(path->getTail());
SoNodeSensor* sensor = reinterpret_cast<SoNodeSensor*>(manip->getUserData()); SoNodeSensor* sensor = reinterpret_cast<SoNodeSensor*>(manip->getUserData());
// #0000939: Pressing Escape while pivoting a box crashes
// #0000942: Crash when 2xdouble-click on part
SoDragger* dragger = manip->getDragger();
if (dragger && dragger->getHandleEventAction())
dragger->grabEventsCleanup();
// detach sensor // detach sensor
sensor->detach(); sensor->detach();

View File

@ -73,7 +73,8 @@ PyObject* ViewProviderPythonFeaturePy::addProperty(PyObject *args)
return NULL; // NULL triggers exception return NULL; // NULL triggers exception
App::Property* prop=0; App::Property* prop=0;
prop = getViewProviderPythonFeaturePtr()->addDynamicProperty(sType,sName,sGroup,sDoc,attr,ro==Py_True,hd==Py_True); prop = getViewProviderPythonFeaturePtr()->addDynamicProperty(sType,sName,sGroup,sDoc,attr,
PyObject_IsTrue(ro) ? true : false, PyObject_IsTrue(hd) ? true : false);
if (!prop) { if (!prop) {
std::stringstream str; std::stringstream str;

View File

@ -499,7 +499,8 @@ MenuItem* StdWorkbench::setupMenuBar() const
macro->setCommand("&Macro"); macro->setCommand("&Macro");
*macro << "Std_DlgMacroRecord" << "Std_MacroStopRecord" << "Std_DlgMacroExecute" *macro << "Std_DlgMacroRecord" << "Std_MacroStopRecord" << "Std_DlgMacroExecute"
<< "Separator" << "Std_DlgMacroExecuteDirect" << "Std_MacroStartDebug" << "Separator" << "Std_DlgMacroExecuteDirect" << "Std_MacroStartDebug"
<< "Std_MacroStopDebug" << "Std_MacroStepOver" << "Std_ToggleBreakpoint"; << "Std_MacroStopDebug" << "Std_MacroStepOver" << "Std_MacroStepInto"
<< "Std_ToggleBreakpoint";
// Windows // Windows
MenuItem* wnd = new MenuItem( menuBar ); MenuItem* wnd = new MenuItem( menuBar );

View File

@ -59,8 +59,8 @@ public:
} }
void run() void run()
{ {
int argc = 0; static int argc = 0;
char **argv = {0}; static char **argv = {0};
QApplication app(argc, argv); QApplication app(argc, argv);
if (setupMainWindow()) { if (setupMainWindow()) {
app.exec(); app.exec();
@ -82,29 +82,33 @@ FilterProc(int nCode, WPARAM wParam, LPARAM lParam) {
static PyObject * static PyObject *
FreeCADGui_showMainWindow(PyObject * /*self*/, PyObject *args) FreeCADGui_showMainWindow(PyObject * /*self*/, PyObject *args)
{ {
if (!PyArg_ParseTuple(args, "")) PyObject* inThread = Py_False;
if (!PyArg_ParseTuple(args, "|O!", &PyBool_Type, &inThread))
return NULL; return NULL;
static GUIThread* thr = 0; static GUIThread* thr = 0;
if (!qApp) { if (!qApp) {
#if 0 if (PyObject_IsTrue(inThread)) {
if (!thr) thr = new GUIThread(); if (!thr) thr = new GUIThread();
thr->start(); thr->start();
#elif defined(Q_OS_WIN) }
static int argc = 0; else {
static char **argv = {0}; #if defined(Q_OS_WIN)
(void)new QApplication(argc, argv); static int argc = 0;
// When QApplication is constructed static char **argv = {0};
hhook = SetWindowsHookEx(WH_GETMESSAGE, (void)new QApplication(argc, argv);
FilterProc, 0, GetCurrentThreadId()); // When QApplication is constructed
hhook = SetWindowsHookEx(WH_GETMESSAGE,
FilterProc, 0, GetCurrentThreadId());
#elif !defined(QT_NO_GLIB) #elif !defined(QT_NO_GLIB)
static int argc = 0; static int argc = 0;
static char **argv = {0}; static char **argv = {0};
(void)new QApplication(argc, argv); (void)new QApplication(argc, argv);
#else #else
PyErr_SetString(PyExc_RuntimeError, "Must construct a QApplication before a QPaintDevice\n"); PyErr_SetString(PyExc_RuntimeError, "Must construct a QApplication before a QPaintDevice\n");
return NULL; return NULL;
#endif #endif
}
} }
else if (!qobject_cast<QApplication*>(qApp)) { else if (!qobject_cast<QApplication*>(qApp)) {
PyErr_SetString(PyExc_RuntimeError, "Cannot create widget when no GUI is being used\n"); PyErr_SetString(PyExc_RuntimeError, "Cannot create widget when no GUI is being used\n");
@ -240,6 +244,7 @@ QWidget* setupMainWindow()
} }
if (!Gui::MainWindow::getInstance()) { if (!Gui::MainWindow::getInstance()) {
Base::PyGILStateLocker lock;
PyObject* input = PySys_GetObject("stdin"); PyObject* input = PySys_GetObject("stdin");
Gui::MainWindow *mw = new Gui::MainWindow(); Gui::MainWindow *mw = new Gui::MainWindow();
QIcon icon = qApp->windowIcon(); QIcon icon = qApp->windowIcon();

View File

@ -65,6 +65,8 @@ Gui::MenuItem* Workbench::setupMenuBar() const
*part << "Drawing_Annotation"; *part << "Drawing_Annotation";
*part << "Drawing_Clip"; *part << "Drawing_Clip";
*part << "Drawing_ExportPage"; *part << "Drawing_ExportPage";
*part << "Separator";
*part << "Drawing_ProjectShape";
return root; return root;
} }

View File

@ -49,7 +49,8 @@ PyObject* FeaturePythonPy::addProperty(PyObject *args)
return NULL; // NULL triggers exception return NULL; // NULL triggers exception
App::Property* prop=0; App::Property* prop=0;
prop = getFeaturePtr()->addDynamicProperty(sType,sName,sGroup,sDoc,attr,ro==Py_True,hd==Py_True); prop = getFeaturePtr()->addDynamicProperty(sType,sName,sGroup,sDoc,attr,
PyObject_IsTrue(ro) ? true : false, PyObject_IsTrue(hd) ? true : false);
if (!prop) { if (!prop) {
std::stringstream str; std::stringstream str;

View File

@ -127,9 +127,9 @@ PyObject* MeshPy::copy(PyObject *args)
{ {
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ""))
return NULL; return NULL;
const MeshCore::MeshKernel& kernel = getMeshObjectPtr()->getKernel(); const MeshCore::MeshKernel& kernel = getMeshObjectPtr()->getKernel();
return new MeshPy(new MeshObject(kernel)); return new MeshPy(new MeshObject(kernel));
} }
PyObject* MeshPy::read(PyObject *args) PyObject* MeshPy::read(PyObject *args)
@ -238,7 +238,7 @@ PyObject* MeshPy::offsetSpecial(PyObject *args)
PyObject* MeshPy::crossSections(PyObject *args) PyObject* MeshPy::crossSections(PyObject *args)
{ {
PyObject *obj; PyObject *obj;
PyObject *poly=0; PyObject *poly=Py_False;
float min_eps = 1.0e-2f; float min_eps = 1.0e-2f;
if (!PyArg_ParseTuple(args, "O!|fO!", &PyList_Type, &obj, &min_eps, &PyBool_Type, &poly)) if (!PyArg_ParseTuple(args, "O!|fO!", &PyList_Type, &obj, &min_eps, &PyBool_Type, &poly))
return 0; return 0;
@ -278,7 +278,7 @@ PyObject* MeshPy::crossSections(PyObject *args)
} }
std::vector<MeshObject::TPolylines> sections; std::vector<MeshObject::TPolylines> sections;
getMeshObjectPtr()->crossSections(csPlanes, sections, min_eps, (poly == Py_True)); getMeshObjectPtr()->crossSections(csPlanes, sections, min_eps, PyObject_IsTrue(poly) ? true : false);
// convert to Python objects // convert to Python objects
Py::List crossSections; Py::List crossSections;

View File

@ -28,7 +28,8 @@ set(all_files ${OpenSCAD_SRCS} ${ply_SRCS})
ADD_CUSTOM_TARGET(OpenSCAD ALL ADD_CUSTOM_TARGET(OpenSCAD ALL
SOURCES ${allfiles} SOURCES ${allfiles}
) )
fc_copy_sources(OpenSCAD "${CMAKE_BINARY_DIR}/Mod/OpenSCAD" ${all_files})
fc_copy_sources(OpenSCAD "${CMAKE_BINARY_DIR}/Mod/OpenSCAD" ${all_files})
INSTALL( INSTALL(
FILES FILES

View File

@ -1147,8 +1147,8 @@ static PyObject * makeLoft(PyObject *self, PyObject *args)
return new BSplineSurfacePy(new GeomBSplineSurface(aRes)); return new BSplineSurfacePy(new GeomBSplineSurface(aRes));
#else #else
PyObject *pcObj; PyObject *pcObj;
PyObject *psolid=0; PyObject *psolid=Py_False;
PyObject *pruled=0; PyObject *pruled=Py_False;
if (!PyArg_ParseTuple(args, "O!|O!O!", &(PyList_Type), &pcObj, if (!PyArg_ParseTuple(args, "O!|O!O!", &(PyList_Type), &pcObj,
&(PyBool_Type), &psolid, &(PyBool_Type), &psolid,
&(PyBool_Type), &pruled)) &(PyBool_Type), &pruled))
@ -1166,8 +1166,8 @@ static PyObject * makeLoft(PyObject *self, PyObject *args)
} }
TopoShape myShape; TopoShape myShape;
Standard_Boolean anIsSolid = (psolid == Py_True) ? Standard_True : Standard_False; Standard_Boolean anIsSolid = PyObject_IsTrue(psolid) ? Standard_True : Standard_False;
Standard_Boolean anIsRuled = (pruled == Py_True) ? Standard_True : Standard_False; Standard_Boolean anIsRuled = PyObject_IsTrue(pruled) ? Standard_True : Standard_False;
TopoDS_Shape aResult = myShape.makeLoft(profiles, anIsSolid, anIsRuled); TopoDS_Shape aResult = myShape.makeLoft(profiles, anIsSolid, anIsRuled);
return new TopoShapePy(new TopoShape(aResult)); return new TopoShapePy(new TopoShape(aResult));
} }

View File

@ -73,7 +73,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setFrenetMode(PyObject *args)
PyObject *obj; PyObject *obj;
if (!PyArg_ParseTuple(args, "O!",&PyBool_Type,&obj)) if (!PyArg_ParseTuple(args, "O!",&PyBool_Type,&obj))
return 0; return 0;
this->getBRepOffsetAPI_MakePipeShellPtr()->SetMode(obj==Py_True); this->getBRepOffsetAPI_MakePipeShellPtr()->SetMode(PyObject_IsTrue(obj) ? Standard_True : Standard_False);
Py_Return; Py_Return;
} }
@ -121,19 +121,19 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setAuxiliarySpine(PyObject *args)
PyErr_SetString(PyExc_TypeError, "spine is not a wire"); PyErr_SetString(PyExc_TypeError, "spine is not a wire");
return 0; return 0;
} }
this->getBRepOffsetAPI_MakePipeShellPtr()->SetMode(TopoDS::Wire(s), curv==Py_True, keep==Py_True); this->getBRepOffsetAPI_MakePipeShellPtr()->SetMode(TopoDS::Wire(s), PyObject_IsTrue(curv), PyObject_IsTrue(keep));
Py_Return; Py_Return;
} }
PyObject* BRepOffsetAPI_MakePipeShellPy::add(PyObject *args) PyObject* BRepOffsetAPI_MakePipeShellPy::add(PyObject *args)
{ {
PyObject *prof, *curv=0, *keep=0; PyObject *prof, *curv=Py_False, *keep=Py_False;
if (!PyArg_ParseTuple(args, "O!|O!O!",&Part::TopoShapePy::Type,&prof if (!PyArg_ParseTuple(args, "O!|O!O!",&Part::TopoShapePy::Type,&prof
,&PyBool_Type,&curv ,&PyBool_Type,&curv
,&PyBool_Type,&keep)) ,&PyBool_Type,&keep))
return 0; return 0;
const TopoDS_Shape& s = static_cast<Part::TopoShapePy*>(prof)->getTopoShapePtr()->_Shape; const TopoDS_Shape& s = static_cast<Part::TopoShapePy*>(prof)->getTopoShapePtr()->_Shape;
this->getBRepOffsetAPI_MakePipeShellPtr()->Add(s, curv==Py_True, keep==Py_True); this->getBRepOffsetAPI_MakePipeShellPtr()->Add(s, PyObject_IsTrue(curv), PyObject_IsTrue(keep));
Py_Return; Py_Return;
} }

View File

@ -183,7 +183,7 @@ PyObject* BSplineCurvePy::insertKnot(PyObject * args)
try { try {
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
(getGeometryPtr()->handle()); (getGeometryPtr()->handle());
curve->InsertKnot(U,M,tol,(add==Py_True)); curve->InsertKnot(U,M,tol,PyObject_IsTrue(add));
} }
catch (Standard_Failure) { catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught(); Handle_Standard_Failure e = Standard_Failure::Caught();
@ -223,7 +223,7 @@ PyObject* BSplineCurvePy::insertKnots(PyObject * args)
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
(getGeometryPtr()->handle()); (getGeometryPtr()->handle());
curve->InsertKnots(k,m,tol,(add==Py_True)); curve->InsertKnots(k,m,tol,PyObject_IsTrue(add));
Py_Return; Py_Return;
} }
catch (Standard_Failure) { catch (Standard_Failure) {
@ -755,7 +755,7 @@ PyObject* BSplineCurvePy::interpolate(PyObject *args)
Standard_Failure::Raise("not enough points given"); Standard_Failure::Raise("not enough points given");
} }
GeomAPI_Interpolate aBSplineInterpolation(interpolationPoints, (closed == Py_True), tol3d); GeomAPI_Interpolate aBSplineInterpolation(interpolationPoints, PyObject_IsTrue(closed), tol3d);
if (t1 && t2) { if (t1 && t2) {
Base::Vector3d v1 = Py::Vector(t1,false).toVector(); Base::Vector3d v1 = Py::Vector(t1,false).toVector();
Base::Vector3d v2 = Py::Vector(t1,false).toVector(); Base::Vector3d v2 = Py::Vector(t1,false).toVector();
@ -811,7 +811,7 @@ PyObject* BSplineCurvePy::buildFromPoles(PyObject *args)
mults.SetValue(1, degree+1); mults.SetValue(1, degree+1);
mults.SetValue(knots.Length(), degree+1); mults.SetValue(knots.Length(), degree+1);
Handle_Geom_BSplineCurve spline = new Geom_BSplineCurve(poles, knots, mults, degree, (closed == Py_True)); Handle_Geom_BSplineCurve spline = new Geom_BSplineCurve(poles, knots, mults, degree, PyObject_IsTrue(closed));
if (!spline.IsNull()) { if (!spline.IsNull()) {
this->getGeomBSplineCurvePtr()->setHandle(spline); this->getGeomBSplineCurvePtr()->setHandle(spline);
Py_Return; Py_Return;

View File

@ -293,7 +293,7 @@ PyObject* BSplineSurfacePy::insertUKnot(PyObject *args)
try { try {
Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast
(getGeometryPtr()->handle()); (getGeometryPtr()->handle());
surf->InsertUKnot(U,M,tol,(add==Py_True)); surf->InsertUKnot(U,M,tol,PyObject_IsTrue(add));
} }
catch (Standard_Failure) { catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught(); Handle_Standard_Failure e = Standard_Failure::Caught();
@ -333,7 +333,7 @@ PyObject* BSplineSurfacePy::insertUKnots(PyObject *args)
Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast
(getGeometryPtr()->handle()); (getGeometryPtr()->handle());
surf->InsertUKnots(k,m,tol,(add==Py_True)); surf->InsertUKnots(k,m,tol,PyObject_IsTrue(add));
Py_Return; Py_Return;
} }
catch (Standard_Failure) { catch (Standard_Failure) {
@ -356,7 +356,7 @@ PyObject* BSplineSurfacePy::insertVKnot(PyObject *args)
try { try {
Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast
(getGeometryPtr()->handle()); (getGeometryPtr()->handle());
surf->InsertVKnot(V,M,tol,(add==Py_True)); surf->InsertVKnot(V,M,tol,PyObject_IsTrue(add));
} }
catch (Standard_Failure) { catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught(); Handle_Standard_Failure e = Standard_Failure::Caught();
@ -396,7 +396,7 @@ PyObject* BSplineSurfacePy::insertVKnots(PyObject *args)
Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast
(getGeometryPtr()->handle()); (getGeometryPtr()->handle());
surf->InsertVKnots(k,m,tol,(add==Py_True)); surf->InsertVKnots(k,m,tol,PyObject_IsTrue(add));
Py_Return; Py_Return;
} }
catch (Standard_Failure) { catch (Standard_Failure) {

View File

@ -47,7 +47,8 @@ PyObject* FeaturePythonPy::addProperty(PyObject *args)
return NULL; // NULL triggers exception return NULL; // NULL triggers exception
App::Property* prop=0; App::Property* prop=0;
prop = getFeaturePythonPtr()->addDynamicProperty(sType,sName,sGroup,sDoc,attr,ro==Py_True,hd==Py_True); prop = getFeaturePythonPtr()->addDynamicProperty(sType,sName,sGroup,sDoc,attr,
PyObject_IsTrue(ro) ? true : false, PyObject_IsTrue(hd) ? true : false);
if (!prop) { if (!prop) {
std::stringstream str; std::stringstream str;

View File

@ -59,18 +59,18 @@ int RectangularTrimmedSurfacePy::PyInit(PyObject* args, PyObject* /*kwd*/)
getGeomTrimmedSurfacePtr()->setHandle(new Geom_RectangularTrimmedSurface( getGeomTrimmedSurfacePtr()->setHandle(new Geom_RectangularTrimmedSurface(
Handle_Geom_Surface::DownCast(static_cast<GeometrySurfacePy*>(surf)-> Handle_Geom_Surface::DownCast(static_cast<GeometrySurfacePy*>(surf)->
getGeomSurfacePtr()->handle()), getGeomSurfacePtr()->handle()),
u1, u2, v1, v2, (usense==Py_True), (vsense==Py_True) u1, u2, v1, v2, PyObject_IsTrue(usense), PyObject_IsTrue(vsense)
)); ));
return 0; return 0;
} }
PyErr_Clear(); PyErr_Clear();
double param1,param2; double param1,param2;
PyObject *utrim=0, *sense=Py_True; PyObject *utrim=Py_False, *sense=Py_True;
if (PyArg_ParseTuple(args, "O!ddO!|O!",&(Part::GeometrySurfacePy::Type),&surf, if (PyArg_ParseTuple(args, "O!ddO!|O!",&(Part::GeometrySurfacePy::Type),&surf,
&param1,&param2,&PyBool_Type,&utrim,&PyBool_Type,&sense)) { &param1,&param2,&PyBool_Type,&utrim,&PyBool_Type,&sense)) {
Standard_Boolean UTrim = (utrim==Py_True); Standard_Boolean UTrim = PyObject_IsTrue(utrim);
Standard_Boolean Sense = (sense==Py_True); Standard_Boolean Sense = PyObject_IsTrue(sense);
getGeomTrimmedSurfacePtr()->setHandle(new Geom_RectangularTrimmedSurface( getGeomTrimmedSurfacePtr()->setHandle(new Geom_RectangularTrimmedSurface(
Handle_Geom_Surface::DownCast(static_cast<GeometrySurfacePy*>(surf)-> Handle_Geom_Surface::DownCast(static_cast<GeometrySurfacePy*>(surf)->
getGeomSurfacePtr()->handle()), getGeomSurfacePtr()->handle()),

View File

@ -122,7 +122,7 @@ PyObject* TopoShapeCompoundPy::connectEdgesToWires(PyObject *args)
for (TopExp_Explorer xp(s, TopAbs_EDGE); xp.More(); xp.Next()) for (TopExp_Explorer xp(s, TopAbs_EDGE); xp.More(); xp.Next())
hEdges->Append(xp.Current()); hEdges->Append(xp.Current());
ShapeAnalysis_FreeBounds::ConnectEdgesToWires(hEdges, tol, (shared==Py_True), hWires); ShapeAnalysis_FreeBounds::ConnectEdgesToWires(hEdges, tol, PyObject_IsTrue(shared), hWires);
TopoDS_Compound comp; TopoDS_Compound comp;
BRep_Builder builder; BRep_Builder builder;

View File

@ -1046,7 +1046,7 @@ PyObject* TopoShapePy::makeThickness(PyObject *args)
} }
TopoDS_Shape shape = this->getTopoShapePtr()->makeThickSolid(facesToRemove, offset, tolerance, TopoDS_Shape shape = this->getTopoShapePtr()->makeThickSolid(facesToRemove, offset, tolerance,
(inter == Py_True), (self_inter == Py_True), offsetMode, join); PyObject_IsTrue(inter) ? true : false, PyObject_IsTrue(self_inter) ? true : false, offsetMode, join);
return new TopoShapeSolidPy(new TopoShape(shape)); return new TopoShapeSolidPy(new TopoShape(shape));
} }
catch (Standard_Failure) { catch (Standard_Failure) {
@ -1073,7 +1073,9 @@ PyObject* TopoShapePy::makeOffsetShape(PyObject *args)
try { try {
TopoDS_Shape shape = this->getTopoShapePtr()->makeOffsetShape(offset, tolerance, TopoDS_Shape shape = this->getTopoShapePtr()->makeOffsetShape(offset, tolerance,
(inter == Py_True), (self_inter == Py_True), offsetMode, join, (fill == Py_True)); PyObject_IsTrue(inter) ? true : false,
PyObject_IsTrue(self_inter) ? true : false, offsetMode, join,
PyObject_IsTrue(fill) ? true : false);
return new TopoShapePy(new TopoShape(shape)); return new TopoShapePy(new TopoShape(shape));
} }
catch (Standard_Failure) { catch (Standard_Failure) {
@ -1324,7 +1326,7 @@ PyObject* TopoShapePy::isInside(PyObject *args)
gp_Pnt vertex = gp_Pnt(pnt.x,pnt.y,pnt.z); gp_Pnt vertex = gp_Pnt(pnt.x,pnt.y,pnt.z);
solidClassifier.Perform(vertex, tolerance); solidClassifier.Perform(vertex, tolerance);
Standard_Boolean test = (solidClassifier.State() == stateIn); Standard_Boolean test = (solidClassifier.State() == stateIn);
if ( (checkFace == Py_True) && (solidClassifier.IsOnAFace()) ) if (PyObject_IsTrue(checkFace) && (solidClassifier.IsOnAFace()))
test = Standard_True; test = Standard_True;
return Py_BuildValue("O", (test ? Py_True : Py_False)); return Py_BuildValue("O", (test ? Py_True : Py_False));
} }

View File

@ -1464,12 +1464,8 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s &
Gui::ViewVolumeProjection proj(viewer->getCamera()->getViewVolume()); Gui::ViewVolumeProjection proj(viewer->getCamera()->getViewVolume());
App::Document* doc = App::GetApplication().getActiveDocument(); Sketcher::SketchObject *sketchObject = getSketchObject();
Sketcher::SketchObject *sketchObject = NULL; App::Document *doc = sketchObject->getDocument();
if (doc)
sketchObject = dynamic_cast<Sketcher::SketchObject *>(doc->getActiveObject());
if (!sketchObject)
return;
Base::Placement Plm = sketchObject->Placement.getValue(); Base::Placement Plm = sketchObject->Placement.getValue();

View File

@ -24,7 +24,7 @@ SET /P M=Reebuild and press enter
rem making of the bin zip file rem making of the bin zip file
"c:\Program Files\7-Zip\7z.exe" a -t7z FreeCAD.7z "-xr!*.idb" "-xr!*.pdb" "-xr!*.ilk" "-xr!*.rule" "-xr!*.svn-base" "-xr!*.pyc" "-xr!*.stamp" "-xr!*.cmake" "-xr!*.svn*" "-xr!*.vcproj" "-xr!*.am" "-xr!CMakeFiles" "-xr!*.dir" ..\..\bin ..\..\Mod ..\..\Doc ..\..\data c:\Programme\7-Zip\7z.exe a -t7z FreeCAD.7z "-xr!*.idb" "-xr!*.pdb" "-xr!*.ilk" "-xr!*.pyc" "-xr!?.git\*" "-xr!*.am" "-xr!CMakeFiles" "..\..\bin" "..\..\Mod" "..\..\Doc" "..\..\data"
call CopyRelease.bat call CopyRelease.bat

View File

@ -1,4 +1,4 @@
copy FreeCAD.msi FreeCAD_0.13.$WCREV$_x86_unstable_setup.msi copy FreeCAD.msi FreeCAD_0.13.$WCREV$_x86_RC_setup.msi
copy FreeCAD.7z FreeCAD_0.13.$WCREV$_x86_unstable_bin.7z copy FreeCAD.7z FreeCAD_0.13.$WCREV$_x86_RC_bin.7z