Merge branch 'master' of github.com:FreeCAD/FreeCAD

This commit is contained in:
Yorik van Havre 2017-01-11 22:31:48 -02:00
commit 675cd5207f
40 changed files with 1228 additions and 981 deletions

View File

@ -615,6 +615,7 @@ void Document::exportGraphviz(std::ostream& out) const
if (i_in_deg_pair.first == in_edges.end()) { if (i_in_deg_pair.first == in_edges.end()) {
removeEdges(in_edges, out_edges, i_out_deg_pair, [&](Edge e) { return target(e, DepList); }); removeEdges(in_edges, out_edges, i_out_deg_pair, [&](Edge e) { return target(e, DepList); });
changed = true; changed = true;
i_out_deg_pair = out_edges.equal_range(*uvi);
} }
// Remove in edges of nodes that don't have a single edge out // Remove in edges of nodes that don't have a single edge out

View File

@ -3,6 +3,9 @@ set(PACKAGE_WCREF "$WCREV$")
set(PACKAGE_WCDATE "$WCDATE$") set(PACKAGE_WCDATE "$WCDATE$")
set(PACKAGE_WCURL "$WCURL$") set(PACKAGE_WCURL "$WCURL$")
# If the sources don't include a Version.h then create one
if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/Version.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Version.h.cmake configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Version.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/Version.h.in ${CMAKE_CURRENT_BINARY_DIR}/Version.h.in
) )
@ -19,3 +22,4 @@ if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/Version.h)
${CMAKE_CURRENT_BINARY_DIR}/Version.h ${CMAKE_CURRENT_BINARY_DIR}/Version.h
) )
endif (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/Version.h) endif (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/Version.h)
endif (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/Version.h)

View File

@ -195,7 +195,7 @@ void TaskHeader::leaveEvent ( QEvent * /*event*/ )
void TaskHeader::fold() void TaskHeader::fold()
{ {
if (myExpandable) { if (myExpandable) {
emit activated(); Q_EMIT activated();
// Toggling the 'm_fold' member here may lead to inconsistencies with its ActionGroup. // Toggling the 'm_fold' member here may lead to inconsistencies with its ActionGroup.
// Thus, the method setFold() was added and called from ActionGroup when required. // Thus, the method setFold() was added and called from ActionGroup when required.
#if 0 #if 0
@ -254,7 +254,7 @@ void TaskHeader::changeIcons()
void TaskHeader::mouseReleaseEvent ( QMouseEvent * event ) void TaskHeader::mouseReleaseEvent ( QMouseEvent * event )
{ {
if (event->button() == Qt::LeftButton) { if (event->button() == Qt::LeftButton) {
emit activated(); Q_EMIT activated();
} }
} }

View File

@ -70,7 +70,7 @@ SignalThread::run(void)
// just wait, and trigger every time we receive a signal // just wait, and trigger every time we receive a signal
this->waitcond.wait(&this->mutex); this->waitcond.wait(&this->mutex);
if (!this->isstopped) { if (!this->isstopped) {
emit triggerSignal(); Q_EMIT triggerSignal();
} }
} }
} }

View File

@ -9,193 +9,193 @@
#include "iistaskpanelscheme.h" #include "iistaskpanelscheme.h"
iisIconLabel::iisIconLabel(const QIcon &icon, const QString &title, QWidget *parent) iisIconLabel::iisIconLabel(const QIcon &icon, const QString &title, QWidget *parent)
: QWidget(parent), : QWidget(parent),
myPixmap(icon), myPixmap(icon),
myText(title), myText(title),
mySchemePointer(0), mySchemePointer(0),
m_over(false), m_over(false),
m_pressed(false), m_pressed(false),
m_changeCursorOver(true), m_changeCursorOver(true),
m_underlineOver(true) m_underlineOver(true)
{ {
setFocusPolicy(Qt::StrongFocus); setFocusPolicy(Qt::StrongFocus);
setCursor(Qt::PointingHandCursor); setCursor(Qt::PointingHandCursor);
myFont.setWeight(0); myFont.setWeight(0);
myPen.setStyle(Qt::NoPen); myPen.setStyle(Qt::NoPen);
myColor = myColorOver = myColorDisabled = QColor(); myColor = myColorOver = myColorDisabled = QColor();
} }
iisIconLabel::~iisIconLabel() iisIconLabel::~iisIconLabel()
{ {
//if (m_changeCursorOver) //if (m_changeCursorOver)
// QApplication::restoreOverrideCursor(); // QApplication::restoreOverrideCursor();
} }
void iisIconLabel::setSchemePointer(iisIconLabelScheme **pointer) void iisIconLabel::setSchemePointer(iisIconLabelScheme **pointer)
{ {
mySchemePointer = pointer; mySchemePointer = pointer;
update(); update();
} }
void iisIconLabel::setColors(const QColor &color, const QColor &colorOver, const QColor &colorOff) void iisIconLabel::setColors(const QColor &color, const QColor &colorOver, const QColor &colorOff)
{ {
myColor = color; myColor = color;
myColorOver = colorOver; myColorOver = colorOver;
myColorDisabled = colorOff; myColorDisabled = colorOff;
update(); update();
} }
void iisIconLabel::setFont(const QFont &font) void iisIconLabel::setFont(const QFont &font)
{ {
myFont = font; myFont = font;
update(); update();
} }
void iisIconLabel::setFocusPen(const QPen &pen) void iisIconLabel::setFocusPen(const QPen &pen)
{ {
myPen = pen; myPen = pen;
update(); update();
} }
QSize iisIconLabel::sizeHint() const QSize iisIconLabel::sizeHint() const
{ {
return minimumSize(); return minimumSize();
} }
QSize iisIconLabel::minimumSizeHint() const QSize iisIconLabel::minimumSizeHint() const
{ {
int s = (mySchemePointer && *mySchemePointer) ? (*mySchemePointer)->iconSize : 16; int s = (mySchemePointer && *mySchemePointer) ? (*mySchemePointer)->iconSize : 16;
QPixmap px = myPixmap.pixmap(s,s, QPixmap px = myPixmap.pixmap(s,s,
isEnabled() ? QIcon::Normal : QIcon::Disabled); isEnabled() ? QIcon::Normal : QIcon::Disabled);
int h = 4+px.height(); int h = 4+px.height();
int w = 8 + px.width(); int w = 8 + px.width();
if (!myText.isEmpty()) { if (!myText.isEmpty()) {
QFontMetrics fm(myFont); QFontMetrics fm(myFont);
w += fm.width(myText); w += fm.width(myText);
h = qMax(h, 4+fm.height()); h = qMax(h, 4+fm.height());
} }
return QSize(w+2,h+2); return QSize(w+2,h+2);
} }
void iisIconLabel::paintEvent ( QPaintEvent * event ) void iisIconLabel::paintEvent ( QPaintEvent * event )
{ {
Q_UNUSED(event); Q_UNUSED(event);
QPainter p(this); QPainter p(this);
QRect textRect(rect().adjusted(0,0,-1,0)); QRect textRect(rect().adjusted(0,0,-1,0));
int x = 2; int x = 2;
if (!myPixmap.isNull()) { if (!myPixmap.isNull()) {
int s = (mySchemePointer && *mySchemePointer) ? (*mySchemePointer)->iconSize : 16; int s = (mySchemePointer && *mySchemePointer) ? (*mySchemePointer)->iconSize : 16;
QPixmap px = myPixmap.pixmap(s,s, QPixmap px = myPixmap.pixmap(s,s,
isEnabled() ? QIcon::Normal : QIcon::Disabled); isEnabled() ? QIcon::Normal : QIcon::Disabled);
p.drawPixmap(x,0,px); p.drawPixmap(x,0,px);
x += px.width() + 4; x += px.width() + 4;
} }
if (!myText.isEmpty()) { if (!myText.isEmpty()) {
QColor text = myColor, textOver = myColorOver, textOff = myColorDisabled; QColor text = myColor, textOver = myColorOver, textOff = myColorDisabled;
QFont fnt = myFont; QFont fnt = myFont;
QPen focusPen = myPen; QPen focusPen = myPen;
bool underline = m_underlineOver/*, cursover = m_changeCursorOver*/; bool underline = m_underlineOver/*, cursover = m_changeCursorOver*/;
if (mySchemePointer && *mySchemePointer) { if (mySchemePointer && *mySchemePointer) {
if (!text.isValid()) text = (*mySchemePointer)->text; if (!text.isValid()) text = (*mySchemePointer)->text;
if (!textOver.isValid()) textOver = (*mySchemePointer)->textOver; if (!textOver.isValid()) textOver = (*mySchemePointer)->textOver;
if (!textOff.isValid()) textOff = (*mySchemePointer)->textOff; if (!textOff.isValid()) textOff = (*mySchemePointer)->textOff;
if (!fnt.weight()) fnt = (*mySchemePointer)->font; if (!fnt.weight()) fnt = (*mySchemePointer)->font;
if (focusPen.style() == Qt::NoPen) focusPen = (*mySchemePointer)->focusPen; if (focusPen.style() == Qt::NoPen) focusPen = (*mySchemePointer)->focusPen;
underline = (*mySchemePointer)->underlineOver; underline = (*mySchemePointer)->underlineOver;
//cursover = (*mySchemePointer)->cursorOver; //cursover = (*mySchemePointer)->cursorOver;
} }
p.setPen(isEnabled() ? m_over ? textOver : text : textOff); p.setPen(isEnabled() ? m_over ? textOver : text : textOff);
if (isEnabled() && underline && m_over) if (isEnabled() && underline && m_over)
fnt.setUnderline(true); fnt.setUnderline(true);
p.setFont(fnt); p.setFont(fnt);
textRect.setLeft(x); textRect.setLeft(x);
QRect boundingRect; QRect boundingRect;
QFontMetrics fm(fnt); QFontMetrics fm(fnt);
#if QT_VERSION >= 0x040203 #if QT_VERSION >= 0x040203
QString txt(fm.elidedText(myText, Qt::ElideRight, textRect.width())); QString txt(fm.elidedText(myText, Qt::ElideRight, textRect.width()));
#else #else
QString txt = myText; QString txt = myText;
#endif #endif
p.drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, txt, &boundingRect); p.drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, txt, &boundingRect);
if (hasFocus()) { if (hasFocus()) {
p.setPen(focusPen); p.setPen(focusPen);
p.drawRect(boundingRect.adjusted(-2,-1,0,0)); p.drawRect(boundingRect.adjusted(-2,-1,0,0));
} }
} }
} }
void iisIconLabel::enterEvent ( QEvent * /*event*/ ) void iisIconLabel::enterEvent ( QEvent * /*event*/ )
{ {
m_over = true; m_over = true;
//if (m_changeCursorOver) //if (m_changeCursorOver)
// QApplication::setOverrideCursor(Qt::PointingHandCursor); // QApplication::setOverrideCursor(Qt::PointingHandCursor);
update(); update();
} }
void iisIconLabel::leaveEvent ( QEvent * /*event*/ ) void iisIconLabel::leaveEvent ( QEvent * /*event*/ )
{ {
m_over = false; m_over = false;
update(); update();
//if (m_changeCursorOver) //if (m_changeCursorOver)
// QApplication::restoreOverrideCursor(); // QApplication::restoreOverrideCursor();
} }
void iisIconLabel::mousePressEvent ( QMouseEvent * event ) void iisIconLabel::mousePressEvent ( QMouseEvent * event )
{ {
if (event->button() == Qt::LeftButton) { if (event->button() == Qt::LeftButton) {
m_pressed = true; m_pressed = true;
emit pressed(); Q_EMIT pressed();
} else } else
if (event->button() == Qt::RightButton) if (event->button() == Qt::RightButton)
emit contextMenu(); Q_EMIT contextMenu();
update(); update();
} }
void iisIconLabel::mouseReleaseEvent ( QMouseEvent * event ) void iisIconLabel::mouseReleaseEvent ( QMouseEvent * event )
{ {
if (event->button() == Qt::LeftButton) { if (event->button() == Qt::LeftButton) {
m_pressed = false; m_pressed = false;
emit released(); Q_EMIT released();
if (rect().contains( event->pos() )) { if (rect().contains( event->pos() )) {
emit clicked(); Q_EMIT clicked();
emit activated(); Q_EMIT activated();
} }
} }
update(); update();
} }
void iisIconLabel::keyPressEvent ( QKeyEvent * event ) void iisIconLabel::keyPressEvent ( QKeyEvent * event )
{ {
switch (event->key()) { switch (event->key()) {
case Qt::Key_Space: case Qt::Key_Space:
case Qt::Key_Return: case Qt::Key_Return:
emit activated(); Q_EMIT activated();
break; break;
default:; default:;
} }
QWidget::keyPressEvent(event); QWidget::keyPressEvent(event);
} }

View File

@ -16,38 +16,38 @@
#include "iisiconlabel.h" #include "iisiconlabel.h"
iisTaskHeader::iisTaskHeader(const QIcon &icon, const QString &title, bool expandable, QWidget *parent) iisTaskHeader::iisTaskHeader(const QIcon &icon, const QString &title, bool expandable, QWidget *parent)
: QFrame(parent), : QFrame(parent),
myExpandable(expandable), myExpandable(expandable),
m_over(false), m_over(false),
m_buttonOver(false), m_buttonOver(false),
m_fold(true), m_fold(true),
m_opacity(0.1), m_opacity(0.1),
myButton(0) myButton(0)
{ {
myTitle = new iisIconLabel(icon, title, this); myTitle = new iisIconLabel(icon, title, this);
myTitle->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); myTitle->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
connect(myTitle, SIGNAL(activated()), this, SLOT(fold())); connect(myTitle, SIGNAL(activated()), this, SLOT(fold()));
QHBoxLayout *hbl = new QHBoxLayout(); QHBoxLayout *hbl = new QHBoxLayout();
hbl->setMargin(2); hbl->setMargin(2);
setLayout(hbl); setLayout(hbl);
hbl->addWidget(myTitle); hbl->addWidget(myTitle);
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
setScheme(iisTaskPanelScheme::defaultScheme()); setScheme(iisTaskPanelScheme::defaultScheme());
myTitle->setSchemePointer(&myLabelScheme); myTitle->setSchemePointer(&myLabelScheme);
if (myExpandable) { if (myExpandable) {
myButton = new QLabel(this); myButton = new QLabel(this);
hbl->addWidget(myButton); hbl->addWidget(myButton);
myButton->installEventFilter(this); myButton->installEventFilter(this);
myButton->setFixedWidth(myScheme->headerButtonSize.width()); myButton->setFixedWidth(myScheme->headerButtonSize.width());
changeIcons(); changeIcons();
} }
} }
iisTaskHeader::~iisTaskHeader() iisTaskHeader::~iisTaskHeader()
@ -57,145 +57,145 @@ iisTaskHeader::~iisTaskHeader()
bool iisTaskHeader::eventFilter(QObject *obj, QEvent *event) bool iisTaskHeader::eventFilter(QObject *obj, QEvent *event)
{ {
switch (event->type()) { switch (event->type()) {
case QEvent::MouseButtonPress: case QEvent::MouseButtonPress:
fold(); fold();
return true; return true;
case QEvent::Enter: case QEvent::Enter:
m_buttonOver = true; m_buttonOver = true;
changeIcons(); changeIcons();
return true; return true;
case QEvent::Leave: case QEvent::Leave:
m_buttonOver = false; m_buttonOver = false;
changeIcons(); changeIcons();
return true; return true;
default:; default:;
} }
return QFrame::eventFilter(obj, event); return QFrame::eventFilter(obj, event);
} }
void iisTaskHeader::setScheme(iisTaskPanelScheme *scheme) void iisTaskHeader::setScheme(iisTaskPanelScheme *scheme)
{ {
if (scheme) { if (scheme) {
myScheme = scheme; myScheme = scheme;
myLabelScheme = &(scheme->headerLabelScheme); myLabelScheme = &(scheme->headerLabelScheme);
if (myExpandable) { if (myExpandable) {
setCursor(myLabelScheme->cursorOver ? Qt::PointingHandCursor : cursor()); setCursor(myLabelScheme->cursorOver ? Qt::PointingHandCursor : cursor());
changeIcons(); changeIcons();
} }
setFixedHeight(scheme->headerSize); setFixedHeight(scheme->headerSize);
update(); update();
} }
} }
void iisTaskHeader::paintEvent ( QPaintEvent * event ) void iisTaskHeader::paintEvent ( QPaintEvent * event )
{ {
Q_UNUSED(event); Q_UNUSED(event);
QPainter p(this); QPainter p(this);
#if QT_VERSION >= 0x040203 #if QT_VERSION >= 0x040203
if (myScheme->headerAnimation) if (myScheme->headerAnimation)
p.setOpacity(m_opacity+0.7); p.setOpacity(m_opacity+0.7);
#endif #endif
p.setPen(myScheme->headerBorder); p.setPen(myScheme->headerBorder);
p.setBrush(myScheme->headerBackground); p.setBrush(myScheme->headerBackground);
if (myScheme->headerBorder.style() == Qt::NoPen) if (myScheme->headerBorder.style() == Qt::NoPen)
p.drawRect(rect()); p.drawRect(rect());
else else
p.drawRect(rect().adjusted(0,0,-1,-1)); p.drawRect(rect().adjusted(0,0,-1,-1));
} }
void iisTaskHeader::animate() void iisTaskHeader::animate()
{ {
if (!myScheme->headerAnimation) if (!myScheme->headerAnimation)
return; return;
if (!isEnabled()) { if (!isEnabled()) {
m_opacity = 0.1; m_opacity = 0.1;
update(); update();
return; return;
} }
if (m_over) { if (m_over) {
if (m_opacity >= 0.3) { if (m_opacity >= 0.3) {
m_opacity = 0.3; m_opacity = 0.3;
return; return;
} }
m_opacity += 0.05; m_opacity += 0.05;
} else { } else {
if (m_opacity <= 0.1) { if (m_opacity <= 0.1) {
m_opacity = 0.1; m_opacity = 0.1;
return; return;
} }
m_opacity = qMax(0.1, m_opacity-0.05); m_opacity = qMax(0.1, m_opacity-0.05);
} }
QTimer::singleShot(100, this, SLOT(animate())); QTimer::singleShot(100, this, SLOT(animate()));
update(); update();
} }
void iisTaskHeader::enterEvent ( QEvent * /*event*/ ) void iisTaskHeader::enterEvent ( QEvent * /*event*/ )
{ {
m_over = true; m_over = true;
if (isEnabled()) if (isEnabled())
QTimer::singleShot(100, this, SLOT(animate())); QTimer::singleShot(100, this, SLOT(animate()));
update(); update();
} }
void iisTaskHeader::leaveEvent ( QEvent * /*event*/ ) void iisTaskHeader::leaveEvent ( QEvent * /*event*/ )
{ {
m_over = false; m_over = false;
if (isEnabled())
QTimer::singleShot(100, this, SLOT(animate()));
update(); if (isEnabled())
QTimer::singleShot(100, this, SLOT(animate()));
update();
} }
void iisTaskHeader::fold() void iisTaskHeader::fold()
{ {
if (myExpandable) { if (myExpandable) {
emit activated(); Q_EMIT activated();
m_fold = !m_fold; m_fold = !m_fold;
changeIcons(); changeIcons();
} }
} }
void iisTaskHeader::changeIcons() void iisTaskHeader::changeIcons()
{ {
if (!myButton) if (!myButton)
return; return;
if (m_buttonOver) if (m_buttonOver)
{ {
if (m_fold) if (m_fold)
myButton->setPixmap(myScheme->headerButtonFoldOver.pixmap(myScheme->headerButtonSize)); myButton->setPixmap(myScheme->headerButtonFoldOver.pixmap(myScheme->headerButtonSize));
else else
myButton->setPixmap(myScheme->headerButtonUnfoldOver.pixmap(myScheme->headerButtonSize)); myButton->setPixmap(myScheme->headerButtonUnfoldOver.pixmap(myScheme->headerButtonSize));
} else } else
{ {
if (m_fold) if (m_fold)
myButton->setPixmap(myScheme->headerButtonFold.pixmap(myScheme->headerButtonSize)); myButton->setPixmap(myScheme->headerButtonFold.pixmap(myScheme->headerButtonSize));
else else
myButton->setPixmap(myScheme->headerButtonUnfold.pixmap(myScheme->headerButtonSize)); myButton->setPixmap(myScheme->headerButtonUnfold.pixmap(myScheme->headerButtonSize));
} }
} }
void iisTaskHeader::mouseReleaseEvent ( QMouseEvent * event ) void iisTaskHeader::mouseReleaseEvent ( QMouseEvent * event )
{ {
if (event->button() == Qt::LeftButton) { if (event->button() == Qt::LeftButton) {
emit activated(); Q_EMIT activated();
} }
} }

View File

@ -128,7 +128,7 @@ class plane:
self.u = Vector(0,1,0) self.u = Vector(0,1,0)
self.v = Vector(0,0,1) self.v = Vector(0,0,1)
elif axis.getAngle(Vector(-1,0,0)) < 0.00001: elif axis.getAngle(Vector(-1,0,0)) < 0.00001:
self.axos = Vector(-1,0,0) self.axis = Vector(-1,0,0)
self.u = Vector(0,-1,0) self.u = Vector(0,-1,0)
self.v = Vector(0,0,1) self.v = Vector(0,0,1)
elif upvec: elif upvec:

View File

@ -32,12 +32,12 @@
<message> <message>
<location filename="_CommandFemFromShape.py" line="39"/> <location filename="_CommandFemFromShape.py" line="39"/>
<source>Create FEM mesh</source> <source>Create FEM mesh</source>
<translation>Создать МКЭ сетку</translation> <translation>Создать МКЭ-сетку</translation>
</message> </message>
<message> <message>
<location filename="_CommandFemFromShape.py" line="40"/> <location filename="_CommandFemFromShape.py" line="40"/>
<source>Create FEM mesh from shape</source> <source>Create FEM mesh from shape</source>
<translation>Создать МКЭ сетку из формы</translation> <translation>Создать МКЭ-сетку из формы</translation>
</message> </message>
</context> </context>
<context> <context>
@ -207,7 +207,7 @@
<location filename="../../Command.cpp" line="166"/> <location filename="../../Command.cpp" line="166"/>
<location filename="../../Command.cpp" line="167"/> <location filename="../../Command.cpp" line="167"/>
<source>Add a part to the Analysis</source> <source>Add a part to the Analysis</source>
<translation>Добавить новую часть в Анализ</translation> <translation>Добавить новую часть в анализ</translation>
</message> </message>
</context> </context>
<context> <context>
@ -225,7 +225,7 @@
<message> <message>
<location filename="../../Command.cpp" line="275"/> <location filename="../../Command.cpp" line="275"/>
<source>Create FEM constraint for a bearing</source> <source>Create FEM constraint for a bearing</source>
<translation>Создать МКЭ ограничения для подшипника</translation> <translation>Создать МКЭ-ограничения для подшипника</translation>
</message> </message>
</context> </context>
<context> <context>
@ -292,12 +292,12 @@
<message> <message>
<location filename="../../Command.cpp" line="446"/> <location filename="../../Command.cpp" line="446"/>
<source>Create FEM gear constraint</source> <source>Create FEM gear constraint</source>
<translation>Создать МКЭ передач с ограничениями</translation> <translation>Создать передаточное МКЭ-ограничение</translation>
</message> </message>
<message> <message>
<location filename="../../Command.cpp" line="447"/> <location filename="../../Command.cpp" line="447"/>
<source>Create FEM constraint for a gear</source> <source>Create FEM constraint for a gear</source>
<translation>Создать МКЭ с ограничениями для передач</translation> <translation>Создать МКЭ-ограничение для передачи</translation>
</message> </message>
</context> </context>
<context> <context>
@ -328,12 +328,12 @@
<message> <message>
<location filename="../../Command.cpp" line="487"/> <location filename="../../Command.cpp" line="487"/>
<source>Create FEM pulley constraint</source> <source>Create FEM pulley constraint</source>
<translation>Создать МКЭ с ограничениями для шкивов</translation> <translation>Создать шкивовое МКЭ-ограничение</translation>
</message> </message>
<message> <message>
<location filename="../../Command.cpp" line="488"/> <location filename="../../Command.cpp" line="488"/>
<source>Create FEM constraint for a pulley</source> <source>Create FEM constraint for a pulley</source>
<translation type="unfinished">Create FEM constraint for a pulley</translation> <translation>Создать МКЭ-ограничение для шкива</translation>
</message> </message>
</context> </context>
<context> <context>
@ -347,7 +347,7 @@
<location filename="../../Command.cpp" line="104"/> <location filename="../../Command.cpp" line="104"/>
<location filename="../../Command.cpp" line="105"/> <location filename="../../Command.cpp" line="105"/>
<source>Create a FEM analysis</source> <source>Create a FEM analysis</source>
<translation>Создать МКЭ анализ</translation> <translation>Создать МКЭ-анализ</translation>
</message> </message>
</context> </context>
<context> <context>
@ -358,11 +358,11 @@
</message> </message>
<message> <message>
<source>Create FEM mesh</source> <source>Create FEM mesh</source>
<translation>Создать МКЭ сетку</translation> <translation>Создать МКЭ-сетку</translation>
</message> </message>
<message> <message>
<source>Create FEM mesh from shape</source> <source>Create FEM mesh from shape</source>
<translation>Создать МКЭ сетку из формы</translation> <translation>Создать МКЭ-сетку из формы</translation>
</message> </message>
</context> </context>
<context> <context>
@ -386,7 +386,7 @@
<message> <message>
<location filename="../../Command.cpp" line="750"/> <location filename="../../Command.cpp" line="750"/>
<source>Select a single FEM mesh or nodes set, please.</source> <source>Select a single FEM mesh or nodes set, please.</source>
<translation type="unfinished">Select a single FEM mesh or nodes set, please.</translation> <translation>Выберите одну МКЭ-сетку или набор узлов, пожалуйста.</translation>
</message> </message>
</context> </context>
<context> <context>
@ -488,12 +488,12 @@
<message> <message>
<location filename="../../DlgSettingsFem.ui" line="274"/> <location filename="../../DlgSettingsFem.ui" line="274"/>
<source>High frequency limit</source> <source>High frequency limit</source>
<translation>Ограничение высокой частоты</translation> <translation>Верхнее ограничение частоты</translation>
</message> </message>
<message> <message>
<location filename="../../DlgSettingsFem.ui" line="303"/> <location filename="../../DlgSettingsFem.ui" line="303"/>
<source>Low frequency limit</source> <source>Low frequency limit</source>
<translation>Ограничение низкой частоты</translation> <translation>Нижнее ограничение частоты</translation>
</message> </message>
<message> <message>
<location filename="../../DlgSettingsFem.ui" line="335"/> <location filename="../../DlgSettingsFem.ui" line="335"/>
@ -519,7 +519,7 @@
<message> <message>
<location filename="../../DlgSettingsFem.ui" line="394"/> <location filename="../../DlgSettingsFem.ui" line="394"/>
<source>Use materials from user defined directory</source> <source>Use materials from user defined directory</source>
<translation type="unfinished">Use materials from user defined directory</translation> <translation>Использовать материалы из каталога, определённого пользователем</translation>
</message> </message>
<message> <message>
<location filename="../../DlgSettingsFem.ui" line="449"/> <location filename="../../DlgSettingsFem.ui" line="449"/>
@ -535,7 +535,7 @@
</message> </message>
<message> <message>
<source>Quadrangle</source> <source>Quadrangle</source>
<translation>Четырехугольник</translation> <translation>Четырёхугольник</translation>
</message> </message>
<message> <message>
<source>Maximum length</source> <source>Maximum length</source>
@ -645,7 +645,7 @@
<message> <message>
<location filename="../../TaskDlgMeshShapeNetgen.cpp" line="75"/> <location filename="../../TaskDlgMeshShapeNetgen.cpp" line="75"/>
<source>Edit FEM mesh</source> <source>Edit FEM mesh</source>
<translation type="unfinished">Edit FEM mesh</translation> <translation>Редактировать МКЭ-сеть</translation>
</message> </message>
<message> <message>
<location filename="../../TaskDlgMeshShapeNetgen.cpp" line="106"/> <location filename="../../TaskDlgMeshShapeNetgen.cpp" line="106"/>
@ -666,7 +666,7 @@
<message> <message>
<location filename="../../TaskFemConstraint.cpp" line="67"/> <location filename="../../TaskFemConstraint.cpp" line="67"/>
<source>FEM constraint parameters</source> <source>FEM constraint parameters</source>
<translation>Параметры зависимостей МКЭ</translation> <translation>Параметры ограничений МКЭ</translation>
</message> </message>
</context> </context>
<context> <context>
@ -689,7 +689,7 @@
<message> <message>
<location filename="../../TaskFemConstraintBearing.cpp" line="174"/> <location filename="../../TaskFemConstraintBearing.cpp" line="174"/>
<source>Please use only a single reference for bearing constraint</source> <source>Please use only a single reference for bearing constraint</source>
<translation>Пожалуйста, используйте только одну ссылку для подшипников с ограничениями</translation> <translation>Пожалуйста, используйте только одну ссылку для ограничений подшипника</translation>
</message> </message>
<message> <message>
<location filename="../../TaskFemConstraintBearing.cpp" line="178"/> <location filename="../../TaskFemConstraintBearing.cpp" line="178"/>
@ -761,12 +761,12 @@
<message> <message>
<location filename="../../TaskFemConstraintFixed.cpp" line="135"/> <location filename="../../TaskFemConstraintFixed.cpp" line="135"/>
<source>Mixed shape types are not possible. Use a second constraint instead</source> <source>Mixed shape types are not possible. Use a second constraint instead</source>
<translation>Не возможны смешанные типы формы. Вместо этого используйте второе ограничение</translation> <translation>Не разрешены смешанные типы формы. Вместо этого используйте второе ограничение</translation>
</message> </message>
<message> <message>
<location filename="../../TaskFemConstraintFixed.cpp" line="140"/> <location filename="../../TaskFemConstraintFixed.cpp" line="140"/>
<source>Only faces, edges and vertices can be picked</source> <source>Only faces, edges and vertices can be picked</source>
<translation>Можно выбрать только грани, ребра и вершины</translation> <translation>Можно выбрать только грани, рёбра и вершины</translation>
</message> </message>
</context> </context>
<context> <context>
@ -803,12 +803,12 @@
<message> <message>
<location filename="../../TaskFemConstraintForce.cpp" line="176"/> <location filename="../../TaskFemConstraintForce.cpp" line="176"/>
<source>Mixed shape types are not possible. Use a second constraint instead</source> <source>Mixed shape types are not possible. Use a second constraint instead</source>
<translation>Не возможны смешанные типы формы. Вместо этого используйте второе ограничение</translation> <translation>Не разрешены смешанные типы формы. Вместо этого используйте второе ограничение</translation>
</message> </message>
<message> <message>
<location filename="../../TaskFemConstraintForce.cpp" line="182"/> <location filename="../../TaskFemConstraintForce.cpp" line="182"/>
<source>Only faces, edges and vertices can be picked</source> <source>Only faces, edges and vertices can be picked</source>
<translation>Можно выбрать только грани, ребра и вершины</translation> <translation>Можно выбрать только грани, рёбра и вершины</translation>
</message> </message>
<message> <message>
<location filename="../../TaskFemConstraintForce.cpp" line="213"/> <location filename="../../TaskFemConstraintForce.cpp" line="213"/>
@ -965,7 +965,7 @@
<location filename="../../../TaskPanelFemBeamSection.ui" line="55"/> <location filename="../../../TaskPanelFemBeamSection.ui" line="55"/>
<location filename="../../../TaskPanelFemShellThickness.ui" line="55"/> <location filename="../../../TaskPanelFemShellThickness.ui" line="55"/>
<source>Leave references blank </source> <source>Leave references blank </source>
<translation type="unfinished">Leave references blank </translation> <translation>Оставить ссылки пустыми </translation>
</message> </message>
<message> <message>
<location filename="../../../TaskPanelFemBeamSection.ui" line="62"/> <location filename="../../../TaskPanelFemBeamSection.ui" line="62"/>
@ -1000,7 +1000,7 @@
<message> <message>
<location filename="../../../TaskPanelFemSolverCalculix.ui" line="20"/> <location filename="../../../TaskPanelFemSolverCalculix.ui" line="20"/>
<source>Working directory</source> <source>Working directory</source>
<translation type="unfinished">Working directory</translation> <translation>Рабочий каталог</translation>
</message> </message>
<message> <message>
<location filename="../../../TaskPanelFemSolverCalculix.ui" line="45"/> <location filename="../../../TaskPanelFemSolverCalculix.ui" line="45"/>
@ -1010,12 +1010,12 @@
<message> <message>
<location filename="../../../TaskPanelFemSolverCalculix.ui" line="55"/> <location filename="../../../TaskPanelFemSolverCalculix.ui" line="55"/>
<source>Analysis type</source> <source>Analysis type</source>
<translation type="unfinished">Analysis type</translation> <translation>Тип анализа</translation>
</message> </message>
<message> <message>
<location filename="../../../TaskPanelFemSolverCalculix.ui" line="67"/> <location filename="../../../TaskPanelFemSolverCalculix.ui" line="67"/>
<source>Static</source> <source>Static</source>
<translation type="unfinished">Static</translation> <translation>Статический</translation>
</message> </message>
<message> <message>
<location filename="../../../TaskPanelFemSolverCalculix.ui" line="77"/> <location filename="../../../TaskPanelFemSolverCalculix.ui" line="77"/>
@ -1025,7 +1025,7 @@
<message> <message>
<location filename="../../../TaskPanelFemSolverCalculix.ui" line="89"/> <location filename="../../../TaskPanelFemSolverCalculix.ui" line="89"/>
<source>Write .inp file</source> <source>Write .inp file</source>
<translation type="unfinished">Write .inp file</translation> <translation>Записать файл .inp</translation>
</message> </message>
<message> <message>
<location filename="../../../TaskPanelFemSolverCalculix.ui" line="99"/> <location filename="../../../TaskPanelFemSolverCalculix.ui" line="99"/>
@ -1063,7 +1063,7 @@
<message> <message>
<location filename="../../../TaskPanelMechanicalMaterial.ui" line="33"/> <location filename="../../../TaskPanelMechanicalMaterial.ui" line="33"/>
<source>choose...</source> <source>choose...</source>
<translation>выберете...</translation> <translation>выберите...</translation>
</message> </message>
<message> <message>
<location filename="../../../TaskPanelMechanicalMaterial.ui" line="41"/> <location filename="../../../TaskPanelMechanicalMaterial.ui" line="41"/>
@ -1078,7 +1078,7 @@
<message> <message>
<location filename="../../../TaskPanelMechanicalMaterial.ui" line="60"/> <location filename="../../../TaskPanelMechanicalMaterial.ui" line="60"/>
<source>Leave references blank </source> <source>Leave references blank </source>
<translation type="unfinished">Leave references blank </translation> <translation>Оставить ссылки пустыми </translation>
</message> </message>
<message> <message>
<location filename="../../../TaskPanelMechanicalMaterial.ui" line="67"/> <location filename="../../../TaskPanelMechanicalMaterial.ui" line="67"/>
@ -1088,7 +1088,7 @@
<message> <message>
<location filename="../../../TaskPanelMechanicalMaterial.ui" line="77"/> <location filename="../../../TaskPanelMechanicalMaterial.ui" line="77"/>
<source>Add reference</source> <source>Add reference</source>
<translation type="unfinished">Add reference</translation> <translation>Добавить ссылку</translation>
</message> </message>
<message> <message>
<location filename="../../../TaskPanelMechanicalMaterial.ui" line="96"/> <location filename="../../../TaskPanelMechanicalMaterial.ui" line="96"/>
@ -1126,7 +1126,7 @@
</message> </message>
<message> <message>
<source>Pa</source> <source>Pa</source>
<translation>ПА</translation> <translation>Па</translation>
</message> </message>
</context> </context>
<context> <context>
@ -1134,7 +1134,7 @@
<message> <message>
<location filename="../../Command.cpp" line="71"/> <location filename="../../Command.cpp" line="71"/>
<source>No active Analysis</source> <source>No active Analysis</source>
<translation>Анализ не активен</translation> <translation>Нет активного анализа</translation>
</message> </message>
<message> <message>
<location filename="../../Command.cpp" line="72"/> <location filename="../../Command.cpp" line="72"/>
@ -1192,7 +1192,7 @@
</message> </message>
<message> <message>
<source>Combo View</source> <source>Combo View</source>
<translation>Комбо панель</translation> <translation>Комбинированный вид</translation>
</message> </message>
<message> <message>
<source>combiTab</source> <source>combiTab</source>
@ -1711,7 +1711,7 @@
<message> <message>
<location filename="../../TaskTetParameter.ui" line="28"/> <location filename="../../TaskTetParameter.ui" line="28"/>
<source>Max. Size:</source> <source>Max. Size:</source>
<translation type="unfinished">Max. Size:</translation> <translation>Макс. размер:</translation>
</message> </message>
<message> <message>
<location filename="../../TaskTetParameter.ui" line="44"/> <location filename="../../TaskTetParameter.ui" line="44"/>
@ -1726,17 +1726,17 @@
<message> <message>
<location filename="../../TaskTetParameter.ui" line="64"/> <location filename="../../TaskTetParameter.ui" line="64"/>
<source>VeryCoarse</source> <source>VeryCoarse</source>
<translation type="unfinished">VeryCoarse</translation> <translation>ОченьГрубо</translation>
</message> </message>
<message> <message>
<location filename="../../TaskTetParameter.ui" line="69"/> <location filename="../../TaskTetParameter.ui" line="69"/>
<source>Coarse</source> <source>Coarse</source>
<translation type="unfinished">Coarse</translation> <translation type="unfinished">Грубо</translation>
</message> </message>
<message> <message>
<location filename="../../TaskTetParameter.ui" line="74"/> <location filename="../../TaskTetParameter.ui" line="74"/>
<source>Moderate</source> <source>Moderate</source>
<translation type="unfinished">Moderate</translation> <translation type="unfinished">Средне</translation>
</message> </message>
<message> <message>
<location filename="../../TaskTetParameter.ui" line="79"/> <location filename="../../TaskTetParameter.ui" line="79"/>
@ -1776,7 +1776,7 @@
<message> <message>
<location filename="../../TaskTetParameter.ui" line="166"/> <location filename="../../TaskTetParameter.ui" line="166"/>
<source>Node count: </source> <source>Node count: </source>
<translation>Счетчик узлов: </translation> <translation>Счётчик узлов: </translation>
</message> </message>
<message> <message>
<location filename="../../TaskTetParameter.ui" line="180"/> <location filename="../../TaskTetParameter.ui" line="180"/>

View File

@ -70,6 +70,7 @@
#include <App/Document.h> #include <App/Document.h>
#include <App/DocumentObjectPy.h> #include <App/DocumentObjectPy.h>
#include <Mod/Part/App/PartFeature.h> #include <Mod/Part/App/PartFeature.h>
#include <Mod/Part/App/FeatureCompound.h>
#include <Mod/Part/App/ProgressIndicator.h> #include <Mod/Part/App/ProgressIndicator.h>
#include <Mod/Part/App/ImportIges.h> #include <Mod/Part/App/ImportIges.h>
#include <Mod/Part/App/ImportStep.h> #include <Mod/Part/App/ImportStep.h>
@ -193,21 +194,28 @@ void ImportOCAF::loadShapes(const TDF_Label& label, const TopLoc_Location& loc,
void ImportOCAF::createShape(const TDF_Label& label, const TopLoc_Location& loc, const std::string& name) void ImportOCAF::createShape(const TDF_Label& label, const TopLoc_Location& loc, const std::string& name)
{ {
const TopoDS_Shape& aShape = aShapeTool->GetShape(label); const TopoDS_Shape& aShape = aShapeTool->GetShape(label);
std::vector<App::DocumentObject*> lValue;
if (!aShape.IsNull() && aShape.ShapeType() == TopAbs_COMPOUND) { if (!aShape.IsNull() && aShape.ShapeType() == TopAbs_COMPOUND) {
TopExp_Explorer xp; TopExp_Explorer xp;
int ctSolids = 0, ctShells = 0; int ctSolids = 0, ctShells = 0;
Part::Compound *pcCompound = static_cast<Part::Compound*>(doc->addObject
("Part::Compound",name.c_str() ));
for (xp.Init(aShape, TopAbs_SOLID); xp.More(); xp.Next(), ctSolids++) for (xp.Init(aShape, TopAbs_SOLID); xp.More(); xp.Next(), ctSolids++)
createShape(xp.Current(), loc, name); createShape(xp.Current(), loc, name, lValue);
for (xp.Init(aShape, TopAbs_SHELL, TopAbs_SOLID); xp.More(); xp.Next(), ctShells++) for (xp.Init(aShape, TopAbs_SHELL, TopAbs_SOLID); xp.More(); xp.Next(), ctShells++)
createShape(xp.Current(), loc, name); createShape(xp.Current(), loc, name, lValue);
pcCompound->Links.setValues(lValue);
if (ctSolids > 0 || ctShells > 0) if (ctSolids > 0 || ctShells > 0)
return; return;
} }
createShape(aShape, loc, name); createShape(aShape, loc, name, lValue);
} }
void ImportOCAF::createShape(const TopoDS_Shape& aShape, const TopLoc_Location& loc, const std::string& name) void ImportOCAF::createShape(const TopoDS_Shape& aShape, const TopLoc_Location& loc, const std::string& name,
std::vector<App::DocumentObject*>& lvalue)
{ {
Part::Feature* part = static_cast<Part::Feature*>(doc->addObject("Part::Feature")); Part::Feature* part = static_cast<Part::Feature*>(doc->addObject("Part::Feature"));
if (!loc.IsIdentity()) if (!loc.IsIdentity())
@ -215,6 +223,7 @@ void ImportOCAF::createShape(const TopoDS_Shape& aShape, const TopLoc_Location&
else else
part->Shape.setValue(aShape); part->Shape.setValue(aShape);
part->Label.setValue(name); part->Label.setValue(name);
lvalue.push_back(part);
Quantity_Color aColor; Quantity_Color aColor;
App::Color color(0.8f,0.8f,0.8f); App::Color color(0.8f,0.8f,0.8f);

View File

@ -59,7 +59,7 @@ public:
private: private:
void loadShapes(const TDF_Label& label, const TopLoc_Location&, const std::string& partname, const std::string& assembly, bool isRef); void loadShapes(const TDF_Label& label, const TopLoc_Location&, const std::string& partname, const std::string& assembly, bool isRef);
void createShape(const TDF_Label& label, const TopLoc_Location&, const std::string&); void createShape(const TDF_Label& label, const TopLoc_Location&, const std::string&);
void createShape(const TopoDS_Shape& label, const TopLoc_Location&, const std::string&); void createShape(const TopoDS_Shape& label, const TopLoc_Location&, const std::string&, std::vector<App::DocumentObject*> &);
virtual void applyColors(Part::Feature*, const std::vector<App::Color>&){} virtual void applyColors(Part::Feature*, const std::vector<App::Color>&){}
private: private:

View File

@ -186,7 +186,7 @@ Intersection of this and a given list of topo shapes.
Supports: Supports:
- Fuzzy Boolean operations (global tolerance for a Boolean operation) - Fuzzy Boolean operations (global tolerance for a Boolean operation)
- Support of multiple arguments for a single Boolean operation (s1 AND (s2 OR s2)) - Support of multiple arguments for a single Boolean operation (s1 AND (s2 OR s3))
- Parallelization of Boolean Operations algorithm - Parallelization of Boolean Operations algorithm
OCC 6.9.0 or later is required.</UserDocu> OCC 6.9.0 or later is required.</UserDocu>
@ -203,7 +203,7 @@ Section of this and a given list of topo shapes.
Supports: Supports:
- Fuzzy Boolean operations (global tolerance for a Boolean operation) - Fuzzy Boolean operations (global tolerance for a Boolean operation)
- Support of multiple arguments for a single Boolean operation - Support of multiple arguments for a single Boolean operation (s1 AND (s2 OR s3))
- Parallelization of Boolean Operations algorithm - Parallelization of Boolean Operations algorithm
OCC 6.9.0 or later is required.</UserDocu> OCC 6.9.0 or later is required.</UserDocu>

View File

@ -37,18 +37,18 @@ if FreeCAD.GuiUp:
#-------------------------- translation-related code ---------------------------------------- #-------------------------- translation-related code ----------------------------------------
#(see forum thread "A new Part tool is being born... JoinFeatures!" #(see forum thread "A new Part tool is being born... JoinFeatures!"
#http://forum.freecadweb.org/viewtopic.php?f=22&t=11112&start=30#p90239 ) #http://forum.freecadweb.org/viewtopic.php?f=22&t=11112&start=30#p90239 )
try: try:
_fromUtf8 = QtCore.QString.fromUtf8 _fromUtf8 = QtCore.QString.fromUtf8
except Exception: except Exception:
def _fromUtf8(s): def _fromUtf8(s):
return s return s
try: try:
_encoding = QtGui.QApplication.UnicodeUTF8 _encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig): def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding) return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError: except AttributeError:
def _translate(context, text, disambig): def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig) return QtGui.QApplication.translate(context, text, disambig)
#--------------------------/translation-related code ---------------------------------------- #--------------------------/translation-related code ----------------------------------------
def getIconPath(icon_dot_svg): def getIconPath(icon_dot_svg):

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>334</width> <width>334</width>
<height>313</height> <height>327</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -98,7 +98,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>334</width> <width>334</width>
<height>313</height> <height>327</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -148,7 +148,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>334</width> <width>334</width>
<height>313</height> <height>327</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
@ -206,7 +206,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>334</width> <width>334</width>
<height>313</height> <height>327</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -277,30 +277,6 @@
<item row="3" column="1"> <item row="3" column="1">
<widget class="QWidget" name="widget_4" native="true"> <widget class="QWidget" name="widget_4" native="true">
<layout class="QGridLayout" name="gridLayout_6"> <layout class="QGridLayout" name="gridLayout_6">
<item row="3" column="2">
<widget class="QDoubleSpinBox" name="plungeAngle"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Plunge Angle</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Roll Radius</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Segment Length</string>
</property>
</widget>
</item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
<property name="text"> <property name="text">
@ -309,7 +285,14 @@
</widget> </widget>
</item> </item>
<item row="1" column="2"> <item row="1" column="2">
<widget class="QDoubleSpinBox" name="segLen"/> <widget class="Gui::InputField" name="rollRadius">
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
</widget>
</item> </item>
<item row="0" column="2"> <item row="0" column="2">
<widget class="Gui::InputField" name="extraOffset"> <widget class="Gui::InputField" name="extraOffset">
@ -321,13 +304,24 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="2"> <item row="1" column="0">
<widget class="Gui::InputField" name="rollRadius"> <widget class="QLabel" name="label_11">
<property name="minimum"> <property name="text">
<double>0.000000000000000</double> <string>Roll Radius</string>
</property> </property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Plunge Angle</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="Gui::InputField" name="plungeAngle">
<property name="unit" stdset="0"> <property name="unit" stdset="0">
<string notr="true">mm</string> <string notr="true"/>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -34,7 +34,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>304</width> <width>304</width>
<height>367</height> <height>375</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -111,8 +111,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>304</width> <width>109</width>
<height>367</height> <height>82</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -172,8 +172,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>304</width> <width>144</width>
<height>367</height> <height>82</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -233,8 +233,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>304</width> <width>223</width>
<height>367</height> <height>31</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">

View File

@ -34,7 +34,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>303</width> <width>303</width>
<height>366</height> <height>374</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -111,8 +111,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>303</width> <width>109</width>
<height>366</height> <height>56</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -158,8 +158,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>303</width> <width>144</width>
<height>366</height> <height>56</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -205,8 +205,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>303</width> <width>223</width>
<height>366</height> <height>31</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">

View File

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>374</width> <width>340</width>
<height>453</height> <height>453</height>
</rect> </rect>
</property> </property>
@ -33,8 +33,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>340</width> <width>322</width>
<height>277</height> <height>259</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -111,8 +111,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>356</width> <width>322</width>
<height>124</height> <height>108</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -123,6 +123,9 @@
<string>Depths</string> <string>Depths</string>
</attribute> </attribute>
<layout class="QFormLayout" name="formLayout_3"> <layout class="QFormLayout" name="formLayout_3">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="Gui::InputField" name="startDepth"> <widget class="Gui::InputField" name="startDepth">
<property name="unit" stdset="0"> <property name="unit" stdset="0">
@ -165,19 +168,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0">
<widget class="QDoubleSpinBox" name="stepDown">
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="3" column="1"> <item row="3" column="1">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
@ -185,6 +175,16 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0">
<widget class="Gui::InputField" name="stepDown">
<property name="text">
<string>0 mm</string>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="Heights"> <widget class="QWidget" name="Heights">
@ -192,8 +192,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>356</width> <width>144</width>
<height>95</height> <height>56</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -242,8 +242,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>356</width> <width>261</width>
<height>296</height> <height>191</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -309,6 +309,13 @@
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QGridLayout" name="gridLayout_6"> <layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="2">
<widget class="Gui::QuantitySpinBox" name="zigZagAngle">
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QCheckBox" name="useZigZag"> <widget class="QCheckBox" name="useZigZag">
<property name="text"> <property name="text">
@ -316,16 +323,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<widget class="QLabel" name="label_10">
<property name="text">
<string>ZigZag Angle</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QSpinBox" name="zigZagAngle"/>
</item>
<item row="1" column="0" colspan="2"> <item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="zigZagUnidirectional"> <widget class="QCheckBox" name="zigZagUnidirectional">
<property name="text"> <property name="text">
@ -333,6 +330,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<widget class="QLabel" name="label_10">
<property name="text">
<string>ZigZag Angle</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -409,6 +413,11 @@
<extends>QLineEdit</extends> <extends>QLineEdit</extends>
<header>Gui/InputField.h</header> <header>Gui/InputField.h</header>
</customwidget> </customwidget>
<customwidget>
<class>Gui::QuantitySpinBox</class>
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../Path.qrc"/> <include location="../Path.qrc"/>

View File

@ -29,7 +29,7 @@
<item row="0" column="0"> <item row="0" column="0">
<widget class="QToolBox" name="toolBox"> <widget class="QToolBox" name="toolBox">
<property name="currentIndex"> <property name="currentIndex">
<number>5</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="Geometry"> <widget class="QWidget" name="Geometry">
<property name="enabled"> <property name="enabled">
@ -40,7 +40,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>334</width> <width>334</width>
<height>321</height> <height>343</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -117,8 +117,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>334</width> <width>114</width>
<height>321</height> <height>108</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -195,8 +195,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>334</width> <width>144</width>
<height>321</height> <height>56</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -245,8 +245,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>334</width> <width>94</width>
<height>321</height> <height>24</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
@ -259,8 +259,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>334</width> <width>178</width>
<height>321</height> <height>120</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
@ -299,6 +299,9 @@
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QFormLayout" name="formLayout_4"> <layout class="QFormLayout" name="formLayout_4">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0" colspan="2"> <item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="useZigZag"> <widget class="QCheckBox" name="useZigZag">
<property name="text"> <property name="text">
@ -313,9 +316,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0">
<widget class="QSpinBox" name="zigZagAngle"/>
</item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QLabel" name="label_10"> <widget class="QLabel" name="label_10">
<property name="text"> <property name="text">
@ -323,6 +323,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0">
<widget class="Gui::InputField" name="zigZagAngle">
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -334,7 +341,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>334</width> <width>334</width>
<height>321</height> <height>343</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">

View File

@ -23,7 +23,7 @@
<item row="0" column="0"> <item row="0" column="0">
<widget class="QToolBox" name="toolBox"> <widget class="QToolBox" name="toolBox">
<property name="currentIndex"> <property name="currentIndex">
<number>4</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="Geometry"> <widget class="QWidget" name="Geometry">
<property name="enabled"> <property name="enabled">
@ -34,7 +34,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>334</width> <width>334</width>
<height>313</height> <height>330</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -111,8 +111,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>334</width> <width>109</width>
<height>313</height> <height>82</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -181,8 +181,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>334</width> <width>144</width>
<height>313</height> <height>56</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -231,8 +231,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>334</width> <width>160</width>
<height>313</height> <height>111</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
@ -288,9 +288,9 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>-15</y> <y>0</y>
<width>320</width> <width>278</width>
<height>338</height> <height>214</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -334,8 +334,12 @@
<item row="3" column="1"> <item row="3" column="1">
<widget class="QWidget" name="widget_4" native="true"> <widget class="QWidget" name="widget_4" native="true">
<layout class="QGridLayout" name="gridLayout_6"> <layout class="QGridLayout" name="gridLayout_6">
<item row="1" column="2"> <item row="2" column="2">
<widget class="QDoubleSpinBox" name="segLen"/> <widget class="Gui::InputField" name="plungeAngle">
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item> </item>
<item row="0" column="2"> <item row="0" column="2">
<widget class="Gui::InputField" name="extraOffset"> <widget class="Gui::InputField" name="extraOffset">
@ -348,29 +352,19 @@
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Segment Length</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_11"> <widget class="QLabel" name="label_11">
<property name="text"> <property name="text">
<string>Roll Radius</string> <string>Roll Radius</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_13"> <widget class="QLabel" name="label_13">
<property name="text"> <property name="text">
<string>Plunge Angle</string> <string>Plunge Angle</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="2">
<widget class="QDoubleSpinBox" name="plungeAngle"/>
</item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
<property name="text"> <property name="text">
@ -378,7 +372,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="2"> <item row="1" column="2">
<widget class="Gui::InputField" name="rollRadius"> <widget class="Gui::InputField" name="rollRadius">
<property name="minimum"> <property name="minimum">
<double>0.000000000000000</double> <double>0.000000000000000</double>

View File

@ -23,7 +23,7 @@
<item row="0" column="0"> <item row="0" column="0">
<widget class="QToolBox" name="toolBox"> <widget class="QToolBox" name="toolBox">
<property name="currentIndex"> <property name="currentIndex">
<number>4</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="Geometry"> <widget class="QWidget" name="Geometry">
<property name="enabled"> <property name="enabled">
@ -34,7 +34,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>381</width> <width>381</width>
<height>346</height> <height>363</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -111,8 +111,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>381</width> <width>109</width>
<height>346</height> <height>82</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -178,8 +178,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>381</width> <width>144</width>
<height>346</height> <height>56</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -228,8 +228,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>381</width> <width>160</width>
<height>346</height> <height>111</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
@ -285,9 +285,9 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>-28</y> <y>0</y>
<width>367</width> <width>274</width>
<height>384</height> <height>251</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -345,7 +345,7 @@
<item row="5" column="0" colspan="2"> <item row="5" column="0" colspan="2">
<widget class="QWidget" name="widget_4" native="true"> <widget class="QWidget" name="widget_4" native="true">
<layout class="QGridLayout" name="gridLayout_6"> <layout class="QGridLayout" name="gridLayout_6">
<item row="3" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_13"> <widget class="QLabel" name="label_13">
<property name="text"> <property name="text">
<string>Plunge Angle</string> <string>Plunge Angle</string>
@ -360,22 +360,12 @@
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Segment Length</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_11"> <widget class="QLabel" name="label_11">
<property name="text"> <property name="text">
<string>Roll Radius</string> <string>Roll Radius</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="2">
<widget class="QDoubleSpinBox" name="plungeAngle"/>
</item>
<item row="0" column="2"> <item row="0" column="2">
<widget class="Gui::InputField" name="extraOffset"> <widget class="Gui::InputField" name="extraOffset">
<property name="minimum"> <property name="minimum">
@ -387,9 +377,6 @@
</widget> </widget>
</item> </item>
<item row="1" column="2"> <item row="1" column="2">
<widget class="QDoubleSpinBox" name="segLen"/>
</item>
<item row="2" column="2">
<widget class="Gui::InputField" name="rollRadius"> <widget class="Gui::InputField" name="rollRadius">
<property name="minimum"> <property name="minimum">
<double>0.000000000000000</double> <double>0.000000000000000</double>
@ -399,6 +386,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="2">
<widget class="Gui::InputField" name="plungeAngle">
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -34,7 +34,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>334</width> <width>334</width>
<height>387</height> <height>395</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -112,7 +112,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>334</width> <width>334</width>
<height>387</height> <height>395</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -165,19 +165,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0">
<widget class="QDoubleSpinBox" name="stepDown">
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="3" column="1"> <item row="3" column="1">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
@ -185,6 +172,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0">
<widget class="Gui::InputField" name="stepDown">
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="Heights"> <widget class="QWidget" name="Heights">
@ -192,8 +186,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>334</width> <width>144</width>
<height>387</height> <height>56</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -242,8 +236,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>334</width> <width>203</width>
<height>387</height> <height>31</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">

View File

@ -94,7 +94,7 @@ class ObjectContour:
obj.addProperty("App::PropertyDistance", "RollRadius", "Contour", QtCore.QT_TRANSLATE_NOOP("App::Property","Radius at start and end")) obj.addProperty("App::PropertyDistance", "RollRadius", "Contour", QtCore.QT_TRANSLATE_NOOP("App::Property","Radius at start and end"))
obj.addProperty("App::PropertyDistance", "OffsetExtra", "Contour", QtCore.QT_TRANSLATE_NOOP("App::Property","Extra value to stay away from final Contour- good for roughing toolpath")) obj.addProperty("App::PropertyDistance", "OffsetExtra", "Contour", QtCore.QT_TRANSLATE_NOOP("App::Property","Extra value to stay away from final Contour- good for roughing toolpath"))
obj.addProperty("App::PropertyLength", "SegLen", "Contour", QtCore.QT_TRANSLATE_NOOP("App::Property","Tesselation value for tool paths made from beziers, bsplines, and ellipses")) #obj.addProperty("App::PropertyLength", "SegLen", "Contour", QtCore.QT_TRANSLATE_NOOP("App::Property","Tesselation value for tool paths made from beziers, bsplines, and ellipses"))
obj.addProperty("App::PropertyAngle", "PlungeAngle", "Contour", QtCore.QT_TRANSLATE_NOOP("App::Property","Plunge angle with which the tool enters the work piece. Straight down is 90 degrees, if set small enough or zero the tool will descent exactly one layer depth down per turn")) obj.addProperty("App::PropertyAngle", "PlungeAngle", "Contour", QtCore.QT_TRANSLATE_NOOP("App::Property","Plunge angle with which the tool enters the work piece. Straight down is 90 degrees, if set small enough or zero the tool will descent exactly one layer depth down per turn"))
obj.addProperty("App::PropertyVectorList", "locs", "Tags", QtCore.QT_TRANSLATE_NOOP("App::Property","List of holding tag locations")) obj.addProperty("App::PropertyVectorList", "locs", "Tags", QtCore.QT_TRANSLATE_NOOP("App::Property","List of holding tag locations"))
@ -439,23 +439,23 @@ class TaskPanel:
def getFields(self): def getFields(self):
if self.obj: if self.obj:
if hasattr(self.obj, "StartDepth"): if hasattr(self.obj, "StartDepth"):
self.obj.StartDepth = self.form.startDepth.text() self.obj.StartDepth = FreeCAD.Units.Quantity(self.form.startDepth.text()).Value
if hasattr(self.obj, "FinalDepth"): if hasattr(self.obj, "FinalDepth"):
self.obj.FinalDepth = self.form.finalDepth.text() self.obj.FinalDepth = FreeCAD.Units.Quantity(self.form.finalDepth.text()).Value
if hasattr(self.obj, "SafeHeight"): if hasattr(self.obj, "SafeHeight"):
self.obj.SafeHeight = self.form.safeHeight.text() self.obj.SafeHeight = FreeCAD.Units.Quantity(self.form.safeHeight.text()).Value
if hasattr(self.obj, "ClearanceHeight"): if hasattr(self.obj, "ClearanceHeight"):
self.obj.ClearanceHeight = self.form.clearanceHeight.text() self.obj.ClearanceHeight = FreeCAD.Units.Quantity(self.form.clearanceHeight.text()).Value
if hasattr(self.obj, "StepDown"): if hasattr(self.obj, "StepDown"):
self.obj.StepDown = self.form.stepDown.text() self.obj.StepDown = FreeCAD.Units.Quantity(self.form.stepDown.text()).Value
if hasattr(self.obj, "OffsetExtra"): if hasattr(self.obj, "OffsetExtra"):
self.obj.OffsetExtra = self.form.extraOffset.text() self.obj.OffsetExtra = FreeCAD.Units.Quantity(self.form.extraOffset.text()).Value
if hasattr(self.obj, "SegLen"): #if hasattr(self.obj, "SegLen"):
self.obj.SegLen = self.form.segLen.value() # self.obj.SegLen = self.form.segLen.value()
if hasattr(self.obj, "RollRadius"): if hasattr(self.obj, "RollRadius"):
self.obj.RollRadius = self.form.rollRadius.text() self.obj.RollRadius = FreeCAD.Units.Quantity(self.form.rollRadius.text()).Value
if hasattr(self.obj, "PlungeAngle"): if hasattr(self.obj, "PlungeAngle"):
self.obj.PlungeAngle = str(self.form.plungeAngle.value()) self.obj.PlungeAngle = FreeCAD.Units.Quantity(self.form.plungeAngle.text()).Value
if hasattr(self.obj, "UseComp"): if hasattr(self.obj, "UseComp"):
self.obj.UseComp = self.form.useCompensation.isChecked() self.obj.UseComp = self.form.useCompensation.isChecked()
if hasattr(self.obj, "UseStartPoint"): if hasattr(self.obj, "UseStartPoint"):
@ -467,15 +467,15 @@ class TaskPanel:
self.obj.Proxy.execute(self.obj) self.obj.Proxy.execute(self.obj)
def setFields(self): def setFields(self):
self.form.startDepth.setText(str(self.obj.StartDepth.Value)) self.form.startDepth.setText(FreeCAD.Units.Quantity(self.obj.StartDepth.Value, FreeCAD.Units.Length).UserString)
self.form.finalDepth.setText(str(self.obj.FinalDepth.Value)) self.form.finalDepth.setText(FreeCAD.Units.Quantity(self.obj.FinalDepth.Value, FreeCAD.Units.Length).UserString)
self.form.safeHeight.setText(str(self.obj.SafeHeight.Value)) self.form.safeHeight.setText(FreeCAD.Units.Quantity(self.obj.SafeHeight.Value, FreeCAD.Units.Length).UserString)
self.form.clearanceHeight.setText(str(self.obj.ClearanceHeight.Value)) self.form.clearanceHeight.setText(FreeCAD.Units.Quantity(self.obj.ClearanceHeight.Value, FreeCAD.Units.Length).UserString)
self.form.stepDown.setText(str(self.obj.StepDown.Value)) self.form.stepDown.setText(FreeCAD.Units.Quantity(self.obj.StepDown.Value, FreeCAD.Units.Length).UserString)
self.form.extraOffset.setText(str(self.obj.OffsetExtra.Value)) self.form.extraOffset.setText(FreeCAD.Units.Quantity(self.obj.OffsetExtra.Value, FreeCAD.Units.Length).UserString)
self.form.segLen.setValue(self.obj.SegLen.Value) #self.form.segLen.setValue(self.obj.SegLen.Value)
self.form.rollRadius.setText(str(self.obj.RollRadius.Value)) self.form.rollRadius.setText(FreeCAD.Units.Quantity(self.obj.RollRadius.Value, FreeCAD.Units.Length).UserString)
self.form.plungeAngle.setValue(self.obj.PlungeAngle.Value) self.form.plungeAngle.setText(FreeCAD.Units.Quantity(self.obj.PlungeAngle.Value, FreeCAD.Units.Angle).UserString)
self.form.useCompensation.setChecked(self.obj.UseComp) self.form.useCompensation.setChecked(self.obj.UseComp)
self.form.useStartPoint.setChecked(self.obj.UseStartPoint) self.form.useStartPoint.setChecked(self.obj.UseStartPoint)
self.form.useEndPoint.setChecked(self.obj.UseEndPoint) self.form.useEndPoint.setChecked(self.obj.UseEndPoint)
@ -609,7 +609,7 @@ class TaskPanel:
self.form.useStartPoint.clicked.connect(self.getFields) self.form.useStartPoint.clicked.connect(self.getFields)
self.form.useEndPoint.clicked.connect(self.getFields) self.form.useEndPoint.clicked.connect(self.getFields)
self.form.extraOffset.editingFinished.connect(self.getFields) self.form.extraOffset.editingFinished.connect(self.getFields)
self.form.segLen.editingFinished.connect(self.getFields) #self.form.segLen.editingFinished.connect(self.getFields)
self.form.rollRadius.editingFinished.connect(self.getFields) self.form.rollRadius.editingFinished.connect(self.getFields)
# Tag Form # Tag Form

View File

@ -400,27 +400,27 @@ class TaskPanel:
def getFields(self): def getFields(self):
if self.obj: if self.obj:
if hasattr(self.obj, "StartDepth"): if hasattr(self.obj, "StartDepth"):
self.obj.StartDepth = self.form.startDepth.text() self.obj.StartDepth = FreeCAD.Units.Quantity(self.form.startDepth.text()).Value
if hasattr(self.obj, "FinalDepth"): if hasattr(self.obj, "FinalDepth"):
self.obj.FinalDepth = self.form.finalDepth.text() self.obj.FinalDepth = FreeCAD.Units.Quantity(self.form.finalDepth.text()).Value
if hasattr(self.obj, "PeckDepth"): if hasattr(self.obj, "PeckDepth"):
self.obj.PeckDepth = self.form.peckDepth.text() self.obj.PeckDepth = FreeCAD.Units.Quantity(self.form.peckDepth.text()).Value
if hasattr(self.obj, "SafeHeight"): if hasattr(self.obj, "SafeHeight"):
self.obj.SafeHeight = self.form.safeHeight.text() self.obj.SafeHeight = FreeCAD.Units.Quantity(self.form.safeHeight.text()).Value
if hasattr(self.obj, "ClearanceHeight"): if hasattr(self.obj, "ClearanceHeight"):
self.obj.ClearanceHeight = self.form.clearanceHeight.text() self.obj.ClearanceHeight = FreeCAD.Units.Quantity(self.form.clearanceHeight.text()).Value
if hasattr(self.obj, "RetractHeight"): if hasattr(self.obj, "RetractHeight"):
self.obj.RetractHeight = self.form.retractHeight.text() self.obj.RetractHeight = FreeCAD.Units.Quantity(self.form.retractHeight.text()).Value
self.obj.Proxy.execute(self.obj) self.obj.Proxy.execute(self.obj)
def setFields(self): def setFields(self):
self.form.startDepth.setText(str(self.obj.StartDepth.Value)) self.form.startDepth.setText(FreeCAD.Units.Quantity(self.obj.StartDepth.Value, FreeCAD.Units.Length).UserString)
self.form.finalDepth.setText(str(self.obj.FinalDepth.Value)) self.form.finalDepth.setText(FreeCAD.Units.Quantity(self.obj.FinalDepth.Value, FreeCAD.Units.Length).UserString)
self.form.peckDepth.setText(str(self.obj.PeckDepth.Value)) self.form.peckDepth.setText(FreeCAD.Units.Quantity(self.obj.PeckDepth.Value, FreeCAD.Units.Length).UserString)
self.form.safeHeight.setText(str(self.obj.SafeHeight.Value)) self.form.safeHeight.setText(FreeCAD.Units.Quantity(self.obj.SafeHeight.Value, FreeCAD.Units.Length).UserString)
self.form.clearanceHeight.setText(str(self.obj.ClearanceHeight.Value)) self.form.clearanceHeight.setText(FreeCAD.Units.Quantity(self.obj.ClearanceHeight.Value, FreeCAD.Units.Length).UserString)
self.form.retractHeight.setText(str(self.obj.RetractHeight.Value)) self.form.retractHeight.setText(FreeCAD.Units.Quantity(self.obj.RetractHeight.Value, FreeCAD.Units.Length).UserString)
self.form.baseList.clear() self.form.baseList.clear()
for i in self.obj.Base: for i in self.obj.Base:

View File

@ -320,18 +320,18 @@ class TaskPanel:
def getFields(self): def getFields(self):
if self.obj: if self.obj:
if hasattr(self.obj, "FinalDepth"): if hasattr(self.obj, "FinalDepth"):
self.obj.FinalDepth = self.form.finalDepth.text() self.obj.FinalDepth = FreeCAD.Units.Quantity(self.form.finalDepth.text()).Value
if hasattr(self.obj, "SafeHeight"): if hasattr(self.obj, "SafeHeight"):
self.obj.SafeHeight = self.form.safeHeight.text() self.obj.SafeHeight = FreeCAD.Units.Quantity(self.form.safeHeight.text()).Value
if hasattr(self.obj, "ClearanceHeight"): if hasattr(self.obj, "ClearanceHeight"):
self.obj.ClearanceHeight = self.form.clearanceHeight.text() self.obj.ClearanceHeight = FreeCAD.Units.Quantity(self.form.clearanceHeight.text()).Value
self.obj.Proxy.execute(self.obj) self.obj.Proxy.execute(self.obj)
def setFields(self): def setFields(self):
self.form.finalDepth.setText(str(self.obj.FinalDepth.Value)) self.form.finalDepth.setText(FreeCAD.Units.Quantity(self.obj.FinalDepth.Value, FreeCAD.Units.Length).UserString)
self.form.safeHeight.setText(str(self.obj.SafeHeight.Value)) self.form.safeHeight.setText(FreeCAD.Units.Quantity(self.obj.SafeHeight.Value, FreeCAD.Units.Length).UserString)
self.form.clearanceHeight.setText(str(self.obj.ClearanceHeight.Value)) self.form.clearanceHeight.setText(FreeCAD.Units.Quantity(self.obj.ClearanceHeight.Value, FreeCAD.Units.Length).UserString)
self.form.baseList.clear() self.form.baseList.clear()
for i in self.obj.Base: for i in self.obj.Base:

View File

@ -420,19 +420,20 @@ class TaskPanel:
def getFields(self): def getFields(self):
if self.obj: if self.obj:
if hasattr(self.obj, "StartDepth"): if hasattr(self.obj, "StartDepth"):
self.obj.StartDepth = self.form.startDepth.text() self.obj.StartDepth = FreeCAD.Units.Quantity(self.form.startDepth.text()).Value
if hasattr(self.obj, "FinalDepth"): if hasattr(self.obj, "FinalDepth"):
self.obj.FinalDepth = self.form.finalDepth.text() self.obj.FinalDepth = FreeCAD.Units.Quantity(self.form.finalDepth.text()).Value
if hasattr(self.obj, "FinishDepth"): if hasattr(self.obj, "FinishDepth"):
self.obj.FinishDepth = self.form.finishDepth.text() self.obj.FinishDepth = FreeCAD.Units.Quantity(self.form.finishDepth.text()).Value
if hasattr(self.obj, "SafeHeight"): if hasattr(self.obj, "SafeHeight"):
self.obj.SafeHeight = self.form.safeHeight.text() self.obj.SafeHeight = FreeCAD.Units.Quantity(self.form.safeHeight.text()).Value
if hasattr(self.obj, "ClearanceHeight"): if hasattr(self.obj, "ClearanceHeight"):
self.obj.ClearanceHeight = self.form.clearanceHeight.text() self.obj.ClearanceHeight = FreeCAD.Units.Quantity(self.form.clearanceHeight.text()).Value
if hasattr(self.obj, "StepDown"): if hasattr(self.obj, "StepDown"):
self.obj.StepDown = self.form.stepDown.value() self.obj.StepDown = FreeCAD.Units.Quantity(self.form.stepDown.text()).Value
if hasattr(self.obj, "PassExtension"): if hasattr(self.obj, "PassExtension"):
self.obj.PassExtension = self.form.extraOffset.value() self.obj.PassExtension = FreeCAD.Units.Quantity(self.form.extraOffset.text()).Value
# if hasattr(self.obj, "UseStartPoint"): # if hasattr(self.obj, "UseStartPoint"):
# self.obj.UseStartPoint = self.form.useStartPoint.isChecked() # self.obj.UseStartPoint = self.form.useStartPoint.isChecked()
if hasattr(self.obj, "CutMode"): if hasattr(self.obj, "CutMode"):
@ -442,7 +443,9 @@ class TaskPanel:
if hasattr(self.obj, "ZigUnidirectional"): if hasattr(self.obj, "ZigUnidirectional"):
self.obj.ZigUnidirectional = self.form.zigZagUnidirectional.isChecked() self.obj.ZigUnidirectional = self.form.zigZagUnidirectional.isChecked()
if hasattr(self.obj, "ZigZagAngle"): if hasattr(self.obj, "ZigZagAngle"):
self.obj.ZigZagAngle = self.form.zigZagAngle.value() self.obj.ZigZagAngle = FreeCAD.Units.Quantity(self.form.zigZagAngle.text()).Value
# if hasattr(self.obj, "ZigZagAngle"):
# self.obj.ZigZagAngle = self.form.zigZagAngle.value()
if hasattr(self.obj, "StepOver"): if hasattr(self.obj, "StepOver"):
self.obj.StepOver = self.form.stepOverPercent.value() self.obj.StepOver = self.form.stepOverPercent.value()
if hasattr(self.obj, "BoundaryShape"): if hasattr(self.obj, "BoundaryShape"):
@ -451,16 +454,18 @@ class TaskPanel:
self.obj.Proxy.execute(self.obj) self.obj.Proxy.execute(self.obj)
def setFields(self): def setFields(self):
self.form.startDepth.setText(str(self.obj.StartDepth.Value)) self.form.startDepth.setText(FreeCAD.Units.Quantity(self.obj.StartDepth.Value, FreeCAD.Units.Length).UserString)
self.form.finalDepth.setText(str(self.obj.FinalDepth.Value)) self.form.finalDepth.setText(FreeCAD.Units.Quantity(self.obj.FinalDepth.Value, FreeCAD.Units.Length).UserString)
self.form.finishDepth.setText(str(self.obj.FinishDepth.Value)) self.form.finishDepth.setText(FreeCAD.Units.Quantity(self.obj.FinishDepth.Value, FreeCAD.Units.Length).UserString)
self.form.stepDown.setValue(self.obj.StepDown) self.form.stepDown.setText(FreeCAD.Units.Quantity(self.obj.StepDown, FreeCAD.Units.Length).UserString)
self.form.safeHeight.setText(str(self.obj.SafeHeight.Value)) self.form.safeHeight.setText(FreeCAD.Units.Quantity(self.obj.SafeHeight.Value, FreeCAD.Units.Length).UserString)
self.form.clearanceHeight.setText(str(self.obj.ClearanceHeight.Value)) self.form.clearanceHeight.setText(FreeCAD.Units.Quantity(self.obj.ClearanceHeight.Value, FreeCAD.Units.Length).UserString)
self.form.stepOverPercent.setValue(self.obj.StepOver) self.form.stepOverPercent.setValue(self.obj.StepOver)
self.form.useZigZag.setChecked(self.obj.UseZigZag) self.form.useZigZag.setChecked(self.obj.UseZigZag)
self.form.zigZagUnidirectional.setChecked(self.obj.ZigUnidirectional) self.form.zigZagUnidirectional.setChecked(self.obj.ZigUnidirectional)
self.form.zigZagAngle.setValue(self.obj.ZigZagAngle) self.form.zigZagAngle.setValue(FreeCAD.Units.Quantity(self.obj.ZigZagAngle, FreeCAD.Units.Angle))
# self.form.zigZagAngle.setValue(self.obj.ZigZagAngle)
#self.form.useStartPoint.setChecked(self.obj.UseStartPoint) #self.form.useStartPoint.setChecked(self.obj.UseStartPoint)
self.form.extraOffset.setValue(self.obj.PassExtension.Value) self.form.extraOffset.setValue(self.obj.PassExtension.Value)

View File

@ -338,7 +338,7 @@ class ObjectPocket:
else: else:
output += "G3" output += "G3"
output += " X" + fmt(point.x) + " Y" + fmt(point.y) + " Z" + fmt(vpos) output += " X" + fmt(point.x) + " Y" + fmt(point.y) + " Z" + fmt(vpos)
output += " I" + fmt(relcenter.x) + " J" + fmt(relcenter.y) + " K" + fmt(relcenter.z) + " F" + fmt(self.horizFeed) output += " I" + fmt(relcenter.x) + " J" + fmt(relcenter.y) + " K" + fmt(relcenter.z) + " F" + fmt(self.horizFeed)
output += "\n" output += "\n"
last = point last = point
else: else:
@ -545,17 +545,17 @@ class TaskPanel:
def getFields(self): def getFields(self):
if self.obj: if self.obj:
if hasattr(self.obj, "StartDepth"): if hasattr(self.obj, "StartDepth"):
self.obj.StartDepth = self.form.startDepth.text() self.obj.StartDepth = FreeCAD.Units.Quantity(self.form.startDepth.text()).Value
if hasattr(self.obj, "FinalDepth"): if hasattr(self.obj, "FinalDepth"):
self.obj.FinalDepth = self.form.finalDepth.text() self.obj.FinalDepth = FreeCAD.Units.Quantity(self.form.finalDepth.text()).Value
if hasattr(self.obj, "SafeHeight"): if hasattr(self.obj, "SafeHeight"):
self.obj.SafeHeight = self.form.safeHeight.text() self.obj.SafeHeight = FreeCAD.Units.Quantity(self.form.safeHeight.text()).Value
if hasattr(self.obj, "ClearanceHeight"): if hasattr(self.obj, "ClearanceHeight"):
self.obj.ClearanceHeight = self.form.clearanceHeight.text() self.obj.ClearanceHeight = FreeCAD.Units.Quantity(self.form.clearanceHeight.text()).Value
if hasattr(self.obj, "StepDown"): if hasattr(self.obj, "StepDown"):
self.obj.StepDown = self.form.stepDown.text() self.obj.StepDown = FreeCAD.Units.Quantity(self.form.stepDown.text()).Value
if hasattr(self.obj, "MaterialAllowance"): if hasattr(self.obj, "MaterialAllowance"):
self.obj.MaterialAllowance = self.form.extraOffset.text() self.obj.MaterialAllowance = FreeCAD.Units.Quantity(self.form.extraOffset.text()).Value
if hasattr(self.obj, "UseStartPoint"): if hasattr(self.obj, "UseStartPoint"):
self.obj.UseStartPoint = self.form.useStartPoint.isChecked() self.obj.UseStartPoint = self.form.useStartPoint.isChecked()
if hasattr(self.obj, "Algorithm"): if hasattr(self.obj, "Algorithm"):
@ -567,23 +567,23 @@ class TaskPanel:
if hasattr(self.obj, "ZigUnidirectional"): if hasattr(self.obj, "ZigUnidirectional"):
self.obj.ZigUnidirectional = self.form.zigZagUnidirectional.isChecked() self.obj.ZigUnidirectional = self.form.zigZagUnidirectional.isChecked()
if hasattr(self.obj, "ZigZagAngle"): if hasattr(self.obj, "ZigZagAngle"):
self.obj.ZigZagAngle = self.form.zigZagAngle.value() self.obj.ZigZagAngle = FreeCAD.Units.Quantity(self.form.zigZagAngle.text()).Value
if hasattr(self.obj, "StepOver"): if hasattr(self.obj, "StepOver"):
self.obj.StepOver = self.form.stepOverPercent.value() self.obj.StepOver = self.form.stepOverPercent.value()
self.obj.Proxy.execute(self.obj) self.obj.Proxy.execute(self.obj)
def setFields(self): def setFields(self):
self.form.startDepth.setText(str(self.obj.StartDepth.Value)) self.form.startDepth.setText(FreeCAD.Units.Quantity(self.obj.StartDepth.Value, FreeCAD.Units.Length).UserString)
self.form.finalDepth.setText(str(self.obj.FinalDepth.Value)) self.form.finalDepth.setText(FreeCAD.Units.Quantity(self.obj.FinalDepth.Value, FreeCAD.Units.Length).UserString)
self.form.safeHeight.setText(str(self.obj.SafeHeight.Value)) self.form.safeHeight.setText(FreeCAD.Units.Quantity(self.obj.SafeHeight.Value, FreeCAD.Units.Length).UserString)
self.form.clearanceHeight.setText(str(self.obj.ClearanceHeight.Value)) self.form.clearanceHeight.setText(FreeCAD.Units.Quantity(self.obj.ClearanceHeight.Value, FreeCAD.Units.Length).UserString)
self.form.stepDown.setText(str(self.obj.StepDown)) self.form.stepDown.setText(FreeCAD.Units.Quantity(self.obj.StepDown.Value, FreeCAD.Units.Length).UserString)
self.form.extraOffset.setText(str(self.obj.MaterialAllowance.Value)) self.form.extraOffset.setText(FreeCAD.Units.Quantity(self.obj.MaterialAllowance, FreeCAD.Units.Length).UserString)
self.form.useStartPoint.setChecked(self.obj.UseStartPoint) self.form.useStartPoint.setChecked(self.obj.UseStartPoint)
self.form.useZigZag.setChecked(self.obj.UseZigZag) self.form.useZigZag.setChecked(self.obj.UseZigZag)
self.form.zigZagUnidirectional.setChecked(self.obj.ZigUnidirectional) self.form.zigZagUnidirectional.setChecked(self.obj.ZigUnidirectional)
self.form.zigZagAngle.setValue(self.obj.ZigZagAngle) self.form.zigZagAngle.setText(FreeCAD.Units.Quantity(self.obj.ZigZagAngle, FreeCAD.Units.Angle).UserString)
self.form.stepOverPercent.setValue(self.obj.StepOver) self.form.stepOverPercent.setValue(self.obj.StepOver)
index = self.form.algorithmSelect.findText(self.obj.Algorithm, QtCore.Qt.MatchFixedString) index = self.form.algorithmSelect.findText(self.obj.Algorithm, QtCore.Qt.MatchFixedString)

View File

@ -94,7 +94,7 @@ class ObjectProfile:
obj.addProperty("App::PropertyDistance", "RollRadius", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Radius at start and end")) obj.addProperty("App::PropertyDistance", "RollRadius", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Radius at start and end"))
obj.addProperty("App::PropertyDistance", "OffsetExtra", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Extra value to stay away from final profile- good for roughing toolpath")) obj.addProperty("App::PropertyDistance", "OffsetExtra", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Extra value to stay away from final profile- good for roughing toolpath"))
obj.addProperty("App::PropertyLength", "SegLen", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Tesselation value for tool paths made from beziers, bsplines, and ellipses")) # obj.addProperty("App::PropertyLength", "SegLen", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Tesselation value for tool paths made from beziers, bsplines, and ellipses"))
obj.addProperty("App::PropertyAngle", "PlungeAngle", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Plunge angle with which the tool enters the work piece. Straight down is 90 degrees, if set small enough or zero the tool will descent exactly one layer depth down per turn")) obj.addProperty("App::PropertyAngle", "PlungeAngle", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Plunge angle with which the tool enters the work piece. Straight down is 90 degrees, if set small enough or zero the tool will descent exactly one layer depth down per turn"))
obj.addProperty("App::PropertyBool", "processHoles", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Profile holes as well as the outline")) obj.addProperty("App::PropertyBool", "processHoles", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Profile holes as well as the outline"))
obj.addProperty("App::PropertyBool", "processPerimeter", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Profile the outline")) obj.addProperty("App::PropertyBool", "processPerimeter", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Profile the outline"))
@ -486,24 +486,25 @@ class TaskPanel:
def getFields(self): def getFields(self):
if self.obj: if self.obj:
if hasattr(self.obj, "StartDepth"): if hasattr(self.obj, "StartDepth"):
self.obj.StartDepth = self.form.startDepth.text() self.obj.StartDepth = FreeCAD.Units.Quantity(self.form.startDepth.text()).Value
if hasattr(self.obj, "FinalDepth"): if hasattr(self.obj, "FinalDepth"):
self.obj.FinalDepth = self.form.finalDepth.text() self.obj.FinalDepth = FreeCAD.Units.Quantity(self.form.finalDepth.text()).Value
if hasattr(self.obj, "SafeHeight"): if hasattr(self.obj, "SafeHeight"):
self.obj.SafeHeight = self.form.safeHeight.text() self.obj.SafeHeight = FreeCAD.Units.Quantity(self.form.safeHeight.text()).Value
if hasattr(self.obj, "ClearanceHeight"): if hasattr(self.obj, "ClearanceHeight"):
self.obj.ClearanceHeight = self.form.clearanceHeight.text() self.obj.ClearanceHeight = FreeCAD.Units.Quantity(self.form.clearanceHeight.text()).Value
if hasattr(self.obj, "StepDown"): if hasattr(self.obj, "StepDown"):
self.obj.StepDown = self.form.stepDown.text() self.obj.StepDown = FreeCAD.Units.Quantity(self.form.stepDown.text()).Value
if hasattr(self.obj, "OffsetExtra"): if hasattr(self.obj, "OffsetExtra"):
self.obj.OffsetExtra = self.form.extraOffset.text() self.obj.OffsetExtra = FreeCAD.Units.Quantity(self.form.extraOffset.text()).Value
if hasattr(self.obj, "SegLen"): # if hasattr(self.obj, "SegLen"):
self.obj.SegLen = self.form.segLen.value() # self.obj.SegLen = self.form.segLen.value()
if hasattr(self.obj, "RollRadius"): if hasattr(self.obj, "RollRadius"):
self.obj.RollRadius = self.form.rollRadius.text() self.obj.RollRadius = FreeCAD.Units.Quantity(self.form.rollRadius.text()).Value
if hasattr(self.obj, "PlungeAngle"): if hasattr(self.obj, "PlungeAngle"):
self.obj.PlungeAngle = str(self.form.plungeAngle.value()) self.obj.PlungeAngle = FreeCAD.Units.Quantity(self.form.plungeAngle.text()).Value
if hasattr(self.obj, "UseComp"): if hasattr(self.obj, "UseComp"):
self.obj.UseComp = self.form.useCompensation.isChecked() self.obj.UseComp = self.form.useCompensation.isChecked()
if hasattr(self.obj, "UseStartPoint"): if hasattr(self.obj, "UseStartPoint"):
@ -521,15 +522,15 @@ class TaskPanel:
self.obj.Proxy.execute(self.obj) self.obj.Proxy.execute(self.obj)
def setFields(self): def setFields(self):
self.form.startDepth.setText(str(self.obj.StartDepth.Value)) self.form.startDepth.setText(FreeCAD.Units.Quantity(self.obj.StartDepth.Value, FreeCAD.Units.Length).UserString)
self.form.finalDepth.setText(str(self.obj.FinalDepth.Value)) self.form.finalDepth.setText(FreeCAD.Units.Quantity(self.obj.FinalDepth.Value, FreeCAD.Units.Length).UserString)
self.form.safeHeight.setText(str(self.obj.SafeHeight.Value)) self.form.safeHeight.setText(FreeCAD.Units.Quantity(self.obj.SafeHeight.Value, FreeCAD.Units.Length).UserString)
self.form.clearanceHeight.setText(str(self.obj.ClearanceHeight.Value)) self.form.clearanceHeight.setText(FreeCAD.Units.Quantity(self.obj.ClearanceHeight.Value, FreeCAD.Units.Length).UserString)
self.form.stepDown.setText(str(self.obj.StepDown)) self.form.stepDown.setText(FreeCAD.Units.Quantity(self.obj.StepDown.Value, FreeCAD.Units.Length).UserString)
self.form.extraOffset.setText(str(self.obj.OffsetExtra.Value)) self.form.extraOffset.setText(FreeCAD.Units.Quantity(self.obj.OffsetExtra.Value, FreeCAD.Units.Length).UserString)
self.form.segLen.setValue(self.obj.SegLen.Value) # self.form.segLen.setValue(self.obj.SegLen.Value)
self.form.rollRadius.setText(str(self.obj.RollRadius.Value)) self.form.rollRadius.setText(FreeCAD.Units.Quantity(self.obj.RollRadius.Value, FreeCAD.Units.Length).UserString)
self.form.plungeAngle.setValue(self.obj.PlungeAngle.Value) self.form.plungeAngle.setText(FreeCAD.Units.Quantity(self.obj.PlungeAngle.Value, FreeCAD.Units.Angle).UserString)
self.form.useCompensation.setChecked(self.obj.UseComp) self.form.useCompensation.setChecked(self.obj.UseComp)
self.form.useStartPoint.setChecked(self.obj.UseStartPoint) self.form.useStartPoint.setChecked(self.obj.UseStartPoint)
self.form.useEndPoint.setChecked(self.obj.UseEndPoint) self.form.useEndPoint.setChecked(self.obj.UseEndPoint)
@ -753,7 +754,7 @@ class TaskPanel:
self.form.useStartPoint.clicked.connect(self.getFields) self.form.useStartPoint.clicked.connect(self.getFields)
self.form.useEndPoint.clicked.connect(self.getFields) self.form.useEndPoint.clicked.connect(self.getFields)
self.form.extraOffset.editingFinished.connect(self.getFields) self.form.extraOffset.editingFinished.connect(self.getFields)
self.form.segLen.editingFinished.connect(self.getFields) # self.form.segLen.editingFinished.connect(self.getFields)
self.form.rollRadius.editingFinished.connect(self.getFields) self.form.rollRadius.editingFinished.connect(self.getFields)
self.form.processHoles.clicked.connect(self.getFields) self.form.processHoles.clicked.connect(self.getFields)
self.form.processPerimeter.clicked.connect(self.getFields) self.form.processPerimeter.clicked.connect(self.getFields)

View File

@ -96,7 +96,7 @@ class ObjectProfile:
obj.addProperty("App::PropertyDistance", "RollRadius", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Radius at start and end")) obj.addProperty("App::PropertyDistance", "RollRadius", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Radius at start and end"))
obj.addProperty("App::PropertyDistance", "OffsetExtra", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Extra value to stay away from final profile- good for roughing toolpath")) obj.addProperty("App::PropertyDistance", "OffsetExtra", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Extra value to stay away from final profile- good for roughing toolpath"))
obj.addProperty("App::PropertyLength", "SegLen", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Tesselation value for tool paths made from beziers, bsplines, and ellipses")) # obj.addProperty("App::PropertyLength", "SegLen", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Tesselation value for tool paths made from beziers, bsplines, and ellipses"))
obj.addProperty("App::PropertyAngle", "PlungeAngle", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Plunge angle with which the tool enters the work piece. Straight down is 90 degrees, if set small enough or zero the tool will descent exactly one layer depth down per turn")) obj.addProperty("App::PropertyAngle", "PlungeAngle", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Plunge angle with which the tool enters the work piece. Straight down is 90 degrees, if set small enough or zero the tool will descent exactly one layer depth down per turn"))
obj.addProperty("App::PropertyVectorList", "locs", "Tags", QtCore.QT_TRANSLATE_NOOP("App::Property","List of holding tag locations")) obj.addProperty("App::PropertyVectorList", "locs", "Tags", QtCore.QT_TRANSLATE_NOOP("App::Property","List of holding tag locations"))
@ -473,24 +473,25 @@ class TaskPanel:
def getFields(self): def getFields(self):
if self.obj: if self.obj:
if hasattr(self.obj, "StartDepth"): if hasattr(self.obj, "StartDepth"):
self.obj.StartDepth = self.form.startDepth.text() self.obj.StartDepth = FreeCAD.Units.Quantity(self.form.startDepth.text()).Value
if hasattr(self.obj, "FinalDepth"): if hasattr(self.obj, "FinalDepth"):
self.obj.FinalDepth = self.form.finalDepth.text() self.obj.FinalDepth = FreeCAD.Units.Quantity(self.form.finalDepth.text()).Value
if hasattr(self.obj, "SafeHeight"): if hasattr(self.obj, "SafeHeight"):
self.obj.SafeHeight = self.form.safeHeight.text() self.obj.SafeHeight = FreeCAD.Units.Quantity(self.form.safeHeight.text()).Value
if hasattr(self.obj, "ClearanceHeight"): if hasattr(self.obj, "ClearanceHeight"):
self.obj.ClearanceHeight = self.form.clearanceHeight.text() self.obj.ClearanceHeight = FreeCAD.Units.Quantity(self.form.clearanceHeight.text()).Value
if hasattr(self.obj, "StepDown"): if hasattr(self.obj, "StepDown"):
self.obj.StepDown = self.form.stepDown.text() self.obj.StepDown = FreeCAD.Units.Quantity(self.form.stepDown.text()).Value
if hasattr(self.obj, "OffsetExtra"): if hasattr(self.obj, "OffsetExtra"):
self.obj.OffsetExtra = self.form.extraOffset.text() self.obj.OffsetExtra = FreeCAD.Units.Quantity(self.form.extraOffset.text()).Value
if hasattr(self.obj, "SegLen"): # if hasattr(self.obj, "SegLen"):
self.obj.SegLen = self.form.segLen.value() # self.obj.SegLen = self.form.segLen.value()
if hasattr(self.obj, "RollRadius"): if hasattr(self.obj, "RollRadius"):
self.obj.RollRadius = self.form.rollRadius.text() self.obj.RollRadius = FreeCAD.Units.Quantity(self.form.rollRadius.text()).Value
if hasattr(self.obj, "PlungeAngle"): if hasattr(self.obj, "PlungeAngle"):
self.obj.PlungeAngle = str(self.form.plungeAngle.value()) self.obj.PlungeAngle = FreeCAD.Units.Quantity(self.form.plungeAngle.text()).Value
if hasattr(self.obj, "UseComp"): if hasattr(self.obj, "UseComp"):
self.obj.UseComp = self.form.useCompensation.isChecked() self.obj.UseComp = self.form.useCompensation.isChecked()
if hasattr(self.obj, "UseStartPoint"): if hasattr(self.obj, "UseStartPoint"):
@ -506,15 +507,15 @@ class TaskPanel:
self.obj.Proxy.execute(self.obj) self.obj.Proxy.execute(self.obj)
def setFields(self): def setFields(self):
self.form.startDepth.setText(str(self.obj.StartDepth.Value)) self.form.startDepth.setText(FreeCAD.Units.Quantity(self.obj.StartDepth.Value, FreeCAD.Units.Length).UserString)
self.form.finalDepth.setText(str(self.obj.FinalDepth.Value)) self.form.finalDepth.setText(FreeCAD.Units.Quantity(self.obj.FinalDepth.Value, FreeCAD.Units.Length).UserString)
self.form.safeHeight.setText(str(self.obj.SafeHeight.Value)) self.form.safeHeight.setText(FreeCAD.Units.Quantity(self.obj.SafeHeight.Value, FreeCAD.Units.Length).UserString)
self.form.clearanceHeight.setText(str(self.obj.ClearanceHeight.Value)) self.form.clearanceHeight.setText(FreeCAD.Units.Quantity(self.obj.ClearanceHeight.Value, FreeCAD.Units.Length).UserString)
self.form.stepDown.setText(str(self.obj.StepDown.Value)) self.form.stepDown.setText(FreeCAD.Units.Quantity(self.obj.StepDown.Value, FreeCAD.Units.Length).UserString)
self.form.extraOffset.setText(str(self.obj.OffsetExtra.Value)) self.form.extraOffset.setText(FreeCAD.Units.Quantity(self.obj.OffsetExtra.Value, FreeCAD.Units.Length).UserString)
self.form.segLen.setValue(self.obj.SegLen.Value) # self.form.segLen.setValue(self.obj.SegLen.Value)
self.form.rollRadius.setText(str(self.obj.RollRadius.Value)) self.form.rollRadius.setText(FreeCAD.Units.Quantity(self.obj.RollRadius.Value, FreeCAD.Units.Length).UserString)
self.form.plungeAngle.setValue(self.obj.PlungeAngle.Value) self.form.plungeAngle.setText(FreeCAD.Units.Quantity(self.obj.PlungeAngle.Value, FreeCAD.Units.Angle).UserString)
self.form.useCompensation.setChecked(self.obj.UseComp) self.form.useCompensation.setChecked(self.obj.UseComp)
self.form.useStartPoint.setChecked(self.obj.UseStartPoint) self.form.useStartPoint.setChecked(self.obj.UseStartPoint)
self.form.useEndPoint.setChecked(self.obj.UseEndPoint) self.form.useEndPoint.setChecked(self.obj.UseEndPoint)
@ -729,7 +730,7 @@ class TaskPanel:
self.form.useStartPoint.clicked.connect(self.getFields) self.form.useStartPoint.clicked.connect(self.getFields)
self.form.useEndPoint.clicked.connect(self.getFields) self.form.useEndPoint.clicked.connect(self.getFields)
self.form.extraOffset.editingFinished.connect(self.getFields) self.form.extraOffset.editingFinished.connect(self.getFields)
self.form.segLen.editingFinished.connect(self.getFields) # self.form.segLen.editingFinished.connect(self.getFields)
self.form.rollRadius.editingFinished.connect(self.getFields) self.form.rollRadius.editingFinished.connect(self.getFields)
# Tag Form # Tag Form

View File

@ -442,19 +442,19 @@ class TaskPanel:
def getFields(self): def getFields(self):
if self.obj: if self.obj:
if hasattr(self.obj, "StartDepth"):
self.obj.StartDepth = self.form.startDepth.text()
if hasattr(self.obj, "FinalDepth"):
self.obj.FinalDepth = self.form.finalDepth.text()
if hasattr(self.obj, "FinishDepth"):
self.obj.FinishDepth = self.form.finishDepth.text()
if hasattr(self.obj, "StepDown"):
self.obj.StepDown = self.form.stepDown.value()
if hasattr(self.obj, "StartDepth"):
self.obj.StartDepth = FreeCAD.Units.Quantity(self.form.startDepth.text()).Value
if hasattr(self.obj, "FinalDepth"):
self.obj.FinalDepth = FreeCAD.Units.Quantity(self.form.finalDepth.text()).Value
if hasattr(self.obj, "FinishDepth"):
self.obj.FinishDepth = FreeCAD.Units.Quantity(self.form.finishDepth.text()).Value
if hasattr(self.obj, "StepDown"):
self.obj.StepDown = FreeCAD.Units.Quantity(self.form.stepDown.text()).Value
if hasattr(self.obj, "SafeHeight"): if hasattr(self.obj, "SafeHeight"):
self.obj.SafeHeight = self.form.safeHeight.text() self.obj.SafeHeight = FreeCAD.Units.Quantity(self.form.safeHeight.text()).Value
if hasattr(self.obj, "ClearanceHeight"): if hasattr(self.obj, "ClearanceHeight"):
self.obj.ClearanceHeight = self.form.clearanceHeight.text() self.obj.ClearanceHeight = FreeCAD.Units.Quantity(self.form.clearanceHeight.text()).Value
if hasattr(self.obj, "Algorithm"): if hasattr(self.obj, "Algorithm"):
self.obj.Algorithm = str( self.obj.Algorithm = str(
self.form.algorithmSelect.currentText()) self.form.algorithmSelect.currentText())
@ -462,13 +462,12 @@ class TaskPanel:
self.obj.Proxy.execute(self.obj) self.obj.Proxy.execute(self.obj)
def setFields(self): def setFields(self):
self.form.startDepth.setText(str(self.obj.StartDepth.Value)) self.form.startDepth.setText(FreeCAD.Units.Quantity(self.obj.StartDepth.Value, FreeCAD.Units.Length).UserString)
self.form.finalDepth.setText(str(self.obj.FinalDepth.Value)) self.form.finalDepth.setText(FreeCAD.Units.Quantity(self.obj.FinalDepth.Value, FreeCAD.Units.Length).UserString)
self.form.finishDepth.setText(str(self.obj.FinishDepth.Value)) self.form.finishDepth.setText(FreeCAD.Units.Quantity(self.obj.FinishDepth.Value, FreeCAD.Units.Length).UserString)
self.form.stepDown.setValue(self.obj.StepDown) self.form.stepDown.setText(FreeCAD.Units.Quantity(self.obj.StepDown, FreeCAD.Units.Length).UserString)
self.form.safeHeight.setText(FreeCAD.Units.Quantity(self.obj.SafeHeight.Value, FreeCAD.Units.Length).UserString)
self.form.safeHeight.setText(str(self.obj.SafeHeight.Value)) self.form.clearanceHeight.setText(FreeCAD.Units.Quantity(self.obj.ClearanceHeight.Value, FreeCAD.Units.Length).UserString)
self.form.clearanceHeight.setText(str(self.obj.ClearanceHeight.Value))
for i in self.obj.Base: for i in self.obj.Base:
self.form.baseList.addItem(i[0].Name) self.form.baseList.addItem(i[0].Name)

View File

@ -35,6 +35,7 @@ from DraftGeomUtils import geomType
import PathScripts import PathScripts
from PathScripts import PathJob from PathScripts import PathJob
# import itertools # import itertools
import numpy
def cleanedges(splines, precision): def cleanedges(splines, precision):
'''cleanedges([splines],precision). Convert BSpline curves, Beziers, to arcs that can be used for cnc paths. '''cleanedges([splines],precision). Convert BSpline curves, Beziers, to arcs that can be used for cnc paths.
@ -840,27 +841,53 @@ class depth_params:
'''returns a list of depths to be used in order from first to last. '''returns a list of depths to be used in order from first to last.
equalstep=True: all steps down before the finish pass will be equalized.''' equalstep=True: all steps down before the finish pass will be equalized.'''
depths = []
if self.user_depths is not None: if self.user_depths is not None:
depths = self.user_depths return self.user_depths
else:
total_depth = self.start_depth - self.final_depth total_depth = self.start_depth - self.final_depth
if total_depth <= 0:
return depths if total_depth < 0:
layers_required = int((total_depth - self.z_finish_step) / self.step_down) return []
partial_steplayer = (total_depth - self.z_finish_step) % self.step_down
if equalstep is True and partial_steplayer > 0: depths = [self.final_depth]
layerstep = float((total_depth - self.z_finish_step) / (layers_required + 1))
# apply finish step if necessary
if self.z_finish_step > 0:
if self.z_finish_step < total_depth:
depths.append(self.z_finish_step + self.final_depth)
else: else:
layerstep = self.step_down return depths
for step in range(layers_required): if equalstep:
d = self.start_depth - ((step +1) * layerstep) depths += self.__equal_steps(self.start_depth, depths[-1], self.step_down)[1:]
depths.append(d) else:
depths += self.__fixed_steps(self.start_depth, depths[-1], self.step_down)[1:]
if self.z_finish_step != 0 and depths[-1] != self.final_depth + self.z_finish_step:
depths.append(self.final_depth + self.z_finish_step)
if depths[-1] != self.final_depth:
depths.append(self.final_depth)
depths.reverse()
return depths return depths
def __equal_steps(self, start, stop, max_size):
'''returns a list of depths beginning with the bottom (included), ending
with the top (not included).
all steps are of equal size, which is as big as possible but not bigger
than max_size.'''
steps_needed = math.ceil((start - stop) / max_size)
depths = numpy.linspace(stop, start, steps_needed, endpoint=False)
return depths.tolist()
def __fixed_steps(self, start, stop, size):
'''returns a list of depths beginning with the bottom (included), ending
with the top (not included).
all steps are of size 'size' except the one at the bottom wich can be
smaller.'''
fullsteps = int((start - stop) / size)
last_step = start - (fullsteps * size)
depths = numpy.linspace(last_step, start, fullsteps, endpoint=False)
if last_step == stop:
return depths.tolist()
else:
return [stop] + depths.tolist()

View File

@ -0,0 +1,155 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2016 sliptonic <shopinthewoods@gmail.com> *
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it under the terms of the GNU Lesser General Public License (LGPL) *
# * as published by the Free Software Foundation; either version 2 of *
# * the License, or (at your option) any later version. *
# * for detail see the LICENCE text file. *
# * *
# * This program 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 program; if not, write to the Free Software *
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
# * USA *
# * *
# ***************************************************************************
import FreeCAD
import Path
from PathTests.PathTestUtils import PathTestBase
class TestPathCore(PathTestBase):
def test00(self):
"""Test Path command core functionality"""
#create empty command
c=Path.Command()
self.assertIsInstance(c, Path.Command)
#change name
c.Name = "G1"
self.assertEqual(c.Name, "G1")
#Assign Parameters
c.Parameters= {"X":1,"Y":0}
self.assertEqual(c.Parameters, {'Y': 0.0, 'X': 1.0})
#change parameters
c.Parameters= {"X":1,"Y":0.5}
self.assertEqual(c.Parameters, {'Y': 0.5, 'X': 1})
#output gcode
self.assertEqual(c.toGCode(), 'G1 X1.000000 Y0.500000')
#create and assign name in one
c2=Path.Command("G2")
self.assertEqual(c2.Name, "G2")
#Create Path and parameters in one
c3=Path.Command("G1",{"X":34,"Y":1.2})
self.assertEqual(str(c3), 'Command G1 [ X:34 Y:1.2 ]')
c4 = Path.Command("G1X4Y5")
self.assertEqual(str(c4), 'Command G1 [ X:4 Y:5 ]')
#use placement
self.assertEqual( str(c3.Placement), 'Placement [Pos=(34,1.2,0), Yaw-Pitch-Roll=(0,0,0)]')
self.assertEqual( c3.toGCode(), 'G1 X34.000000 Y1.200000')
p1 = FreeCAD.Placement()
p1.Base = FreeCAD.Vector(3,2,1)
self.assertEqual(str(p1), 'Placement [Pos=(3,2,1), Yaw-Pitch-Roll=(0,0,0)]')
c5=Path.Command("g1",p1)
self.assertEqual(str(c5), 'Command G1 [ X:3 Y:2 Z:1 ]')
p2=FreeCAD.Placement()
p2.Base = FreeCAD.Vector(5,0,0)
#overwrite placement
c5.Placement=p2
self.assertEqual(str(c5), 'Command G1 [ X:5 ]')
self.assertEqual(c5.x, 5.0)
#overwrite individual parameters
c5.x=10
self.assertEqual(c5.x, 10.0)
c5.y=2
self.assertEqual (str(c5), 'Command G1 [ X:10 Y:2 ]')
#set from gcode
c3.setFromGCode("G1X1Y0")
self.assertEqual(str(c3), 'Command G1 [ X:1 Y:0 ]')
def test10(self):
"""Test Path Object core functionality"""
c1=Path.Command("g1",{"x":1,"y":0})
c2=Path.Command("g1",{"x":0,"y":2})
p=Path.Path([c1,c2])
self.assertAlmostEqual(str(p), 'Path [ size:2 length:3.2361 ]', places=4)
self.assertEqual(str(p.Commands), '[Command G1 [ X:1 Y:0 ], Command G1 [ X:0 Y:2 ]]')
self.assertAlmostEqual( p.Length, 3.2361, places=4)
p.addCommands(c1)
self.assertEqual(p.toGCode(), 'G1 X1.000000 Y0.000000\nG1 X0.000000 Y2.000000\nG1 X1.000000 Y0.000000\n')
lines = '''
G0X-0.5905Y-0.3937S3000M03
G0Z0.125
G1Z-0.004F3
G1X0.9842Y-0.3937F14.17
G1X0.9842Y0.433
G1X-0.5905Y0.433
G1X-0.5905Y-0.3937
G0Z0.5
'''
output = '''G0 S3000.000000 X-0.590500 Y-0.393700
M03
G0 Z0.125000
G1 F3.000000 Z-0.004000
G1 F14.170000 X0.984200 Y-0.393700
G1 X0.984200 Y0.433000
G1 X-0.590500 Y0.433000
G1 X-0.590500 Y-0.393700
G0 Z0.500000
'''
#create a path directly form a piece of gcode.
p = Path.Path()
p.setFromGCode(lines)
self.assertEqual (p.toGCode(), output)
def test20(self):
"""Test Path Tool and ToolTable object core functionality"""
t1=Path.Tool()
self.assertIsInstance(t1, Path.Tool)
t1.Name = "12.7mm Drill Bit"
self.assertEqual(t1.Name, "12.7mm Drill Bit")
self.assertEqual(t1.ToolType, "Undefined")
t1.ToolType = "Drill"
self.assertEqual(t1.ToolType, "Drill")
t1.Diameter= 12.7
t1.LengthOffset = 127
t1.CuttingEdgeAngle = 59
t1.CuttingEdgeHeight = 50.8
self.assertEqual(t1.Diameter, 12.7)
self.assertEqual(t1.LengthOffset, 127)
self.assertEqual(t1.CuttingEdgeAngle, 59)
self.assertEqual(t1.CuttingEdgeHeight, 50.8)
t2 = Path.Tool("my other tool",tooltype="EndMill",diameter=10)
table = Path.Tooltable()
self.assertIsInstance(table, Path.Tooltable)
table.addTools(t1)
table.addTools(t2)
self.assertEqual(len(table.Tools), 2)
self.assertEqual(str(table.Tools), '{1: Tool 12.7mm Drill Bit, 2: Tool my other tool}' )

View File

@ -73,7 +73,7 @@ class depthTestCases(unittest.TestCase):
final_depth = 10 final_depth = 10
user_depths = None user_depths = None
expected =[] expected =[10]
d = PU.depth_params(clearance_height, rapid_safety_space, start_depth, step_down, z_finish_step, final_depth, user_depths) d = PU.depth_params(clearance_height, rapid_safety_space, start_depth, step_down, z_finish_step, final_depth, user_depths)
r = d.get_depths() r = d.get_depths()
@ -109,7 +109,7 @@ class depthTestCases(unittest.TestCase):
self.assertListEqual (r, expected) self.assertListEqual (r, expected)
def test40(self): def test40(self):
'''Finish depth passed in.''' '''z_finish_step passed in.'''
clearance_height= 10 clearance_height= 10
rapid_safety_space = 5 rapid_safety_space = 5
@ -161,3 +161,23 @@ class depthTestCases(unittest.TestCase):
r = d.get_depths(equalstep=True) r = d.get_depths(equalstep=True)
self.assertListEqual (r, expected) self.assertListEqual (r, expected)
def test70(self):
'''stepping down with stepdown greater than total depth'''
clearance_height= 10
rapid_safety_space = 5
start_depth = 10
step_down = 20
z_finish_step = 1
final_depth = 0
user_depths = None
expected =[1.0, 0]
d = PU.depth_params(clearance_height, rapid_safety_space, start_depth, step_down, z_finish_step, final_depth, user_depths)
r = d.get_depths(equalstep=True)
self.assertListEqual (r, expected)
d = PU.depth_params(clearance_height, rapid_safety_space, start_depth, step_down, z_finish_step, final_depth, user_depths)
r = d.get_depths()
self.assertListEqual (r, expected)

View File

@ -24,6 +24,7 @@
import TestApp import TestApp
from PathTests.TestPathCore import TestPathCore
from PathTests.TestPathPost import PathPostTestCases from PathTests.TestPathPost import PathPostTestCases
from PathTests.TestPathGeom import TestPathGeom from PathTests.TestPathGeom import TestPathGeom

View File

@ -3249,23 +3249,24 @@ void CmdSketcherConstrainAngle::activated(int iMsg)
// find the two closest line ends // find the two closest line ends
Sketcher::PointPos PosId1,PosId2; Sketcher::PointPos PosId1,PosId2;
Base::Vector3d p1a = lineSeg1->getStartPoint(); Base::Vector3d p1[2], p2[2];
Base::Vector3d p1b = lineSeg1->getEndPoint(); p1[0] = lineSeg1->getStartPoint();
Base::Vector3d p2a = lineSeg2->getStartPoint(); p1[1] = lineSeg1->getEndPoint();
Base::Vector3d p2b = lineSeg2->getEndPoint(); p2[0] = lineSeg2->getStartPoint();
p2[1] = lineSeg2->getEndPoint();
// Get the intersection point in 2d of the two lines if possible // Get the intersection point in 2d of the two lines if possible
Base::Line2d line1(Base::Vector2d(p1a.x, p1a.y), Base::Vector2d(p1b.x, p1b.y)); Base::Line2d line1(Base::Vector2d(p1[0].x, p1[0].y), Base::Vector2d(p1[1].x, p1[1].y));
Base::Line2d line2(Base::Vector2d(p2a.x, p2a.y), Base::Vector2d(p2b.x, p2b.y)); Base::Line2d line2(Base::Vector2d(p2[0].x, p2[0].y), Base::Vector2d(p2[1].x, p2[1].y));
Base::Vector2d s; Base::Vector2d s;
if (line1.Intersect(line2, s)) { if (line1.Intersect(line2, s)) {
// get the end points of the line segments that are closest to the intersection point // get the end points of the line segments that are closest to the intersection point
Base::Vector3d s3d(s.x, s.y, p1a.z); Base::Vector3d s3d(s.x, s.y, p1[0].z);
if (Base::DistanceP2(s3d, p1a) < Base::DistanceP2(s3d, p1b)) if (Base::DistanceP2(s3d, p1[0]) < Base::DistanceP2(s3d, p1[1]))
PosId1 = Sketcher::start; PosId1 = Sketcher::start;
else else
PosId1 = Sketcher::end; PosId1 = Sketcher::end;
if (Base::DistanceP2(s3d, p2a) < Base::DistanceP2(s3d, p2b)) if (Base::DistanceP2(s3d, p2[0]) < Base::DistanceP2(s3d, p2[1]))
PosId2 = Sketcher::start; PosId2 = Sketcher::start;
else else
PosId2 = Sketcher::end; PosId2 = Sketcher::end;
@ -3275,11 +3276,11 @@ void CmdSketcherConstrainAngle::activated(int iMsg)
double length = DBL_MAX; double length = DBL_MAX;
for (int i=0; i <= 1; i++) { for (int i=0; i <= 1; i++) {
for (int j=0; j <= 1; j++) { for (int j=0; j <= 1; j++) {
double tmp = Base::DistanceP2((j?p2a:p2b), (i?p1a:p1b)); double tmp = Base::DistanceP2(p2[j], p1[i]);
if (tmp < length) { if (tmp < length) {
length = tmp; length = tmp;
PosId1 = i ? Sketcher::start : Sketcher::end; PosId1 = i ? Sketcher::end : Sketcher::start;
PosId2 = j ? Sketcher::start : Sketcher::end; PosId2 = j ? Sketcher::end : Sketcher::start;
} }
} }
} }
@ -3293,7 +3294,7 @@ void CmdSketcherConstrainAngle::activated(int iMsg)
// check if the two lines are parallel, in this case an angle is not possible // check if the two lines are parallel, in this case an angle is not possible
Base::Vector3d dir3 = dir1 % dir2; Base::Vector3d dir3 = dir1 % dir2;
if (dir3.Length() < Precision::Intersection()) { if (dir3.Length() < Precision::Intersection()) {
Base::Vector3d dist = (p1a - p2a) % dir1; Base::Vector3d dist = (p1[0] - p2[0]) % dir1;
if (dist.Sqr() > Precision::Intersection()) { if (dist.Sqr() > Precision::Intersection()) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Parallel lines"), QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Parallel lines"),
QObject::tr("An angle constraint cannot be set for two parallel lines.")); QObject::tr("An angle constraint cannot be set for two parallel lines."));

View File

@ -27,6 +27,7 @@
# include <QContextMenuEvent> # include <QContextMenuEvent>
# include <QMenu> # include <QMenu>
# include <QRegExp> # include <QRegExp>
# include <QShortcut>
# include <QString> # include <QString>
#endif #endif
@ -231,6 +232,8 @@ void ElementView::keyPressEvent(QKeyEvent * event)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
/* TRANSLATOR SketcherGui::TaskSketcherElements */
TaskSketcherElements::TaskSketcherElements(ViewProviderSketch *sketchView) TaskSketcherElements::TaskSketcherElements(ViewProviderSketch *sketchView)
: TaskBox(Gui::BitmapFactory().pixmap("document-new"),tr("Elements"),true, 0) : TaskBox(Gui::BitmapFactory().pixmap("document-new"),tr("Elements"),true, 0)
, sketchView(sketchView) , sketchView(sketchView)
@ -244,6 +247,18 @@ TaskSketcherElements::TaskSketcherElements(ViewProviderSketch *sketchView)
// we need a separate container widget to add all controls to // we need a separate container widget to add all controls to
proxy = new QWidget(this); proxy = new QWidget(this);
ui->setupUi(proxy); ui->setupUi(proxy);
#ifdef Q_OS_MAC
QString cmdKey = QString::fromUtf8("\xe2\x8c\x98"); // U+2318
#else
// translate the text (it's offered by Qt's translation files)
// but avoid being picked up by lupdate
const char* ctrlKey = "Ctrl";
QString cmdKey = QShortcut::tr(ctrlKey);
#endif
QString zKey = QString::fromLatin1("Z");
ui->Explanation->setText(tr("<html><head/><body><p>&quot;%1&quot;: multiple selection</p>"
"<p>&quot;%2&quot;: switch to next valid type</p></body></html>")
.arg(cmdKey).arg(zKey));
ui->listWidgetElements->setSelectionMode(QAbstractItemView::ExtendedSelection); ui->listWidgetElements->setSelectionMode(QAbstractItemView::ExtendedSelection);
ui->listWidgetElements->setEditTriggers(QListWidget::NoEditTriggers); ui->listWidgetElements->setEditTriggers(QListWidget::NoEditTriggers);
ui->listWidgetElements->setMouseTracking(true); ui->listWidgetElements->setMouseTracking(true);

View File

@ -91,7 +91,7 @@
<item> <item>
<widget class="QLabel" name="Explanation"> <widget class="QLabel" name="Explanation">
<property name="text"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&amp;quot;Ctrl&amp;quot;: multiple selection&lt;/p&gt;&lt;p&gt;&amp;quot;Z&amp;quot;: switch to next valid type&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string notr="true">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&amp;quot;Ctrl&amp;quot;: multiple selection&lt;/p&gt;&lt;p&gt;&amp;quot;Z&amp;quot;: switch to next valid type&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -1283,6 +1283,7 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2d &toPo
else if (Constr->Type == Angle) { else if (Constr->Type == Angle) {
Base::Vector3d p0(0.,0.,0.); Base::Vector3d p0(0.,0.,0.);
double factor = 0.5;
if (Constr->Second != Constraint::GeoUndef) { // line to line angle if (Constr->Second != Constraint::GeoUndef) { // line to line angle
Base::Vector3d dir1, dir2; Base::Vector3d dir1, dir2;
if(Constr->Third == Constraint::GeoUndef) { //angle between two lines if(Constr->Third == Constraint::GeoUndef) { //angle between two lines
@ -1310,7 +1311,11 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2d &toPo
double c2 = dir2.y*pnt2.x - dir2.x*pnt2.y; double c2 = dir2.y*pnt2.x - dir2.x*pnt2.y;
double x = (dir1.x*c2 - dir2.x*c1)/det; double x = (dir1.x*c2 - dir2.x*c1)/det;
double y = (dir1.y*c2 - dir2.y*c1)/det; double y = (dir1.y*c2 - dir2.y*c1)/det;
// intersection point
p0 = Base::Vector3d(x,y,0); p0 = Base::Vector3d(x,y,0);
Base::Vector3d vec = Base::Vector3d(toPos.x, toPos.y, 0) - p0;
factor = factor * Base::sgn<double>((dir1+dir2) * vec);
} }
} else {//angle-via-point } else {//angle-via-point
Base::Vector3d p = getSketchObject()->getSolvedSketch().getPoint(Constr->Third, Constr->ThirdPos); Base::Vector3d p = getSketchObject()->getSolvedSketch().getPoint(Constr->Third, Constr->ThirdPos);
@ -1319,6 +1324,9 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2d &toPo
dir1.RotateZ(-M_PI/2);//convert to vector of tangency by rotating dir1.RotateZ(-M_PI/2);//convert to vector of tangency by rotating
dir2 = getSketchObject()->getSolvedSketch().calculateNormalAtPoint(Constr->Second, p.x, p.y); dir2 = getSketchObject()->getSolvedSketch().calculateNormalAtPoint(Constr->Second, p.x, p.y);
dir2.RotateZ(-M_PI/2); dir2.RotateZ(-M_PI/2);
Base::Vector3d vec = Base::Vector3d(toPos.x, toPos.y, 0) - p0;
factor = factor * Base::sgn<double>((dir1+dir2) * vec);
} }
} else if (Constr->First != Constraint::GeoUndef) { // line/arc angle } else if (Constr->First != Constraint::GeoUndef) { // line/arc angle
@ -1338,7 +1346,7 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2d &toPo
return; return;
Base::Vector3d vec = Base::Vector3d(toPos.x, toPos.y, 0) - p0; Base::Vector3d vec = Base::Vector3d(toPos.x, toPos.y, 0) - p0;
Constr->LabelDistance = vec.Length()/2; Constr->LabelDistance = factor * vec.Length();
} }
// delete the cloned objects // delete the cloned objects
@ -4090,7 +4098,7 @@ Restart:
} }
startangle = atan2(dir1.y,dir1.x); startangle = atan2(dir1.y,dir1.x);
range = atan2(-dir1.y*dir2.x+dir1.x*dir2.y, range = atan2(dir1.x*dir2.y-dir1.y*dir2.x,
dir1.x*dir2.x+dir1.y*dir2.y); dir1.x*dir2.x+dir1.y*dir2.y);
endangle = startangle + range; endangle = startangle + range;

View File

@ -1,17 +1,17 @@
/**************************************************************************** /****************************************************************************
** **
** This file is part of a Qt Solutions component. ** This file is part of a Qt Solutions component.
** **
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
** **
** Contact: Qt Software Information (qt-info@nokia.com) ** Contact: Qt Software Information (qt-info@nokia.com)
** **
** Commercial Usage ** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in ** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Solutions Commercial License Agreement provided ** accordance with the Qt Solutions Commercial License Agreement provided
** with the Software or, alternatively, in accordance with the terms ** with the Software or, alternatively, in accordance with the terms
** contained in a written agreement between you and Nokia. ** contained in a written agreement between you and Nokia.
** **
** GNU Lesser General Public License Usage ** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser ** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software ** General Public License version 2.1 as published by the Free Software
@ -19,29 +19,29 @@
** packaging of this file. Please review the following information to ** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements ** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
** **
** In addition, as a special exception, Nokia gives you certain ** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL ** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package. ** package.
** **
** GNU General Public License Usage ** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU ** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software ** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the ** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to ** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be ** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html. ** met: http://www.gnu.org/copyleft/gpl.html.
** **
** Please note Third Party Software included with Qt Solutions may impose ** Please note Third Party Software included with Qt Solutions may impose
** additional restrictions and it is the user's responsibility to ensure ** additional restrictions and it is the user's responsibility to ensure
** that they have met the licensing requirements of the GPL, LGPL, or Qt ** that they have met the licensing requirements of the GPL, LGPL, or Qt
** Solutions Commercial license and the relevant license of the Third ** Solutions Commercial license and the relevant license of the Third
** Party Software they are using. ** Party Software they are using.
** **
** If you are unsure which license is appropriate for your use, please ** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com. ** contact the sales department at qt-sales@nokia.com.
** **
****************************************************************************/ ****************************************************************************/
#include <QApplication> #include <QApplication>
@ -169,7 +169,7 @@ class ColorPickerItem : public QFrame
public: public:
ColorPickerItem(const QColor &color = Qt::white, const QString &text = QString::null, ColorPickerItem(const QColor &color = Qt::white, const QString &text = QString::null,
QWidget *parent = 0); QWidget *parent = 0);
~ColorPickerItem(); ~ColorPickerItem();
QColor color() const; QColor color() const;
@ -205,7 +205,7 @@ class ColorPickerPopup : public QFrame
public: public:
ColorPickerPopup(int width, bool withColorDialog, ColorPickerPopup(int width, bool withColorDialog,
QWidget *parent = 0); QWidget *parent = 0);
~ColorPickerPopup(); ~ColorPickerPopup();
void insertColor(const QColor &col, const QString &text, int index); void insertColor(const QColor &col, const QString &text, int index);
@ -217,7 +217,7 @@ public:
ColorPickerItem *find(const QColor &col) const; ColorPickerItem *find(const QColor &col) const;
QColor color(int index) const; QColor color(int index) const;
void setLastSel(const QColor & col); void setLastSel(const QColor & col);
signals: signals:
@ -268,7 +268,7 @@ private:
\sa QFrame \sa QFrame
*/ */
QtColorPicker::QtColorPicker(QWidget *parent, QtColorPicker::QtColorPicker(QWidget *parent,
int cols, bool enableColorDialog) int cols, bool enableColorDialog)
: QPushButton(parent), popup(0), withColorDialog(enableColorDialog) : QPushButton(parent), popup(0), withColorDialog(enableColorDialog)
{ {
setFocusPolicy(Qt::StrongFocus); setFocusPolicy(Qt::StrongFocus);
@ -288,7 +288,7 @@ QtColorPicker::QtColorPicker(QWidget *parent,
// Create color grid popup and connect to it. // Create color grid popup and connect to it.
popup = new ColorPickerPopup(cols, withColorDialog, this); popup = new ColorPickerPopup(cols, withColorDialog, this);
connect(popup, SIGNAL(selected(const QColor &)), connect(popup, SIGNAL(selected(const QColor &)),
SLOT(setCurrentColor(const QColor &))); SLOT(setCurrentColor(const QColor &)));
connect(popup, SIGNAL(hid()), SLOT(popupClosed())); connect(popup, SIGNAL(hid()), SLOT(popupClosed()));
// Connect this push button's pressed() signal. // Connect this push button's pressed() signal.
@ -434,18 +434,18 @@ void QtColorPicker::setStandardColors()
void QtColorPicker::setCurrentColor(const QColor &color) void QtColorPicker::setCurrentColor(const QColor &color)
{ {
if (color.isValid() && col == color) { if (color.isValid() && col == color) {
emit colorSet(color); Q_EMIT colorSet(color);
return; return;
} }
if (col == color || !color.isValid()) if (col == color || !color.isValid())
return; return;
ColorPickerItem *item = popup->find(color); ColorPickerItem *item = popup->find(color);
if (!item) { if (!item) {
insertColor(color, tr("Custom")); insertColor(color, tr("Custom"));
item = popup->find(color); item = popup->find(color);
} }
popup->setLastSel(color); popup->setLastSel(color);
col = color; col = color;
@ -457,8 +457,8 @@ void QtColorPicker::setCurrentColor(const QColor &color)
repaint(); repaint();
item->setSelected(true); item->setSelected(true);
emit colorChanged(color); Q_EMIT colorChanged(color);
emit colorSet(color); Q_EMIT colorSet(color);
} }
/*! /*!
@ -471,9 +471,9 @@ void QtColorPicker::insertColor(const QColor &color, const QString &text, int in
{ {
popup->insertColor(color, text, index); popup->insertColor(color, text, index);
if (!firstInserted) { if (!firstInserted) {
col = color; col = color;
setText(text); setText(text);
firstInserted = true; firstInserted = true;
} }
} }
@ -504,7 +504,7 @@ bool QtColorPicker::colorDialogEnabled() const
\code \code
void Drawer::mouseReleaseEvent(QMouseEvent *e) void Drawer::mouseReleaseEvent(QMouseEvent *e)
{ {
if (e->button() & RightButton) { if (e->button() & RightButton) {
QColor color = QtColorPicker::getColor(mapToGlobal(e->pos())); QColor color = QtColorPicker::getColor(mapToGlobal(e->pos()));
} }
} }
@ -542,7 +542,7 @@ QColor QtColorPicker::getColor(const QPoint &point, bool allowCustomColors)
Constructs the popup widget. Constructs the popup widget.
*/ */
ColorPickerPopup::ColorPickerPopup(int width, bool withColorDialog, ColorPickerPopup::ColorPickerPopup(int width, bool withColorDialog,
QWidget *parent) QWidget *parent)
: QFrame(parent, Qt::Popup) : QFrame(parent, Qt::Popup)
{ {
setFrameStyle(QFrame::StyledPanel); setFrameStyle(QFrame::StyledPanel);
@ -553,13 +553,13 @@ ColorPickerPopup::ColorPickerPopup(int width, bool withColorDialog,
cols = width; cols = width;
if (withColorDialog) { if (withColorDialog) {
moreButton = new ColorPickerButton(this); moreButton = new ColorPickerButton(this);
moreButton->setFixedWidth(24); moreButton->setFixedWidth(24);
moreButton->setFixedHeight(21); moreButton->setFixedHeight(21);
moreButton->setFrameRect(QRect(2, 2, 20, 17)); moreButton->setFrameRect(QRect(2, 2, 20, 17));
connect(moreButton, SIGNAL(clicked()), SLOT(getColorFromDialog())); connect(moreButton, SIGNAL(clicked()), SLOT(getColorFromDialog()));
} else { } else {
moreButton = 0; moreButton = 0;
} }
eventLoop = 0; eventLoop = 0;
@ -586,8 +586,8 @@ ColorPickerPopup::~ColorPickerPopup()
ColorPickerItem *ColorPickerPopup::find(const QColor &col) const ColorPickerItem *ColorPickerPopup::find(const QColor &col) const
{ {
for (int i = 0; i < items.size(); ++i) { for (int i = 0; i < items.size(); ++i) {
if (items.at(i) && items.at(i)->color() == col) if (items.at(i) && items.at(i)->color() == col)
return items.at(i); return items.at(i);
} }
return 0; return 0;
@ -626,7 +626,7 @@ void ColorPickerPopup::insertColor(const QColor &col, const QString &text, int i
connect(item, SIGNAL(selected()), SLOT(updateSelected())); connect(item, SIGNAL(selected()), SLOT(updateSelected()));
if (index == -1) if (index == -1)
index = items.count(); index = items.count();
items.insert((unsigned int)index, item); items.insert((unsigned int)index, item);
regenerateGrid(); regenerateGrid();
@ -667,19 +667,19 @@ void ColorPickerPopup::updateSelected()
QLayoutItem *layoutItem; QLayoutItem *layoutItem;
int i = 0; int i = 0;
while ((layoutItem = grid->itemAt(i)) != 0) { while ((layoutItem = grid->itemAt(i)) != 0) {
QWidget *w = layoutItem->widget(); QWidget *w = layoutItem->widget();
if (w && w->inherits("ColorPickerItem")) { if (w && w->inherits("ColorPickerItem")) {
ColorPickerItem *litem = reinterpret_cast<ColorPickerItem *>(layoutItem->widget()); ColorPickerItem *litem = reinterpret_cast<ColorPickerItem *>(layoutItem->widget());
if (litem != sender()) if (litem != sender())
litem->setSelected(false); litem->setSelected(false);
} }
++i; ++i;
} }
if (sender() && sender()->inherits("ColorPickerItem")) { if (sender() && sender()->inherits("ColorPickerItem")) {
ColorPickerItem *item = (ColorPickerItem *)sender(); ColorPickerItem *item = (ColorPickerItem *)sender();
lastSel = item->color(); lastSel = item->color();
emit selected(item->color()); Q_EMIT selected(item->color());
} }
hide(); hide();
@ -691,7 +691,7 @@ void ColorPickerPopup::updateSelected()
void ColorPickerPopup::mouseReleaseEvent(QMouseEvent *e) void ColorPickerPopup::mouseReleaseEvent(QMouseEvent *e)
{ {
if (!rect().contains(e->pos())) if (!rect().contains(e->pos()))
hide(); hide();
} }
/*! \internal /*! \internal
@ -705,96 +705,96 @@ void ColorPickerPopup::keyPressEvent(QKeyEvent *e)
bool foundFocus = false; bool foundFocus = false;
for (int j = 0; !foundFocus && j < grid->rowCount(); ++j) { for (int j = 0; !foundFocus && j < grid->rowCount(); ++j) {
for (int i = 0; !foundFocus && i < grid->columnCount(); ++i) { for (int i = 0; !foundFocus && i < grid->columnCount(); ++i) {
if (widgetAt[j][i] && widgetAt[j][i]->hasFocus()) { if (widgetAt[j][i] && widgetAt[j][i]->hasFocus()) {
curRow = j; curRow = j;
curCol = i; curCol = i;
foundFocus = true; foundFocus = true;
break; break;
} }
} }
} }
switch (e->key()) { switch (e->key()) {
case Qt::Key_Left: case Qt::Key_Left:
if (curCol > 0) --curCol; if (curCol > 0) --curCol;
else if (curRow > 0) { --curRow; curCol = grid->columnCount() - 1; } else if (curRow > 0) { --curRow; curCol = grid->columnCount() - 1; }
break; break;
case Qt::Key_Right: case Qt::Key_Right:
if (curCol < grid->columnCount() - 1 && widgetAt[curRow][curCol + 1]) ++curCol; if (curCol < grid->columnCount() - 1 && widgetAt[curRow][curCol + 1]) ++curCol;
else if (curRow < grid->rowCount() - 1) { ++curRow; curCol = 0; } else if (curRow < grid->rowCount() - 1) { ++curRow; curCol = 0; }
break; break;
case Qt::Key_Up: case Qt::Key_Up:
if (curRow > 0) --curRow; if (curRow > 0) --curRow;
else curCol = 0; else curCol = 0;
break; break;
case Qt::Key_Down: case Qt::Key_Down:
if (curRow < grid->rowCount() - 1) { if (curRow < grid->rowCount() - 1) {
QWidget *w = widgetAt[curRow + 1][curCol]; QWidget *w = widgetAt[curRow + 1][curCol];
if (w) { if (w) {
++curRow; ++curRow;
} else for (int i = 1; i < grid->columnCount(); ++i) { } else for (int i = 1; i < grid->columnCount(); ++i) {
if (!widgetAt[curRow + 1][i]) { if (!widgetAt[curRow + 1][i]) {
curCol = i - 1; curCol = i - 1;
++curRow; ++curRow;
break; break;
} }
} }
} }
break; break;
case Qt::Key_Space: case Qt::Key_Space:
case Qt::Key_Return: case Qt::Key_Return:
case Qt::Key_Enter: { case Qt::Key_Enter: {
QWidget *w = widgetAt[curRow][curCol]; QWidget *w = widgetAt[curRow][curCol];
if (w && w->inherits("ColorPickerItem")) { if (w && w->inherits("ColorPickerItem")) {
ColorPickerItem *wi = reinterpret_cast<ColorPickerItem *>(w); ColorPickerItem *wi = reinterpret_cast<ColorPickerItem *>(w);
wi->setSelected(true); wi->setSelected(true);
QLayoutItem *layoutItem; QLayoutItem *layoutItem;
int i = 0; int i = 0;
while ((layoutItem = grid->itemAt(i)) != 0) { while ((layoutItem = grid->itemAt(i)) != 0) {
QWidget *w = layoutItem->widget(); QWidget *w = layoutItem->widget();
if (w && w->inherits("ColorPickerItem")) { if (w && w->inherits("ColorPickerItem")) {
ColorPickerItem *litem ColorPickerItem *litem
= reinterpret_cast<ColorPickerItem *>(layoutItem->widget()); = reinterpret_cast<ColorPickerItem *>(layoutItem->widget());
if (litem != wi) if (litem != wi)
litem->setSelected(false); litem->setSelected(false);
} }
++i; ++i;
} }
lastSel = wi->color(); lastSel = wi->color();
emit selected(wi->color()); Q_EMIT selected(wi->color());
hide(); hide();
} else if (w && w->inherits("QPushButton")) { } else if (w && w->inherits("QPushButton")) {
ColorPickerItem *wi = reinterpret_cast<ColorPickerItem *>(w); ColorPickerItem *wi = reinterpret_cast<ColorPickerItem *>(w);
wi->setSelected(true); wi->setSelected(true);
QLayoutItem *layoutItem; QLayoutItem *layoutItem;
int i = 0; int i = 0;
while ((layoutItem = grid->itemAt(i)) != 0) { while ((layoutItem = grid->itemAt(i)) != 0) {
QWidget *w = layoutItem->widget(); QWidget *w = layoutItem->widget();
if (w && w->inherits("ColorPickerItem")) { if (w && w->inherits("ColorPickerItem")) {
ColorPickerItem *litem ColorPickerItem *litem
= reinterpret_cast<ColorPickerItem *>(layoutItem->widget()); = reinterpret_cast<ColorPickerItem *>(layoutItem->widget());
if (litem != wi) if (litem != wi)
litem->setSelected(false); litem->setSelected(false);
} }
++i; ++i;
} }
lastSel = wi->color(); lastSel = wi->color();
emit selected(wi->color()); Q_EMIT selected(wi->color());
hide(); hide();
} }
} }
break; break;
case Qt::Key_Escape: case Qt::Key_Escape:
hide(); hide();
break; break;
default: default:
e->ignore(); e->ignore();
break; break;
} }
widgetAt[curRow][curCol]->setFocus(); widgetAt[curRow][curCol]->setFocus();
@ -806,12 +806,12 @@ void ColorPickerPopup::keyPressEvent(QKeyEvent *e)
void ColorPickerPopup::hideEvent(QHideEvent *e) void ColorPickerPopup::hideEvent(QHideEvent *e)
{ {
if (eventLoop) { if (eventLoop) {
eventLoop->exit(); eventLoop->exit();
} }
setFocus(); setFocus();
emit hid(); Q_EMIT hid();
QFrame::hideEvent(e); QFrame::hideEvent(e);
} }
@ -832,23 +832,23 @@ void ColorPickerPopup::showEvent(QShowEvent *)
{ {
bool foundSelected = false; bool foundSelected = false;
for (int i = 0; i < grid->columnCount(); ++i) { for (int i = 0; i < grid->columnCount(); ++i) {
for (int j = 0; j < grid->rowCount(); ++j) { for (int j = 0; j < grid->rowCount(); ++j) {
QWidget *w = widgetAt[j][i]; QWidget *w = widgetAt[j][i];
if (w && w->inherits("ColorPickerItem")) { if (w && w->inherits("ColorPickerItem")) {
if (((ColorPickerItem *)w)->isSelected()) { if (((ColorPickerItem *)w)->isSelected()) {
w->setFocus(); w->setFocus();
foundSelected = true; foundSelected = true;
break; break;
} }
} }
} }
} }
if (!foundSelected) { if (!foundSelected) {
if (items.count() == 0) if (items.count() == 0)
setFocus(); setFocus();
else else
widgetAt[0][0]->setFocus(); widgetAt[0][0]->setFocus();
} }
} }
@ -861,7 +861,7 @@ void ColorPickerPopup::regenerateGrid()
int columns = cols; int columns = cols;
if (columns == -1) if (columns == -1)
columns = (int) ceil(sqrt((float) items.count())); columns = (int) ceil(sqrt((float) items.count()));
// When the number of columns grows, the number of rows will // When the number of columns grows, the number of rows will
// fall. There's no way to shrink a grid, so we create a new // fall. There's no way to shrink a grid, so we create a new
@ -884,8 +884,8 @@ void ColorPickerPopup::regenerateGrid()
} }
if (moreButton) { if (moreButton) {
grid->addWidget(moreButton, crow, ccol); grid->addWidget(moreButton, crow, ccol);
widgetAt[crow][ccol] = moreButton; widgetAt[crow][ccol] = moreButton;
} }
updateGeometry(); updateGeometry();
} }
@ -901,12 +901,12 @@ void ColorPickerPopup::getColorFromDialog()
//QRgb rgb = QColorDialog::getRgba(lastSel.rgba(), &ok, parentWidget()); //QRgb rgb = QColorDialog::getRgba(lastSel.rgba(), &ok, parentWidget());
QColor col = QColorDialog::getColor(lastSel,parentWidget(),0,QColorDialog::ShowAlphaChannel); QColor col = QColorDialog::getColor(lastSel,parentWidget(),0,QColorDialog::ShowAlphaChannel);
if (!col.isValid()) if (!col.isValid())
return; return;
//QColor col = QColor::fromRgba(rgb); //QColor col = QColor::fromRgba(rgb);
insertColor(col, tr("Custom"), -1); insertColor(col, tr("Custom"), -1);
lastSel = col; lastSel = col;
emit selected(col); Q_EMIT selected(col);
} }
void ColorPickerPopup::setLastSel(const QColor & col) { lastSel = col; } void ColorPickerPopup::setLastSel(const QColor & col) { lastSel = col; }
@ -916,7 +916,7 @@ void ColorPickerPopup::setLastSel(const QColor & col) { lastSel = col; }
whose name is set to \a text. whose name is set to \a text.
*/ */
ColorPickerItem::ColorPickerItem(const QColor &color, const QString &text, ColorPickerItem::ColorPickerItem(const QColor &color, const QString &text,
QWidget *parent) QWidget *parent)
: QFrame(parent), c(color), t(text), sel(false) : QFrame(parent), c(color), t(text), sel(false)
{ {
setToolTip(t); setToolTip(t);
@ -994,7 +994,7 @@ void ColorPickerItem::mouseMoveEvent(QMouseEvent *)
void ColorPickerItem::mouseReleaseEvent(QMouseEvent *) void ColorPickerItem::mouseReleaseEvent(QMouseEvent *)
{ {
sel = true; sel = true;
emit selected(); Q_EMIT selected();
} }
/*! /*!
@ -1018,14 +1018,14 @@ void ColorPickerItem::paintEvent(QPaintEvent *)
p.setPen( QPen( Qt::gray, 0, Qt::SolidLine ) ); p.setPen( QPen( Qt::gray, 0, Qt::SolidLine ) );
if (sel) if (sel)
p.drawRect(1, 1, w - 3, h - 3); p.drawRect(1, 1, w - 3, h - 3);
p.setPen( QPen( Qt::black, 0, Qt::SolidLine ) ); p.setPen( QPen( Qt::black, 0, Qt::SolidLine ) );
p.drawRect(3, 3, w - 7, h - 7); p.drawRect(3, 3, w - 7, h - 7);
p.fillRect(QRect(4, 4, w - 8, h - 8), QBrush(c)); p.fillRect(QRect(4, 4, w - 8, h - 8), QBrush(c));
if (hasFocus()) if (hasFocus())
p.drawRect(0, 0, w - 1, h - 1); p.drawRect(0, 0, w - 1, h - 1);
} }
/*! /*!
@ -1062,7 +1062,7 @@ void ColorPickerButton::mouseReleaseEvent(QMouseEvent *)
{ {
setFrameShadow(Raised); setFrameShadow(Raised);
repaint(); repaint();
emit clicked(); Q_EMIT clicked();
} }
/*! /*!
@ -1071,15 +1071,15 @@ void ColorPickerButton::mouseReleaseEvent(QMouseEvent *)
void ColorPickerButton::keyPressEvent(QKeyEvent *e) void ColorPickerButton::keyPressEvent(QKeyEvent *e)
{ {
if (e->key() == Qt::Key_Up if (e->key() == Qt::Key_Up
|| e->key() == Qt::Key_Down || e->key() == Qt::Key_Down
|| e->key() == Qt::Key_Left || e->key() == Qt::Key_Left
|| e->key() == Qt::Key_Right) { || e->key() == Qt::Key_Right) {
qApp->sendEvent(parent(), e); qApp->sendEvent(parent(), e);
} else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Space || e->key() == Qt::Key_Return) { } else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Space || e->key() == Qt::Key_Return) {
setFrameShadow(Sunken); setFrameShadow(Sunken);
update(); update();
} else { } else {
QFrame::keyPressEvent(e); QFrame::keyPressEvent(e);
} }
} }
@ -1089,16 +1089,16 @@ void ColorPickerButton::keyPressEvent(QKeyEvent *e)
void ColorPickerButton::keyReleaseEvent(QKeyEvent *e) void ColorPickerButton::keyReleaseEvent(QKeyEvent *e)
{ {
if (e->key() == Qt::Key_Up if (e->key() == Qt::Key_Up
|| e->key() == Qt::Key_Down || e->key() == Qt::Key_Down
|| e->key() == Qt::Key_Left || e->key() == Qt::Key_Left
|| e->key() == Qt::Key_Right) { || e->key() == Qt::Key_Right) {
qApp->sendEvent(parent(), e); qApp->sendEvent(parent(), e);
} else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Space || e->key() == Qt::Key_Return) { } else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Space || e->key() == Qt::Key_Return) {
setFrameShadow(Raised); setFrameShadow(Raised);
repaint(); repaint();
emit clicked(); Q_EMIT clicked();
} else { } else {
QFrame::keyReleaseEvent(e); QFrame::keyReleaseEvent(e);
} }
} }
@ -1144,8 +1144,8 @@ void ColorPickerButton::paintEvent(QPaintEvent *e)
p.drawRect(r.center().x() + offset , r.center().y() + offset, 1, 1); p.drawRect(r.center().x() + offset , r.center().y() + offset, 1, 1);
p.drawRect(r.center().x() + offset + 4, r.center().y() + offset, 1, 1); p.drawRect(r.center().x() + offset + 4, r.center().y() + offset, 1, 1);
if (hasFocus()) { if (hasFocus()) {
p.setPen( QPen( Qt::black, 0, Qt::SolidLine ) ); p.setPen( QPen( Qt::black, 0, Qt::SolidLine ) );
p.drawRect(0, 0, width() - 1, height() - 1); p.drawRect(0, 0, width() - 1, height() - 1);
} }
p.end(); p.end();

View File

@ -182,7 +182,7 @@ void FileChooser::chooseFile()
if (!fn.isEmpty()) { if (!fn.isEmpty()) {
lineEdit->setText(fn); lineEdit->setText(fn);
emit fileNameSelected(fn); Q_EMIT fileNameSelected(fn);
} }
} }
@ -595,9 +595,9 @@ QAbstractSpinBox::StepEnabled QuantitySpinBox::stepEnabled() const
} }
return ret; return ret;
} }
void QuantitySpinBox::stepBy(int steps) void QuantitySpinBox::stepBy(int steps)
{ {
double step = StepSize * steps; double step = StepSize * steps;
double val = Value + step; double val = Value + step;
if (val > Maximum) if (val > Maximum)
@ -607,7 +607,7 @@ void QuantitySpinBox::stepBy(int steps)
lineEdit()->setText(QString::fromUtf8("%L1 %2").arg(val).arg(UnitStr)); lineEdit()->setText(QString::fromUtf8("%L1 %2").arg(val).arg(UnitStr));
update(); update();
} }
void QuantitySpinBox::setUnitText(QString str) void QuantitySpinBox::setUnitText(QString str)
{ {
@ -792,9 +792,9 @@ public:
UIntSpinBox::UIntSpinBox (QWidget* parent) UIntSpinBox::UIntSpinBox (QWidget* parent)
: QSpinBox (parent) : QSpinBox (parent)
{ {
d = new UIntSpinBoxPrivate; d = new UIntSpinBoxPrivate;
d->mValidator = new UnsignedValidator(this->minimum(), this->maximum(), this); d->mValidator = new UnsignedValidator(this->minimum(), this->maximum(), this);
connect(this, SIGNAL(valueChanged(int)), connect(this, SIGNAL(valueChanged(int)),
this, SLOT(valueChange(int))); this, SLOT(valueChange(int)));
setRange(0, 99); setRange(0, 99);
setValue(0); setValue(0);
@ -802,7 +802,7 @@ UIntSpinBox::UIntSpinBox (QWidget* parent)
} }
UIntSpinBox::~UIntSpinBox() UIntSpinBox::~UIntSpinBox()
{ {
delete d->mValidator; delete d->mValidator;
delete d; d = 0; delete d; d = 0;
} }
@ -1032,7 +1032,7 @@ void ColorButton::onChooseColor()
if ( c.isValid() ) if ( c.isValid() )
{ {
setColor( c ); setColor( c );
emit changed(); Q_EMIT changed();
} }
} }

View File

@ -153,7 +153,7 @@ void Wizard::setCurrentIndex(int index)
textLabel->setText(stackWidget->currentWidget()->windowTitle()); textLabel->setText(stackWidget->currentWidget()->windowTitle());
_backButton->setEnabled(index > 0); _backButton->setEnabled(index > 0);
_nextButton->setEnabled(index < count()-1); _nextButton->setEnabled(index < count()-1);
emit currentIndexChanged(index); Q_EMIT currentIndexChanged(index);
} }
} }
@ -171,7 +171,7 @@ void Wizard::setPageTitle(QString const &newTitle)
{ {
stackWidget->currentWidget()->setWindowTitle(newTitle); stackWidget->currentWidget()->setWindowTitle(newTitle);
textLabel->setText(newTitle); textLabel->setText(newTitle);
emit pageTitleChanged(newTitle); Q_EMIT pageTitleChanged(newTitle);
} }
WizardExtension::WizardExtension(Wizard *widget, QObject *parent) WizardExtension::WizardExtension(Wizard *widget, QObject *parent)