Compare commits

...

14 Commits

17 changed files with 131 additions and 54 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ set(FREECAD_VERSION "0.16")
set(PACKAGE_NAME "FreeCAD")
set(PACKAGE_VERSION_MAJOR "0")
set(PACKAGE_VERSION_MINOR "16")
set(PACKAGE_VERSION_PATCH "4665")
set(PACKAGE_VERSION_PATCH "6700")
set(PACKAGE_VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}")
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
+1 -1
View File
@@ -44,7 +44,7 @@ Build Status <img src="https://cdn.travis-ci.org/images/travis-mascot-150-379170
|:------:|:----:|
|[![Master][freecad-master-status]][travis-branches]|[![0.16][freecad-0.16-status]][travis-branches]|
[freecad-0.16-status]: https://travis-ci-org/FreeCAD/FreeCAD.svg?branch=0.16
[freecad-0.16-status]: https://travis-ci.org/FreeCAD/FreeCAD.svg?branch=0.16
[freecad-master-status]: https://travis-ci.org/FreeCAD/FreeCAD.svg?branch=master
[travis-branches]: https://travis-ci.org/FreeCAD/FreeCAD/branches
[travis-builds]: https://travis-ci.org/FreeCAD/FreeCAD/builds
+12
View File
@@ -144,6 +144,7 @@ struct DocumentP
bool rollback;
bool closable;
bool keepTrailingDigits;
bool recomputeNow;
int iUndoMode;
unsigned int UndoMemSize;
unsigned int UndoMaxStackSize;
@@ -159,6 +160,7 @@ struct DocumentP
rollback = false;
closable = true;
keepTrailingDigits = true;
recomputeNow = false;
iUndoMode = 0;
UndoMemSize = 0;
UndoMaxStackSize = 20;
@@ -1449,6 +1451,8 @@ void Document::restore (void)
clearUndos();
for (std::vector<DocumentObject*>::iterator obj = d->objectArray.begin(); obj != d->objectArray.end(); ++obj) {
signalDeletedObject(*(*obj));
}
for (std::vector<DocumentObject*>::iterator obj = d->objectArray.begin(); obj != d->objectArray.end(); ++obj) {
delete *obj;
}
d->objectArray.clear();
@@ -1718,6 +1722,12 @@ void Document::_rebuildDependencyList(void)
void Document::recompute()
{
if (d->recomputeNow) {
throw Base::RuntimeError("Nested recomputes of a document are not allowed");
}
d->recomputeNow = true;
// delete recompute log
for( std::vector<App::DocumentObjectExecReturn*>::iterator it=_RecomputeLog.begin();it!=_RecomputeLog.end();++it)
delete *it;
@@ -1736,6 +1746,7 @@ void Document::recompute()
}
catch (const std::exception& e) {
std::cerr << "Document::recompute: " << e.what() << std::endl;
d->recomputeNow = false;
return;
}
@@ -1822,6 +1833,7 @@ void Document::recompute()
d->vertexMap.clear();
signalRecomputed(*this);
d->recomputeNow = false;
}
const char * Document::getErrorDescription(const App::DocumentObject*Obj) const
+3
View File
@@ -333,10 +333,13 @@ void StdCmdMergeProjects::activated(int iMsg)
return;
}
doc->openTransaction("Merge project");
Base::FileInfo fi((const char*)project.toUtf8());
Base::ifstream str(fi, std::ios::in | std::ios::binary);
MergeDocuments md(doc);
md.importObjects(str);
str.close();
doc->commitTransaction();
}
}
+7 -2
View File
@@ -22,8 +22,13 @@ fc_copy_sources(Stylesheets_data "${CMAKE_BINARY_DIR}/data/Gui/Stylesheets" ${St
INSTALL(
FILES
${Stylesheets_Files} ${Images_Files}
${Stylesheets_Files}
DESTINATION
${CMAKE_INSTALL_DATADIR}/Gui/Stylesheets
)
INSTALL(
FILES
${Images_Files}
DESTINATION
${CMAKE_INSTALL_DATADIR}/Gui/Stylesheets/images
)
+7 -2
View File
@@ -183,6 +183,7 @@ private:
xcaf.loadShapes();
#endif
pcDoc->recompute();
hApp->Close(hDoc);
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
@@ -206,12 +207,14 @@ private:
std::string name8bit = Part::encodeFilename(Utf8Name);
try {
Py::Sequence list(object);
Handle(XCAFApp_Application) hApp = XCAFApp_Application::GetApplication();
Handle(TDocStd_Document) hDoc;
hApp->NewDocument(TCollection_ExtendedString("MDTV-CAF"), hDoc);
Import::ExportOCAF ocaf(hDoc);
Py::Sequence list(object);
bool keepExplicitPlacement = list.size() > 1;
Import::ExportOCAF ocaf(hDoc, keepExplicitPlacement);
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
PyObject* item = (*it).ptr();
if (PyObject_TypeCheck(item, &(App::DocumentObjectPy::Type))) {
@@ -285,6 +288,8 @@ private:
throw Py::Exception();
}
}
hApp->Close(hDoc);
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
+22 -17
View File
@@ -274,18 +274,20 @@ void ImportOCAF::createShape(const TopoDS_Shape& aShape, const TopLoc_Location&
// ----------------------------------------------------------------------------
ExportOCAF::ExportOCAF(Handle_TDocStd_Document h)
ExportOCAF::ExportOCAF(Handle_TDocStd_Document h, bool explicitPlacement)
: pDoc(h)
, keepExplicitPlacement(explicitPlacement)
{
aShapeTool = XCAFDoc_DocumentTool::ShapeTool(pDoc->Main());
aColorTool = XCAFDoc_DocumentTool::ColorTool(pDoc->Main());
#if defined(OCAF_KEEP_PLACEMENT)
rootLabel = aShapeTool->NewShape();
TDataStd_Name::Set(rootLabel, "ASSEMBLY");
#else
rootLabel = TDF_TagSource::NewChild(pDoc->Main());
#endif
if (keepExplicitPlacement) {
rootLabel = aShapeTool->NewShape();
TDataStd_Name::Set(rootLabel, "ASSEMBLY");
}
else {
rootLabel = TDF_TagSource::NewChild(pDoc->Main());
}
}
void ExportOCAF::saveShape(Part::Feature* part, const std::vector<App::Color>& colors)
@@ -294,13 +296,16 @@ void ExportOCAF::saveShape(Part::Feature* part, const std::vector<App::Color>& c
if (shape.IsNull())
return;
#if defined(OCAF_KEEP_PLACEMENT)
// http://www.opencascade.org/org/forum/thread_18813/?forum=3
TopLoc_Location aLoc = shape.Location();
TopoDS_Shape baseShape = shape.Located(TopLoc_Location());
#else
TopoDS_Shape baseShape = shape;
#endif
TopoDS_Shape baseShape;
TopLoc_Location aLoc;
if (keepExplicitPlacement) {
// http://www.opencascade.org/org/forum/thread_18813/?forum=3
aLoc = shape.Location();
baseShape = shape.Located(TopLoc_Location());
}
else {
baseShape = shape;
}
// Add shape and name
TDF_Label shapeLabel = aShapeTool->NewShape();
@@ -308,9 +313,9 @@ void ExportOCAF::saveShape(Part::Feature* part, const std::vector<App::Color>& c
TDataStd_Name::Set(shapeLabel, TCollection_ExtendedString(part->Label.getValue(), 1));
#if defined(OCAF_KEEP_PLACEMENT)
aShapeTool->AddComponent(rootLabel, shapeLabel, aLoc);
#endif
if (keepExplicitPlacement) {
aShapeTool->AddComponent(rootLabel, shapeLabel, aLoc);
}
// Add color information
Quantity_Color col;
+2 -1
View File
@@ -75,7 +75,7 @@ private:
class ImportExport ExportOCAF
{
public:
ExportOCAF(Handle_TDocStd_Document h);
ExportOCAF(Handle_TDocStd_Document h, bool explicitPlacement);
void saveShape(Part::Feature* part, const std::vector<App::Color>&);
private:
@@ -83,6 +83,7 @@ private:
Handle_XCAFDoc_ShapeTool aShapeTool;
Handle_XCAFDoc_ColorTool aColorTool;
TDF_Label rootLabel;
bool keepExplicitPlacement;
};
+8 -2
View File
@@ -404,6 +404,7 @@ private:
ImportOCAFExt ocaf(hDoc, pcDoc, file.fileNamePure());
ocaf.loadShapes();
pcDoc->recompute();
hApp->Close(hDoc);
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
@@ -427,12 +428,14 @@ private:
std::string name8bit = Part::encodeFilename(Utf8Name);
try {
Py::Sequence list(object);
Handle(XCAFApp_Application) hApp = XCAFApp_Application::GetApplication();
Handle(TDocStd_Document) hDoc;
hApp->NewDocument(TCollection_ExtendedString("MDTV-CAF"), hDoc);
Import::ExportOCAF ocaf(hDoc);
Py::Sequence list(object);
bool keepExplicitPlacement = list.size() > 1;
Import::ExportOCAF ocaf(hDoc, keepExplicitPlacement);
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
PyObject* item = (*it).ptr();
if (PyObject_TypeCheck(item, &(App::DocumentObjectPy::Type))) {
@@ -495,6 +498,8 @@ private:
throw Py::Exception();
}
}
hApp->Close(hDoc);
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
@@ -585,6 +590,7 @@ private:
OCAFBrowser browse(hDoc);
browse.load(dlg->findChild<QTreeWidget*>());
hApp->Close(hDoc);
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
+6 -2
View File
@@ -1521,8 +1521,12 @@ PartGui::VectorAdapter PartGui::TaskMeasureAngular::buildAdapter(const PartGui::
return VectorAdapter();
TopoDS_Edge edge = TopoDS::Edge(edgeShape);
// make edge orientation so that end of edge closest to pick is head of vector.
gp_Vec firstPoint = PartGui::convert(TopExp::FirstVertex(edge, Standard_True));
gp_Vec lastPoint = PartGui::convert(TopExp::LastVertex(edge, Standard_True));
TopoDS_Vertex firstVertex = TopExp::FirstVertex(edge, Standard_True);
TopoDS_Vertex lastVertex = TopExp::LastVertex(edge, Standard_True);
if (firstVertex.IsNull() || lastVertex.IsNull())
return VectorAdapter();
gp_Vec firstPoint = PartGui::convert(firstVertex);
gp_Vec lastPoint = PartGui::convert(lastVertex);
gp_Vec pickPoint(current.x, current.y, current.z);
double firstDistance = (firstPoint - pickPoint).Magnitude();
double lastDistance = (lastPoint - pickPoint).Magnitude();
+1 -1
View File
@@ -25,7 +25,7 @@ import FreeCAD
import PySide
from PySide import QtCore, QtGui
from distutils.version import StrictVersion as V
from distutils.version import LooseVersion as V
try:
import matplotlib
+5 -1
View File
@@ -28,6 +28,8 @@
#include <Base/Writer.h>
#include <Base/Reader.h>
#include <Base/Tools.h>
#include <App/Property.h>
#include <QDateTime>
#include "Constraint.h"
@@ -145,6 +147,7 @@ double Constraint::getPresentationValue() const
else
return Value;
case Angle:
return Base::toDegrees<double>(Value);
case SnellsLaw:
return Value;
default:
@@ -159,8 +162,9 @@ unsigned int Constraint::getMemSize (void) const
void Constraint::Save (Writer &writer) const
{
std::string encodeName = App::Property::encodeAttribute(Name);
writer.Stream() << writer.ind() << "<Constrain "
<< "Name=\"" << Name << "\" "
<< "Name=\"" << encodeName << "\" "
<< "Type=\"" << (int)Type << "\" ";
if(this->Type==InternalAlignment)
writer.Stream()
+2 -2
View File
@@ -310,7 +310,7 @@ int SketchObject::setDriving(int ConstrId, bool isdriving)
constNew->isDriving = isdriving;
newVals[ConstrId] = constNew;
this->Constraints.setValues(newVals);
if (isdriving)
if (!isdriving)
setExpression(Constraints.createPath(ConstrId), boost::shared_ptr<App::Expression>());
delete constNew;
@@ -368,7 +368,7 @@ int SketchObject::toggleDriving(int ConstrId)
constNew->isDriving = !constNew->isDriving;
newVals[ConstrId] = constNew;
this->Constraints.setValues(newVals);
if (constNew->isDriving)
if (!constNew->isDriving)
setExpression(Constraints.createPath(ConstrId), boost::shared_ptr<App::Expression>());
delete constNew;
+24 -12
View File
@@ -829,10 +829,12 @@ void CmdSketcherConstrainLock::updateAction(int mode)
{
switch (mode) {
case Reference:
getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_ConstrainLock_Driven"));
if (getAction())
getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_ConstrainLock_Driven"));
break;
case Driving:
getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_ConstrainLock"));
if (getAction())
getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_ConstrainLock"));
break;
}
}
@@ -1100,10 +1102,12 @@ void CmdSketcherConstrainDistance::updateAction(int mode)
{
switch (mode) {
case Reference:
getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_Length_Driven"));
if (getAction())
getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_Length_Driven"));
break;
case Driving:
getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_Length"));
if (getAction())
getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_Length"));
break;
}
}
@@ -1342,10 +1346,12 @@ void CmdSketcherConstrainDistanceX::updateAction(int mode)
{
switch (mode) {
case Reference:
getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_HorizontalDistance_Driven"));
if (getAction())
getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_HorizontalDistance_Driven"));
break;
case Driving:
getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_HorizontalDistance"));
if (getAction())
getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_HorizontalDistance"));
break;
}
}
@@ -1497,10 +1503,12 @@ void CmdSketcherConstrainDistanceY::updateAction(int mode)
{
switch (mode) {
case Reference:
getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_VerticalDistance_Driven"));
if (getAction())
getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_VerticalDistance_Driven"));
break;
case Driving:
getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_VerticalDistance"));
if (getAction())
getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_VerticalDistance"));
break;
}
}
@@ -2493,10 +2501,12 @@ void CmdSketcherConstrainRadius::updateAction(int mode)
{
switch (mode) {
case Reference:
getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_Radius_Driven"));
if (getAction())
getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_Radius_Driven"));
break;
case Driving:
getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_Radius"));
if (getAction())
getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_Radius"));
break;
}
}
@@ -2765,10 +2775,12 @@ void CmdSketcherConstrainAngle::updateAction(int mode)
{
switch (mode) {
case Reference:
getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_InternalAngle_Driven"));
if (getAction())
getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_InternalAngle_Driven"));
break;
case Driving:
getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_InternalAngle"));
if (getAction())
getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_InternalAngle"));
break;
}
}
+28 -8
View File
@@ -328,10 +328,12 @@ void CmdSketcherCreateLine::updateAction(int mode)
{
switch (mode) {
case Normal:
getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreateLine"));
if (getAction())
getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreateLine"));
break;
case Construction:
getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreateLine_Constr"));
if (getAction())
getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreateLine_Constr"));
break;
}
}
@@ -569,10 +571,12 @@ void CmdSketcherCreateRectangle::updateAction(int mode)
{
switch (mode) {
case Normal:
getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreateRectangle"));
if (getAction())
getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreateRectangle"));
break;
case Construction:
getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreateRectangle_Constr"));
if (getAction())
getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreateRectangle_Constr"));
break;
}
}
@@ -1184,10 +1188,12 @@ void CmdSketcherCreatePolyline::updateAction(int mode)
{
switch (mode) {
case Normal:
getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreatePolyline"));
if (getAction())
getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreatePolyline"));
break;
case Construction:
getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreatePolyline_Constr"));
if (getAction())
getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreatePolyline_Constr"));
break;
}
}
@@ -1826,6 +1832,9 @@ Gui::Action * CmdSketcherCompCreateArc::createAction(void)
void CmdSketcherCompCreateArc::updateAction(int mode)
{
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(getAction());
if (!pcAction)
return;
QList<QAction*> a = pcAction->actions();
int index = pcAction->property("defaultAction").toInt();
switch (mode) {
@@ -3399,6 +3408,9 @@ Gui::Action * CmdSketcherCompCreateConic::createAction(void)
void CmdSketcherCompCreateConic::updateAction(int mode)
{
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(getAction());
if (!pcAction)
return;
QList<QAction*> a = pcAction->actions();
int index = pcAction->property("defaultAction").toInt();
switch (mode) {
@@ -3752,6 +3764,9 @@ Gui::Action * CmdSketcherCompCreateCircle::createAction(void)
void CmdSketcherCompCreateCircle::updateAction(int mode)
{
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(getAction());
if (!pcAction)
return;
QList<QAction*> a = pcAction->actions();
int index = pcAction->property("defaultAction").toInt();
switch (mode) {
@@ -4914,10 +4929,12 @@ void CmdSketcherCreateSlot::updateAction(int mode)
{
switch (mode) {
case Normal:
getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreateSlot"));
if (getAction())
getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreateSlot"));
break;
case Construction:
getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreateSlot_Constr"));
if (getAction())
getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreateSlot_Constr"));
break;
}
}
@@ -5354,6 +5371,9 @@ Gui::Action * CmdSketcherCompCreateRegularPolygon::createAction(void)
void CmdSketcherCompCreateRegularPolygon::updateAction(int mode)
{
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(getAction());
if (!pcAction)
return;
QList<QAction*> a = pcAction->actions();
int index = pcAction->property("defaultAction").toInt();
switch (mode) {
@@ -135,7 +135,7 @@ public:
name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(constraint->getPresentationValue(),Base::Unit::Length).getUserString());
break;
case Sketcher::Angle:
name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(Base::toDegrees<double>(constraint->getPresentationValue()),Base::Unit::Angle).getUserString());
name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(constraint->getPresentationValue(),Base::Unit::Angle).getUserString());
break;
case Sketcher::SnellsLaw: {
double v = constraint->getPresentationValue();
+1 -1
View File
@@ -3824,7 +3824,7 @@ Restart:
break;
SoDatumLabel *asciiText = dynamic_cast<SoDatumLabel *>(sep->getChild(CONSTRAINT_SEPARATOR_INDEX_MATERIAL_OR_DATUMLABEL));
asciiText->string = SbString(Base::Quantity(Base::toDegrees<double>(Constr->getPresentationValue()),Base::Unit::Angle).getUserString().toUtf8().constData());
asciiText->string = SbString(Base::Quantity(Constr->getPresentationValue(),Base::Unit::Angle).getUserString().toUtf8().constData());
asciiText->datumtype = SoDatumLabel::ANGLE;
asciiText->param1 = Constr->LabelDistance;
asciiText->param2 = startangle;