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()) {
removeEdges(in_edges, out_edges, i_out_deg_pair, [&](Edge e) { return target(e, DepList); });
changed = true;
i_out_deg_pair = out_edges.equal_range(*uvi);
}
// 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_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
${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
)
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()
{
if (myExpandable) {
emit activated();
Q_EMIT activated();
// 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.
#if 0
@ -254,7 +254,7 @@ void TaskHeader::changeIcons()
void TaskHeader::mouseReleaseEvent ( QMouseEvent * event )
{
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
this->waitcond.wait(&this->mutex);
if (!this->isstopped) {
emit triggerSignal();
Q_EMIT triggerSignal();
}
}
}

View File

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

View File

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

View File

@ -128,7 +128,7 @@ class plane:
self.u = Vector(0,1,0)
self.v = Vector(0,0,1)
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.v = Vector(0,0,1)
elif upvec:

View File

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

View File

@ -70,6 +70,7 @@
#include <App/Document.h>
#include <App/DocumentObjectPy.h>
#include <Mod/Part/App/PartFeature.h>
#include <Mod/Part/App/FeatureCompound.h>
#include <Mod/Part/App/ProgressIndicator.h>
#include <Mod/Part/App/ImportIges.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)
{
const TopoDS_Shape& aShape = aShapeTool->GetShape(label);
std::vector<App::DocumentObject*> lValue;
if (!aShape.IsNull() && aShape.ShapeType() == TopAbs_COMPOUND) {
TopExp_Explorer xp;
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++)
createShape(xp.Current(), loc, name);
createShape(xp.Current(), loc, name, lValue);
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)
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"));
if (!loc.IsIdentity())
@ -215,6 +223,7 @@ void ImportOCAF::createShape(const TopoDS_Shape& aShape, const TopLoc_Location&
else
part->Shape.setValue(aShape);
part->Label.setValue(name);
lvalue.push_back(part);
Quantity_Color aColor;
App::Color color(0.8f,0.8f,0.8f);

View File

@ -59,7 +59,7 @@ public:
private:
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 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>&){}
private:

View File

@ -186,7 +186,7 @@ Intersection of this and a given list of topo shapes.
Supports:
- 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
OCC 6.9.0 or later is required.</UserDocu>
@ -203,7 +203,7 @@ Section of this and a given list of topo shapes.
Supports:
- 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
OCC 6.9.0 or later is required.</UserDocu>

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@
<x>0</x>
<y>0</y>
<width>334</width>
<height>313</height>
<height>327</height>
</rect>
</property>
<attribute name="icon">
@ -98,7 +98,7 @@
<x>0</x>
<y>0</y>
<width>334</width>
<height>313</height>
<height>327</height>
</rect>
</property>
<attribute name="icon">
@ -148,7 +148,7 @@
<x>0</x>
<y>0</y>
<width>334</width>
<height>313</height>
<height>327</height>
</rect>
</property>
<attribute name="label">
@ -206,7 +206,7 @@
<x>0</x>
<y>0</y>
<width>334</width>
<height>313</height>
<height>327</height>
</rect>
</property>
<attribute name="icon">
@ -277,30 +277,6 @@
<item row="3" column="1">
<widget class="QWidget" name="widget_4" native="true">
<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">
<widget class="QLabel" name="label_8">
<property name="text">
@ -309,7 +285,14 @@
</widget>
</item>
<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 row="0" column="2">
<widget class="Gui::InputField" name="extraOffset">
@ -321,13 +304,24 @@
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="Gui::InputField" name="rollRadius">
<property name="minimum">
<double>0.000000000000000</double>
<item row="1" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Roll Radius</string>
</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">
<string notr="true">mm</string>
<string notr="true"/>
</property>
</widget>
</item>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -34,7 +34,7 @@
<x>0</x>
<y>0</y>
<width>334</width>
<height>387</height>
<height>395</height>
</rect>
</property>
<attribute name="icon">
@ -112,7 +112,7 @@
<x>0</x>
<y>0</y>
<width>334</width>
<height>387</height>
<height>395</height>
</rect>
</property>
<attribute name="icon">
@ -165,19 +165,6 @@
</property>
</widget>
</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">
<widget class="QLabel" name="label_2">
<property name="text">
@ -185,6 +172,13 @@
</property>
</widget>
</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>
</widget>
<widget class="QWidget" name="Heights">
@ -192,8 +186,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>334</width>
<height>387</height>
<width>144</width>
<height>56</height>
</rect>
</property>
<attribute name="icon">
@ -242,8 +236,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>334</width>
<height>387</height>
<width>203</width>
<height>31</height>
</rect>
</property>
<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", "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::PropertyVectorList", "locs", "Tags", QtCore.QT_TRANSLATE_NOOP("App::Property","List of holding tag locations"))
@ -439,23 +439,23 @@ class TaskPanel:
def getFields(self):
if self.obj:
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"):
self.obj.FinalDepth = self.form.finalDepth.text()
self.obj.FinalDepth = FreeCAD.Units.Quantity(self.form.finalDepth.text()).Value
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"):
self.obj.ClearanceHeight = self.form.clearanceHeight.text()
self.obj.ClearanceHeight = FreeCAD.Units.Quantity(self.form.clearanceHeight.text()).Value
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"):
self.obj.OffsetExtra = self.form.extraOffset.text()
if hasattr(self.obj, "SegLen"):
self.obj.SegLen = self.form.segLen.value()
self.obj.OffsetExtra = FreeCAD.Units.Quantity(self.form.extraOffset.text()).Value
#if hasattr(self.obj, "SegLen"):
# self.obj.SegLen = self.form.segLen.value()
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"):
self.obj.PlungeAngle = str(self.form.plungeAngle.value())
self.obj.PlungeAngle = FreeCAD.Units.Quantity(self.form.plungeAngle.text()).Value
if hasattr(self.obj, "UseComp"):
self.obj.UseComp = self.form.useCompensation.isChecked()
if hasattr(self.obj, "UseStartPoint"):
@ -467,15 +467,15 @@ class TaskPanel:
self.obj.Proxy.execute(self.obj)
def setFields(self):
self.form.startDepth.setText(str(self.obj.StartDepth.Value))
self.form.finalDepth.setText(str(self.obj.FinalDepth.Value))
self.form.safeHeight.setText(str(self.obj.SafeHeight.Value))
self.form.clearanceHeight.setText(str(self.obj.ClearanceHeight.Value))
self.form.stepDown.setText(str(self.obj.StepDown.Value))
self.form.extraOffset.setText(str(self.obj.OffsetExtra.Value))
self.form.segLen.setValue(self.obj.SegLen.Value)
self.form.rollRadius.setText(str(self.obj.RollRadius.Value))
self.form.plungeAngle.setValue(self.obj.PlungeAngle.Value)
self.form.startDepth.setText(FreeCAD.Units.Quantity(self.obj.StartDepth.Value, FreeCAD.Units.Length).UserString)
self.form.finalDepth.setText(FreeCAD.Units.Quantity(self.obj.FinalDepth.Value, FreeCAD.Units.Length).UserString)
self.form.safeHeight.setText(FreeCAD.Units.Quantity(self.obj.SafeHeight.Value, FreeCAD.Units.Length).UserString)
self.form.clearanceHeight.setText(FreeCAD.Units.Quantity(self.obj.ClearanceHeight.Value, FreeCAD.Units.Length).UserString)
self.form.stepDown.setText(FreeCAD.Units.Quantity(self.obj.StepDown.Value, FreeCAD.Units.Length).UserString)
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.rollRadius.setText(FreeCAD.Units.Quantity(self.obj.RollRadius.Value, FreeCAD.Units.Length).UserString)
self.form.plungeAngle.setText(FreeCAD.Units.Quantity(self.obj.PlungeAngle.Value, FreeCAD.Units.Angle).UserString)
self.form.useCompensation.setChecked(self.obj.UseComp)
self.form.useStartPoint.setChecked(self.obj.UseStartPoint)
self.form.useEndPoint.setChecked(self.obj.UseEndPoint)
@ -609,7 +609,7 @@ class TaskPanel:
self.form.useStartPoint.clicked.connect(self.getFields)
self.form.useEndPoint.clicked.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)
# Tag Form

View File

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

View File

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

View File

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

View File

@ -338,7 +338,7 @@ class ObjectPocket:
else:
output += "G3"
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"
last = point
else:
@ -545,17 +545,17 @@ class TaskPanel:
def getFields(self):
if self.obj:
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"):
self.obj.FinalDepth = self.form.finalDepth.text()
self.obj.FinalDepth = FreeCAD.Units.Quantity(self.form.finalDepth.text()).Value
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"):
self.obj.ClearanceHeight = self.form.clearanceHeight.text()
self.obj.ClearanceHeight = FreeCAD.Units.Quantity(self.form.clearanceHeight.text()).Value
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"):
self.obj.MaterialAllowance = self.form.extraOffset.text()
self.obj.MaterialAllowance = FreeCAD.Units.Quantity(self.form.extraOffset.text()).Value
if hasattr(self.obj, "UseStartPoint"):
self.obj.UseStartPoint = self.form.useStartPoint.isChecked()
if hasattr(self.obj, "Algorithm"):
@ -567,23 +567,23 @@ class TaskPanel:
if hasattr(self.obj, "ZigUnidirectional"):
self.obj.ZigUnidirectional = self.form.zigZagUnidirectional.isChecked()
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"):
self.obj.StepOver = self.form.stepOverPercent.value()
self.obj.Proxy.execute(self.obj)
def setFields(self):
self.form.startDepth.setText(str(self.obj.StartDepth.Value))
self.form.finalDepth.setText(str(self.obj.FinalDepth.Value))
self.form.safeHeight.setText(str(self.obj.SafeHeight.Value))
self.form.clearanceHeight.setText(str(self.obj.ClearanceHeight.Value))
self.form.stepDown.setText(str(self.obj.StepDown))
self.form.extraOffset.setText(str(self.obj.MaterialAllowance.Value))
self.form.startDepth.setText(FreeCAD.Units.Quantity(self.obj.StartDepth.Value, FreeCAD.Units.Length).UserString)
self.form.finalDepth.setText(FreeCAD.Units.Quantity(self.obj.FinalDepth.Value, FreeCAD.Units.Length).UserString)
self.form.safeHeight.setText(FreeCAD.Units.Quantity(self.obj.SafeHeight.Value, FreeCAD.Units.Length).UserString)
self.form.clearanceHeight.setText(FreeCAD.Units.Quantity(self.obj.ClearanceHeight.Value, FreeCAD.Units.Length).UserString)
self.form.stepDown.setText(FreeCAD.Units.Quantity(self.obj.StepDown.Value, FreeCAD.Units.Length).UserString)
self.form.extraOffset.setText(FreeCAD.Units.Quantity(self.obj.MaterialAllowance, FreeCAD.Units.Length).UserString)
self.form.useStartPoint.setChecked(self.obj.UseStartPoint)
self.form.useZigZag.setChecked(self.obj.UseZigZag)
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)
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", "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::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"))
@ -486,24 +486,25 @@ class TaskPanel:
def getFields(self):
if self.obj:
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"):
self.obj.FinalDepth = self.form.finalDepth.text()
self.obj.FinalDepth = FreeCAD.Units.Quantity(self.form.finalDepth.text()).Value
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"):
self.obj.ClearanceHeight = self.form.clearanceHeight.text()
self.obj.ClearanceHeight = FreeCAD.Units.Quantity(self.form.clearanceHeight.text()).Value
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"):
self.obj.OffsetExtra = self.form.extraOffset.text()
if hasattr(self.obj, "SegLen"):
self.obj.SegLen = self.form.segLen.value()
self.obj.OffsetExtra = FreeCAD.Units.Quantity(self.form.extraOffset.text()).Value
# if hasattr(self.obj, "SegLen"):
# self.obj.SegLen = self.form.segLen.value()
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"):
self.obj.PlungeAngle = str(self.form.plungeAngle.value())
self.obj.PlungeAngle = FreeCAD.Units.Quantity(self.form.plungeAngle.text()).Value
if hasattr(self.obj, "UseComp"):
self.obj.UseComp = self.form.useCompensation.isChecked()
if hasattr(self.obj, "UseStartPoint"):
@ -521,15 +522,15 @@ class TaskPanel:
self.obj.Proxy.execute(self.obj)
def setFields(self):
self.form.startDepth.setText(str(self.obj.StartDepth.Value))
self.form.finalDepth.setText(str(self.obj.FinalDepth.Value))
self.form.safeHeight.setText(str(self.obj.SafeHeight.Value))
self.form.clearanceHeight.setText(str(self.obj.ClearanceHeight.Value))
self.form.stepDown.setText(str(self.obj.StepDown))
self.form.extraOffset.setText(str(self.obj.OffsetExtra.Value))
self.form.segLen.setValue(self.obj.SegLen.Value)
self.form.rollRadius.setText(str(self.obj.RollRadius.Value))
self.form.plungeAngle.setValue(self.obj.PlungeAngle.Value)
self.form.startDepth.setText(FreeCAD.Units.Quantity(self.obj.StartDepth.Value, FreeCAD.Units.Length).UserString)
self.form.finalDepth.setText(FreeCAD.Units.Quantity(self.obj.FinalDepth.Value, FreeCAD.Units.Length).UserString)
self.form.safeHeight.setText(FreeCAD.Units.Quantity(self.obj.SafeHeight.Value, FreeCAD.Units.Length).UserString)
self.form.clearanceHeight.setText(FreeCAD.Units.Quantity(self.obj.ClearanceHeight.Value, FreeCAD.Units.Length).UserString)
self.form.stepDown.setText(FreeCAD.Units.Quantity(self.obj.StepDown.Value, FreeCAD.Units.Length).UserString)
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.rollRadius.setText(FreeCAD.Units.Quantity(self.obj.RollRadius.Value, FreeCAD.Units.Length).UserString)
self.form.plungeAngle.setText(FreeCAD.Units.Quantity(self.obj.PlungeAngle.Value, FreeCAD.Units.Angle).UserString)
self.form.useCompensation.setChecked(self.obj.UseComp)
self.form.useStartPoint.setChecked(self.obj.UseStartPoint)
self.form.useEndPoint.setChecked(self.obj.UseEndPoint)
@ -753,7 +754,7 @@ class TaskPanel:
self.form.useStartPoint.clicked.connect(self.getFields)
self.form.useEndPoint.clicked.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.processHoles.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", "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::PropertyVectorList", "locs", "Tags", QtCore.QT_TRANSLATE_NOOP("App::Property","List of holding tag locations"))
@ -473,24 +473,25 @@ class TaskPanel:
def getFields(self):
if self.obj:
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"):
self.obj.FinalDepth = self.form.finalDepth.text()
self.obj.FinalDepth = FreeCAD.Units.Quantity(self.form.finalDepth.text()).Value
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"):
self.obj.ClearanceHeight = self.form.clearanceHeight.text()
self.obj.ClearanceHeight = FreeCAD.Units.Quantity(self.form.clearanceHeight.text()).Value
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"):
self.obj.OffsetExtra = self.form.extraOffset.text()
if hasattr(self.obj, "SegLen"):
self.obj.SegLen = self.form.segLen.value()
self.obj.OffsetExtra = FreeCAD.Units.Quantity(self.form.extraOffset.text()).Value
# if hasattr(self.obj, "SegLen"):
# self.obj.SegLen = self.form.segLen.value()
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"):
self.obj.PlungeAngle = str(self.form.plungeAngle.value())
self.obj.PlungeAngle = FreeCAD.Units.Quantity(self.form.plungeAngle.text()).Value
if hasattr(self.obj, "UseComp"):
self.obj.UseComp = self.form.useCompensation.isChecked()
if hasattr(self.obj, "UseStartPoint"):
@ -506,15 +507,15 @@ class TaskPanel:
self.obj.Proxy.execute(self.obj)
def setFields(self):
self.form.startDepth.setText(str(self.obj.StartDepth.Value))
self.form.finalDepth.setText(str(self.obj.FinalDepth.Value))
self.form.safeHeight.setText(str(self.obj.SafeHeight.Value))
self.form.clearanceHeight.setText(str(self.obj.ClearanceHeight.Value))
self.form.stepDown.setText(str(self.obj.StepDown.Value))
self.form.extraOffset.setText(str(self.obj.OffsetExtra.Value))
self.form.segLen.setValue(self.obj.SegLen.Value)
self.form.rollRadius.setText(str(self.obj.RollRadius.Value))
self.form.plungeAngle.setValue(self.obj.PlungeAngle.Value)
self.form.startDepth.setText(FreeCAD.Units.Quantity(self.obj.StartDepth.Value, FreeCAD.Units.Length).UserString)
self.form.finalDepth.setText(FreeCAD.Units.Quantity(self.obj.FinalDepth.Value, FreeCAD.Units.Length).UserString)
self.form.safeHeight.setText(FreeCAD.Units.Quantity(self.obj.SafeHeight.Value, FreeCAD.Units.Length).UserString)
self.form.clearanceHeight.setText(FreeCAD.Units.Quantity(self.obj.ClearanceHeight.Value, FreeCAD.Units.Length).UserString)
self.form.stepDown.setText(FreeCAD.Units.Quantity(self.obj.StepDown.Value, FreeCAD.Units.Length).UserString)
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.rollRadius.setText(FreeCAD.Units.Quantity(self.obj.RollRadius.Value, FreeCAD.Units.Length).UserString)
self.form.plungeAngle.setText(FreeCAD.Units.Quantity(self.obj.PlungeAngle.Value, FreeCAD.Units.Angle).UserString)
self.form.useCompensation.setChecked(self.obj.UseComp)
self.form.useStartPoint.setChecked(self.obj.UseStartPoint)
self.form.useEndPoint.setChecked(self.obj.UseEndPoint)
@ -729,7 +730,7 @@ class TaskPanel:
self.form.useStartPoint.clicked.connect(self.getFields)
self.form.useEndPoint.clicked.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)
# Tag Form

View File

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

View File

@ -35,6 +35,7 @@ from DraftGeomUtils import geomType
import PathScripts
from PathScripts import PathJob
# import itertools
import numpy
def cleanedges(splines, precision):
'''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.
equalstep=True: all steps down before the finish pass will be equalized.'''
depths = []
if self.user_depths is not None:
depths = self.user_depths
else:
total_depth = self.start_depth - self.final_depth
if total_depth <= 0:
return depths
layers_required = int((total_depth - self.z_finish_step) / self.step_down)
partial_steplayer = (total_depth - self.z_finish_step) % self.step_down
if equalstep is True and partial_steplayer > 0:
layerstep = float((total_depth - self.z_finish_step) / (layers_required + 1))
return self.user_depths
total_depth = self.start_depth - self.final_depth
if total_depth < 0:
return []
depths = [self.final_depth]
# 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:
layerstep = self.step_down
return depths
for step in range(layers_required):
d = self.start_depth - ((step +1) * layerstep)
depths.append(d)
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)
if equalstep:
depths += self.__equal_steps(self.start_depth, depths[-1], self.step_down)[1:]
else:
depths += self.__fixed_steps(self.start_depth, depths[-1], self.step_down)[1:]
depths.reverse()
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
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)
r = d.get_depths()
@ -109,7 +109,7 @@ class depthTestCases(unittest.TestCase):
self.assertListEqual (r, expected)
def test40(self):
'''Finish depth passed in.'''
'''z_finish_step passed in.'''
clearance_height= 10
rapid_safety_space = 5
@ -161,3 +161,23 @@ class depthTestCases(unittest.TestCase):
r = d.get_depths(equalstep=True)
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
from PathTests.TestPathCore import TestPathCore
from PathTests.TestPathPost import PathPostTestCases
from PathTests.TestPathGeom import TestPathGeom

View File

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

View File

@ -27,6 +27,7 @@
# include <QContextMenuEvent>
# include <QMenu>
# include <QRegExp>
# include <QShortcut>
# include <QString>
#endif
@ -231,6 +232,8 @@ void ElementView::keyPressEvent(QKeyEvent * event)
// ----------------------------------------------------------------------------
/* TRANSLATOR SketcherGui::TaskSketcherElements */
TaskSketcherElements::TaskSketcherElements(ViewProviderSketch *sketchView)
: TaskBox(Gui::BitmapFactory().pixmap("document-new"),tr("Elements"),true, 0)
, sketchView(sketchView)
@ -244,6 +247,18 @@ TaskSketcherElements::TaskSketcherElements(ViewProviderSketch *sketchView)
// we need a separate container widget to add all controls to
proxy = new QWidget(this);
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->setEditTriggers(QListWidget::NoEditTriggers);
ui->listWidgetElements->setMouseTracking(true);

View File

@ -91,7 +91,7 @@
<item>
<widget class="QLabel" name="Explanation">
<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>
</widget>
</item>

View File

@ -1283,6 +1283,7 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2d &toPo
else if (Constr->Type == Angle) {
Base::Vector3d p0(0.,0.,0.);
double factor = 0.5;
if (Constr->Second != Constraint::GeoUndef) { // line to line angle
Base::Vector3d dir1, dir2;
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 x = (dir1.x*c2 - dir2.x*c1)/det;
double y = (dir1.y*c2 - dir2.y*c1)/det;
// intersection point
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
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
dir2 = getSketchObject()->getSolvedSketch().calculateNormalAtPoint(Constr->Second, p.x, p.y);
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
@ -1338,7 +1346,7 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2d &toPo
return;
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
@ -4090,7 +4098,7 @@ Restart:
}
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);
endangle = startangle + range;

View File

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

View File

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

View File

@ -153,7 +153,7 @@ void Wizard::setCurrentIndex(int index)
textLabel->setText(stackWidget->currentWidget()->windowTitle());
_backButton->setEnabled(index > 0);
_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);
textLabel->setText(newTitle);
emit pageTitleChanged(newTitle);
Q_EMIT pageTitleChanged(newTitle);
}
WizardExtension::WizardExtension(Wizard *widget, QObject *parent)