diff --git a/src/App/Document.cpp b/src/App/Document.cpp index 23547b101..77be9f9c5 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -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 diff --git a/src/Build/CMakeLists.txt b/src/Build/CMakeLists.txt index af4727820..924f4859e 100644 --- a/src/Build/CMakeLists.txt +++ b/src/Build/CMakeLists.txt @@ -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) diff --git a/src/Gui/QSint/actionpanel/taskheader_p.cpp b/src/Gui/QSint/actionpanel/taskheader_p.cpp index 8ea426a25..42f18b9dc 100644 --- a/src/Gui/QSint/actionpanel/taskheader_p.cpp +++ b/src/Gui/QSint/actionpanel/taskheader_p.cpp @@ -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(); } } diff --git a/src/Gui/Quarter/SignalThread.cpp b/src/Gui/Quarter/SignalThread.cpp index 2b7254d3c..6d18f8636 100644 --- a/src/Gui/Quarter/SignalThread.cpp +++ b/src/Gui/Quarter/SignalThread.cpp @@ -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(); } } } diff --git a/src/Gui/iisTaskPanel/src/iisiconlabel.cpp b/src/Gui/iisTaskPanel/src/iisiconlabel.cpp index f014cbf3c..f967eacc3 100644 --- a/src/Gui/iisTaskPanel/src/iisiconlabel.cpp +++ b/src/Gui/iisTaskPanel/src/iisiconlabel.cpp @@ -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); } diff --git a/src/Gui/iisTaskPanel/src/iistaskheader.cpp b/src/Gui/iisTaskPanel/src/iistaskheader.cpp index 12e75cc20..4d1cd4243 100644 --- a/src/Gui/iisTaskPanel/src/iistaskheader.cpp +++ b/src/Gui/iisTaskPanel/src/iistaskheader.cpp @@ -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(); + } } diff --git a/src/Mod/Draft/WorkingPlane.py b/src/Mod/Draft/WorkingPlane.py index e92bf26d4..990b582fa 100644 --- a/src/Mod/Draft/WorkingPlane.py +++ b/src/Mod/Draft/WorkingPlane.py @@ -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: diff --git a/src/Mod/Fem/Gui/Resources/translations/Fem_ru.ts b/src/Mod/Fem/Gui/Resources/translations/Fem_ru.ts index bf355426e..e419c17f6 100755 --- a/src/Mod/Fem/Gui/Resources/translations/Fem_ru.ts +++ b/src/Mod/Fem/Gui/Resources/translations/Fem_ru.ts @@ -32,12 +32,12 @@ Create FEM mesh - Создать МКЭ сетку + Создать МКЭ-сетку Create FEM mesh from shape - Создать МКЭ сетку из формы + Создать МКЭ-сетку из формы @@ -207,7 +207,7 @@ Add a part to the Analysis - Добавить новую часть в Анализ + Добавить новую часть в анализ @@ -225,7 +225,7 @@ Create FEM constraint for a bearing - Создать МКЭ ограничения для подшипника + Создать МКЭ-ограничения для подшипника @@ -292,12 +292,12 @@ Create FEM gear constraint - Создать МКЭ передач с ограничениями + Создать передаточное МКЭ-ограничение Create FEM constraint for a gear - Создать МКЭ с ограничениями для передач + Создать МКЭ-ограничение для передачи @@ -328,12 +328,12 @@ Create FEM pulley constraint - Создать МКЭ с ограничениями для шкивов + Создать шкивовое МКЭ-ограничение Create FEM constraint for a pulley - Create FEM constraint for a pulley + Создать МКЭ-ограничение для шкива @@ -347,7 +347,7 @@ Create a FEM analysis - Создать МКЭ анализ + Создать МКЭ-анализ @@ -358,11 +358,11 @@ Create FEM mesh - Создать МКЭ сетку + Создать МКЭ-сетку Create FEM mesh from shape - Создать МКЭ сетку из формы + Создать МКЭ-сетку из формы @@ -386,7 +386,7 @@ Select a single FEM mesh or nodes set, please. - Select a single FEM mesh or nodes set, please. + Выберите одну МКЭ-сетку или набор узлов, пожалуйста. @@ -488,12 +488,12 @@ High frequency limit - Ограничение высокой частоты + Верхнее ограничение частоты Low frequency limit - Ограничение низкой частоты + Нижнее ограничение частоты @@ -519,7 +519,7 @@ Use materials from user defined directory - Use materials from user defined directory + Использовать материалы из каталога, определённого пользователем @@ -535,7 +535,7 @@ Quadrangle - Четырехугольник + Четырёхугольник Maximum length @@ -645,7 +645,7 @@ Edit FEM mesh - Edit FEM mesh + Редактировать МКЭ-сеть @@ -666,7 +666,7 @@ FEM constraint parameters - Параметры зависимостей МКЭ + Параметры ограничений МКЭ @@ -689,7 +689,7 @@ Please use only a single reference for bearing constraint - Пожалуйста, используйте только одну ссылку для подшипников с ограничениями + Пожалуйста, используйте только одну ссылку для ограничений подшипника @@ -761,12 +761,12 @@ Mixed shape types are not possible. Use a second constraint instead - Не возможны смешанные типы формы. Вместо этого используйте второе ограничение + Не разрешены смешанные типы формы. Вместо этого используйте второе ограничение Only faces, edges and vertices can be picked - Можно выбрать только грани, ребра и вершины + Можно выбрать только грани, рёбра и вершины @@ -803,12 +803,12 @@ Mixed shape types are not possible. Use a second constraint instead - Не возможны смешанные типы формы. Вместо этого используйте второе ограничение + Не разрешены смешанные типы формы. Вместо этого используйте второе ограничение Only faces, edges and vertices can be picked - Можно выбрать только грани, ребра и вершины + Можно выбрать только грани, рёбра и вершины @@ -965,7 +965,7 @@ Leave references blank - Leave references blank + Оставить ссылки пустыми @@ -1000,7 +1000,7 @@ Working directory - Working directory + Рабочий каталог @@ -1010,12 +1010,12 @@ Analysis type - Analysis type + Тип анализа Static - Static + Статический @@ -1025,7 +1025,7 @@ Write .inp file - Write .inp file + Записать файл .inp @@ -1063,7 +1063,7 @@ choose... - выберете... + выберите... @@ -1078,7 +1078,7 @@ Leave references blank - Leave references blank + Оставить ссылки пустыми @@ -1088,7 +1088,7 @@ Add reference - Add reference + Добавить ссылку @@ -1126,7 +1126,7 @@ Pa - ПА + Па @@ -1134,7 +1134,7 @@ No active Analysis - Анализ не активен + Нет активного анализа @@ -1192,7 +1192,7 @@ Combo View - Комбо панель + Комбинированный вид combiTab @@ -1711,7 +1711,7 @@ Max. Size: - Max. Size: + Макс. размер: @@ -1726,17 +1726,17 @@ VeryCoarse - VeryCoarse + ОченьГрубо Coarse - Coarse + Грубо Moderate - Moderate + Средне @@ -1776,7 +1776,7 @@ Node count: - Счетчик узлов: + Счётчик узлов: diff --git a/src/Mod/Import/App/ImportOCAF.cpp b/src/Mod/Import/App/ImportOCAF.cpp index 5b4fd3371..8e1ffe54e 100644 --- a/src/Mod/Import/App/ImportOCAF.cpp +++ b/src/Mod/Import/App/ImportOCAF.cpp @@ -70,6 +70,7 @@ #include #include #include +#include #include #include #include @@ -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 lValue; + if (!aShape.IsNull() && aShape.ShapeType() == TopAbs_COMPOUND) { TopExp_Explorer xp; int ctSolids = 0, ctShells = 0; + + Part::Compound *pcCompound = static_cast(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& lvalue) { Part::Feature* part = static_cast(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); diff --git a/src/Mod/Import/App/ImportOCAF.h b/src/Mod/Import/App/ImportOCAF.h index c03483ade..dbf077d90 100644 --- a/src/Mod/Import/App/ImportOCAF.h +++ b/src/Mod/Import/App/ImportOCAF.h @@ -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 &); virtual void applyColors(Part::Feature*, const std::vector&){} private: diff --git a/src/Mod/Part/App/TopoShapePy.xml b/src/Mod/Part/App/TopoShapePy.xml index ab11fe4eb..edc807ca9 100644 --- a/src/Mod/Part/App/TopoShapePy.xml +++ b/src/Mod/Part/App/TopoShapePy.xml @@ -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. @@ -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. diff --git a/src/Mod/Part/BOPTools/SplitFeatures.py b/src/Mod/Part/BOPTools/SplitFeatures.py index 5e9afcec9..1d639c72a 100644 --- a/src/Mod/Part/BOPTools/SplitFeatures.py +++ b/src/Mod/Part/BOPTools/SplitFeatures.py @@ -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): diff --git a/src/Mod/Part/Gui/Resources/translations/Part_ru.ts b/src/Mod/Part/Gui/Resources/translations/Part_ru.ts index cc6a30d06..5e50c917a 100644 --- a/src/Mod/Part/Gui/Resources/translations/Part_ru.ts +++ b/src/Mod/Part/Gui/Resources/translations/Part_ru.ts @@ -7,7 +7,7 @@ Any Attacher reference type - + Любое @@ -37,7 +37,7 @@ Curve Attacher reference type - + Кривая @@ -61,13 +61,13 @@ Parabola Attacher reference type - + Парабола Hyperbola Attacher reference type - + Гипербола @@ -109,13 +109,13 @@ Object Attacher reference type - + Объект Solid Attacher reference type - Твердотельная модель + Твёрдотельная модель @@ -154,25 +154,25 @@ Focus1 AttachmentPoint mode caption - + Фокус1 Focus of ellipse, parabola, hyperbola. AttachmentPoint mode tooltip - + Фокус эллипса, параболы, гиперболы Focus2 AttachmentPoint mode caption - + Фокус2 Second focus of ellipse and hyperbola. AttachmentPoint mode tooltip - + Второй фокус эллипса и гиперболы @@ -184,13 +184,13 @@ Point is put on edge, MapPathParametr controls where. Additionally, vertex can be linked in for making a projection. AttachmentPoint mode tooltip - + Точка установлена на ребро, положение контролируется MapMathParametr. Дополнительно, можно прикрепить вершину для проецирования. Center of curvature AttachmentPoint mode caption - + Центр кривизны @@ -202,7 +202,7 @@ Center of mass AttachmentPoint mode caption - + Центр масс @@ -214,13 +214,13 @@ Intersection AttachmentPoint mode caption - Пересечение + Пересечение Not implemented AttachmentPoint mode tooltip - + Не реализовано @@ -277,7 +277,7 @@ Object's X AttachmentLine mode caption - + X объекта @@ -290,7 +290,7 @@ Object's Y AttachmentLine mode caption - + Y объекта @@ -302,13 +302,13 @@ Object's Z AttachmentLine mode caption - + Z объекта Axis of curvature AttachmentLine mode caption - + Ось кривизны @@ -320,67 +320,67 @@ Directrix1 AttachmentLine mode caption - + Директриса1 Directrix line for ellipse, parabola, hyperbola. AttachmentLine mode tooltip - + Директриса эллипса, параболы, гиперболы. Directrix2 AttachmentLine mode caption - + Директриса2 Second directrix line for ellipse and hyperbola. AttachmentLine mode tooltip - + Вторая директриса для эллипса и гиперболы Asymptote1 AttachmentLine mode caption - + Асимптота1 Asymptote of a hyperbola. AttachmentLine mode tooltip - + Асимптота гиперболы Asymptote2 AttachmentLine mode caption - + Асимптота2 Second asymptote of hyperbola. AttachmentLine mode tooltip - + Вторая асимптота гиперболы Tangent AttachmentLine mode caption - Тангенс + Касательная Line tangent to an edge. Optional vertex link defines where. AttachmentLine mode tooltip - + Касательная к ребру. Необязательная вершина определяет место касания. Normal AttachmentLine mode caption - + Нормаль @@ -423,13 +423,13 @@ Through two points AttachmentLine mode caption - + Через две точки Line that passes through two vertices. AttachmentLine mode tooltip - + Линия, проходящая через две вершины. @@ -441,7 +441,7 @@ Not implemented. AttachmentLine mode tooltip - + Не реализовано. @@ -453,7 +453,7 @@ Line that spans the shortest distance between shapes. AttachmentLine mode tooltip - + Линия, покрывающая кратчайшее расстояние между фигурами. @@ -522,7 +522,7 @@ Object's XY AttachmentPlane mode caption - + XY объекта @@ -534,7 +534,7 @@ Object's XZ AttachmentPlane mode caption - + XZ объекта @@ -546,7 +546,7 @@ Object's YZ AttachmentPlane mode caption - + YZ объекта @@ -570,13 +570,13 @@ Tangent to surface AttachmentPlane mode caption - + Касательная к поверхности Plane is made tangent to surface at vertex. AttachmentPlane mode tooltip - + Плоскость сделана касательной к поверхности в вершине. @@ -644,7 +644,7 @@ Plane by 3 points AttachmentPlane mode caption - + Плоскость по трём точкам @@ -656,13 +656,13 @@ Normal to 3 points AttachmentPlane mode caption - + Нормаль по трём точкам Plane will pass through first two vertices, and perpendicular to plane that passes through three vertices. AttachmentPlane mode tooltip - + Плоскость будет проходить через первые две вершины, перпендикулярно плоскости, проходящей через три. @@ -719,7 +719,7 @@ Object's X Y Z Attachment3D mode caption - + X Y Z объекта @@ -731,31 +731,31 @@ Object's X Z-Y Attachment3D mode caption - + X Z-Y объекта X', Y', Z' axes are matched with object's local X, Z, -Y, respectively. Attachment3D mode tooltip - + Оси X', Y', Z' сопоставляются с локальными X, Z, -Y объекта соответственно. Object's Y Z X Attachment3D mode caption - + Y Z X объекта X', Y', Z' axes are matched with object's local Y, Z, X, respectively. Attachment3D mode tooltip - + Оси X', Y', Z' сопоставляются с локальными Y, Z, X объекта соответственно. XY on plane Attachment3D mode caption - + XY на плоскости @@ -773,19 +773,19 @@ X' Y' plane is made tangent to surface at vertex. Attachment3D mode tooltip - + Плоскость X'Y' сделана касательной в вершине. Z tangent to edge Attachment3D mode caption - + Z-касательная к ребру. Z' axis is aligned to be tangent to edge. Optional vertex link defines where. Attachment3D mode tooltip - + Ось Z распологается касательно к ребру. Необязательная вершина определяет точку касания. @@ -859,7 +859,7 @@ Align XZ plane to pass through 3 points; X axis will pass through two first points. Attachment3D mode tooltip - + Расположить плоскость XZ так, чтобы проходила через три точки. Ось X пройдёт через первые две. @@ -1102,7 +1102,7 @@ Toggle 3d - Переключить 3d + Переключить 3d @@ -1168,7 +1168,7 @@ Create a cube solid - Создать твердотельный куб + Создать твёрдотельный куб Box @@ -1176,7 +1176,7 @@ Create a box solid - Создать твердотельный параллелепипед + Создать твёрдотельный параллелепипед @@ -1194,7 +1194,7 @@ Create a box solid without dialog - Создать твердотельный параллелепипед без диалога + Создать твёрдотельный параллелепипед без диалога @@ -1212,7 +1212,7 @@ Create a box solid without dialog - Создать твердотельный параллелепипед без диалога + Создать твёрдотельный параллелепипед без диалога @@ -1297,7 +1297,7 @@ Offset: - + Смещение: @@ -1358,7 +1358,7 @@ Create a cone solid - Создать твердотельный конус + Создать твёрдотельный конус @@ -1394,7 +1394,7 @@ Make a cut of two shapes - Выполнить обрезку двух фигур + Отсечь фигуру по фигуре @@ -1583,7 +1583,7 @@ Convert to solid - Преобразовать в твердые + Преобразовать в твёрдые @@ -1753,7 +1753,7 @@ Create ruled surface - Создать линейчатую ​​поверхность + Создать линейчатую поверхность @@ -1762,7 +1762,7 @@ Create a ruled surface from two curves - Создать линейчатую ​​поверхность из двух кривых + Создать линейчатую поверхность из двух кривых @@ -1829,12 +1829,12 @@ Create Cylinder... - Создайте цилиндр ... + Создать цилиндр ... Create a Cylinder - Создайте цилиндр + Создать цилиндр @@ -1842,7 +1842,7 @@ Create a sphere solid - Создать твердотельную сферу + Создать твёрдотельную сферу @@ -1914,7 +1914,7 @@ Create a torus solid - Создать твердотельный тор + Создать твёрдотельный тор @@ -1944,7 +1944,7 @@ DlgRevolution Select a shape for revolution, first. - Сначала выберите фигуру для революции. + Сначала выберите фигуру для вращения. @@ -2008,32 +2008,32 @@ X: - X: + X: Y: - Y: + Y: Z: - Z: + Z: Yaw: - + Угол рыска: Pitch: - Шаг: + Угол атаки: Roll: - + Угол крена: @@ -2173,7 +2173,7 @@ Select a shape on the left side, first - Сначала выберите фигуру на левой стороне + Сначала выберите фигуру слева @@ -2193,17 +2193,17 @@ Performing union on non-solids is not possible - Выполнение объединения без твердых тел не представляется возможным + Выполнение объединения без твёрдых тел не представляется возможным Performing intersection on non-solids is not possible - Выполнение пересечения без твердых тел не представляется возможным + Выполнение пересечения без твёрдых тел не представляется возможным Performing difference on non-solids is not possible - Выполнение вычитания без твердых тел не представляется возможным + Выполнение вычитания без твёрдых тел не представляется возможным @@ -2229,27 +2229,27 @@ If checked, direction of extrusion is reversed. - + Если включено, направление выдавливания обратное. Reversed - + Реверс Specify direction manually using X,Y,Z values. - + Указать направление вручную с использованием значений X, Y и Z. Custom direction: - + Произвольное направление: Extrude perpendicularly to plane of input shape. - + Выдавить перпендикулярно плоскости входной фигуры. @@ -2271,7 +2271,7 @@ Create solid - Создать твердое тело + Создать твёрдое тело @@ -2281,7 +2281,7 @@ Click to start selecting an edge in 3d view. - + Щёлкните, чтобы начать выделение ребра в трёхмерном виде. @@ -2297,7 +2297,7 @@ Along edge: - + Вдоль ребра: @@ -2307,7 +2307,7 @@ Along: - + Вдоль: @@ -2332,7 +2332,7 @@ Symmetric - + Симметрично @@ -2371,7 +2371,7 @@ Select a shape for extrusion, first. - Сначала выберите фигуру для экструзии. + Сначала выберите фигуру для выдавливания. @@ -2381,7 +2381,7 @@ The document '%1' doesn't exist. - The document '%1' doesn't exist. + Документ «%1» не существует. @@ -2389,17 +2389,19 @@ Creating Extrusion failed. %1 - + Выдавливание не удалось + +%1 Object not found: %1 - + Объект не найден: %1 No shapes selected for extrusion. Select some, first. - + Не выбрано фигур для выдавливания. Сначала выберите. @@ -2411,24 +2413,26 @@ Direction mode is to use an edge, but no edge is linked. - + Режим направления должен использовать ребро, но ребро не указано. Can't determine normal vector of shape to be extruded. Please use other mode. (%1) - + Не могу определить вектор нормали фигуры для выдавливания. Используйте другой режим + +(%1) Extrusion direction is zero-length. It must be non-zero. - + Направление выдавливания нулевой длины. Не должно быть так. Total extrusion length is zero (length1 == -length2). It must be nonzero. - + Нулевая суммарная длина выдавливания (длина1 == -длина2). Должна быть ненулевая. Succeeded @@ -2459,7 +2463,7 @@ Select faces - Выберете грани + Выберите грани @@ -2469,7 +2473,7 @@ Select edges - Выберете ребра + Выберите ребра @@ -2509,7 +2513,7 @@ Constant Length - Постоянная длинна + Постоянная длина @@ -2561,7 +2565,7 @@ No edge selected - Нет выбранных ребер + Нет выбранных рёбер @@ -2584,7 +2588,7 @@ Please check one or more edge entities first. Edge%1 - Грань%1 + Край%1 @@ -2595,7 +2599,7 @@ Please check one or more edge entities first. No valid shape is selected. Please select a valid shape in the drop-down box first. - Допустимый профиль не выбран. Пожалуйста сначала выберите допустимый профиль в выпадающем списке. + Допустимый профиль не выбран. Сначала выберите допустимый профиль в выпадающем списке, пожалуйста. @@ -2613,7 +2617,7 @@ Please select a valid shape in the drop-down box first. Units for export of IGES - Единицы для экспорта IGE + Единицы для экспорта IGE @@ -2657,7 +2661,7 @@ Please select a valid shape in the drop-down box first. Skip blank entities - Пропускать пустые сущностей + Пропускать пустые сущности @@ -2925,7 +2929,7 @@ Please select a valid shape in the drop-down box first. Step input file - Шаг входного файла + Входной файл STEP @@ -3007,7 +3011,7 @@ Please select a valid shape in the drop-down box first. Angle - 0 for cyl - Угол - 0 для цилиндра + Угол — 0 для цилиндра Angle0 @@ -3402,43 +3406,43 @@ Please select a valid shape in the drop-down box first. Revolution axis - + Ось вращения Center X: - + X центра: Center Y: - + Y центра: Center Z: - + Z центра: Click to set this as axis - + Щёлкнуть, чтобы выбрать эту ось вращения. Dir. X: - + X направления: Dir. Y: - + Y направления: Dir. Z: - + Z направления: @@ -3489,17 +3493,17 @@ Please select a valid shape in the drop-down box first. Create Solid - Создать твердое тело + Создать твёрдое тело Object not found: %1 - + Объект не найден: %1 Select a shape for revolution, first. - Сначала выберите фигуру для революции. + Сначала выберите фигуру для вращения. @@ -3508,12 +3512,14 @@ Please select a valid shape in the drop-down box first. Revolution axis link is invalid. %1 - + Неверная ссылка на ось вращения. + +%1 Revolution axis direction is zero-length. It must be non-zero. - + Нулевая длина оси вращения. Должна быть ненулевая. @@ -3526,7 +3532,9 @@ Please select a valid shape in the drop-down box first. Creating Revolve failed. %1 - + Создание тела вращения не удалось. + +%1 @@ -3559,12 +3567,12 @@ Please select a valid shape in the drop-down box first. Shape view - Форма представления + Представление формы Tessellation - Мозаика + Тесселяция @@ -3620,7 +3628,7 @@ Please select a valid shape in the drop-down box first. Setting a too small deviation causes the tessellation to take longerand thus freezes or slows down the GUI. - Setting a too small deviation causes the tessellation to take longerand thus freezes or slows down the GUI. + Установка слишком малого отклонения делает тесселяцию долгой и, тем самым, замедляет отзывчивость интерфейса. @@ -3628,7 +3636,7 @@ Please select a valid shape in the drop-down box first. General - Главный + Общий Export @@ -3691,7 +3699,7 @@ Please select a valid shape in the drop-down box first. Default Part colors - Цвета Деталей по умолчанию + Цвета деталей по умолчанию @@ -3772,7 +3780,7 @@ Please select a valid shape in the drop-down box first. Do you really want to cancel? - Вы действительно хотите отменить? + Вы действительно хотите прервать? @@ -3790,7 +3798,7 @@ Please select a valid shape in the drop-down box first. 3D View - 3D Вид + 3D-вид @@ -3803,7 +3811,7 @@ Please select a valid shape in the drop-down box first. Vertex/Edge/Wire/Face - Точка/Ребро/Ломаная/грань + Точка/ребро/ломаная/грань @@ -3870,7 +3878,7 @@ Please select a valid shape in the drop-down box first. Base point - Base point + Базовая точка Base point: @@ -3899,7 +3907,7 @@ Please select a valid shape in the drop-down box first. No such document '%1'. - Нет такого документа '%1'. + Нет документа «%1». @@ -3958,7 +3966,7 @@ Please select a valid shape in the drop-down box first. Select one or more edges - Выберите одино или несколько ребер + Выберите одино или несколько рёбер @@ -3983,7 +3991,7 @@ Please select a valid shape in the drop-down box first. Select a closed set of edges - Выберите ребра, образующие замкнутый контур + Выберите рёбра, образующие замкнутый контур @@ -4012,7 +4020,7 @@ Please select a valid shape in the drop-down box first. Vertex/Edge/Wire/Face - Точка/Ребро/Ломаная/грань + Точка/ребро/ломаная/грань @@ -4023,12 +4031,12 @@ Please select a valid shape in the drop-down box first. Select an edge or wire you want to sweep along. - Выбрать грани или направляющие для связи вместе. + Выбрать грани или направляющие для сдвига вдоль. Select one or more connected edges you want to sweep along. - Select one or more connected edges you want to sweep along. + Выберите одно или более связанных рёбер, вдоль которых нужно осуществить сдвиг. @@ -4038,7 +4046,7 @@ Please select a valid shape in the drop-down box first. At least one edge or wire is required. - Требуется по крайней мере одна или последовательность граней. + Требуется по крайней мере одно ребро или ломаная. @@ -4048,7 +4056,7 @@ Please select a valid shape in the drop-down box first. '%1' cannot be used as profile and path. - '%1' не может использоваться в качестве профиля и пути. + «%1» не может использоваться в качестве профиля и пути. @@ -4063,7 +4071,7 @@ Please select a valid shape in the drop-down box first. Select one or more connected edges in the 3d view and press 'Done' - Выберите один или несколько подключенных краев в 3d и нажмите «OK» + Выберите один или несколько подключенных краёв в 3d и нажмите «OK» @@ -4082,27 +4090,27 @@ Please select a valid shape in the drop-down box first. Selection accepted - + Выбор принят Reference 1 - + Ссылка 1 Reference 2 - + Ссылка 2 Reference 3 - + Ссылка 3 Reference 4 - + Ссылка 4 @@ -4123,32 +4131,32 @@ Please select a valid shape in the drop-down box first. X: - X: + X: Y: - Y: + Y: Z: - Z: + Z: Yaw: - + Угол рыска: Pitch: - Шаг: + Угол тангажа: Roll: - + Угол крена: @@ -4163,7 +4171,7 @@ Please select a valid shape in the drop-down box first. unknown error - + неизвестная ошибка @@ -4188,17 +4196,17 @@ Please select a valid shape in the drop-down box first. Face - Поверхность + Грань Edge - Ребро + Ребро Vertex - Вершина + Вершина @@ -4208,7 +4216,7 @@ Please select a valid shape in the drop-down box first. Reference%1 - + Ссылка%1 @@ -4429,7 +4437,7 @@ Please select a valid shape in the drop-down box first. Click on the faces in the 3d view to select them. - Нажмите на грани в 3D виде, чтобы выделить их. + Нажмите на грани в 3D-виде, чтобы выделить их. @@ -4444,7 +4452,7 @@ Please select a valid shape in the drop-down box first. Box selection - Выделить область + Выделить прямоугольный объём @@ -4493,7 +4501,7 @@ Please select a valid shape in the drop-down box first. Create solid - Создать твердое тело + Создать твёрдое тело @@ -4532,7 +4540,7 @@ Please select a valid shape in the drop-down box first. RectoVerso - Туда - Сюда + Туда-сюда @@ -4547,7 +4555,7 @@ Please select a valid shape in the drop-down box first. Tangent - Тангенс + Касательная @@ -4558,7 +4566,7 @@ Please select a valid shape in the drop-down box first. Self-intersection - Авто-перекрытее + Авто-перекрытие @@ -4587,7 +4595,7 @@ Please select a valid shape in the drop-down box first. Edge from vertices - Ребро из вершинам + Ребро из вершин @@ -4597,7 +4605,7 @@ Please select a valid shape in the drop-down box first. Face from edges - Грань из ребер + Грань из рёбер @@ -4612,7 +4620,7 @@ Please select a valid shape in the drop-down box first. Solid from shell - Твердое тело из оболочки + Твёрдое тело из оболочки @@ -4645,7 +4653,7 @@ Please select a valid shape in the drop-down box first. Create solid - Создать твердое тело + Создать твёрдое тело @@ -4656,7 +4664,7 @@ Please select a valid shape in the drop-down box first. Select one or more profiles and select an edge or wire in the 3D view for the sweep path. - Выбрать один или более профилей, а также выбрать грань или последовательность граней в 3D виде для очистки пути. + Выберите один или более профилей, а также грань или последовательность граней в 3D-виде для очистки пути. @@ -4671,7 +4679,7 @@ in the 3D view for the sweep path. Select faces of the source object and press 'Done' - Выбрать поверхность исходного объекта и нажать "Продолжить" + Выбрать поверхность исходного объекта и нажать «Продолжить» @@ -4750,7 +4758,7 @@ in the 3D view for the sweep path. Non-solids selected - Выбраны не твердотельные + Выбраны не твёрдотельные @@ -4758,7 +4766,7 @@ in the 3D view for the sweep path. The use of non-solids for boolean operations may lead to unexpected results. Do you want to continue? - Использование твердых тел для булевых операций может привести к непредвиденным результатам. Вы хотите продолжить? + Использование твёрдых тел для булевых операций может привести к непредвиденным результатам. Вы хотите продолжить? @@ -4803,7 +4811,7 @@ Do you want to continue? Enter tolerance for sewing shape: - Введите допустимость для шитья формы: + Введите допуск для шитья формы: @@ -4848,7 +4856,7 @@ Do you want to continue? Select two shapes or more, please. - Пожалуйста выберите несколько форм. + Пожалуйста, выберите несколько форм. @@ -4868,7 +4876,7 @@ Do you want to continue? Edit fillet edges - Изменение краев ленты + Изменение краёв ленты @@ -4888,7 +4896,7 @@ Do you want to continue? Solid - Твердотельная модель + Твёрдотельная модель @@ -4932,7 +4940,7 @@ Do you want to continue? No Error - Ошибок нет + Ошибки нет @@ -4952,17 +4960,17 @@ Do you want to continue? No 3D Curve - Отсутствует 3D искривление + Отсутствует 3D-искривление Multiple 3D Curve - Множественное 3D искривление + Множественное 3D-искривление Invalid 3D Curve - Недопустимое 3D искривление + Недопустимое 3D-искривление @@ -5022,12 +5030,12 @@ Do you want to continue? Self Intersecting Wire - Авто-пересекающаяся связб + Авто-пересекающаяся связь No Surface - Не поверхность + Нет поверхности @@ -5067,17 +5075,17 @@ Do you want to continue? Not Closed - Не закрыт + Не замкнут Not Connected - Не подключен + Не подсоединён Sub Shape Not In Shape - Подфигура не находится в форме + Подфигура не находится в фигуре @@ -5107,17 +5115,17 @@ Do you want to continue? Out Of Enum Range: - Пределы Enum: + Пределы перечисления: BOPAlgo CheckUnknown - BOPAlgo ПроверитьНеизвестную + BOPAlgo ПроверитьНеизвестную BOPAlgo BadType - BOPAlgo ЛожныйТип + BOPAlgo ЛожныйТип @@ -5132,7 +5140,7 @@ Do you want to continue? BOPAlgo NonRecoverableFace - BOPAlgo НеВосстанавимаяПоверхность + BOPAlgo НеВосстановимаяПоверхность @@ -5195,7 +5203,7 @@ Do you want to continue? Toggle 3d - Переключить 3d + Переключить 3d diff --git a/src/Mod/Path/Gui/Resources/panels/ContourEdit.ui b/src/Mod/Path/Gui/Resources/panels/ContourEdit.ui index d5f3c8c82..22af2b4d9 100644 --- a/src/Mod/Path/Gui/Resources/panels/ContourEdit.ui +++ b/src/Mod/Path/Gui/Resources/panels/ContourEdit.ui @@ -31,7 +31,7 @@ 0 0 334 - 313 + 327 @@ -98,7 +98,7 @@ 0 0 334 - 313 + 327 @@ -148,7 +148,7 @@ 0 0 334 - 313 + 327 @@ -206,7 +206,7 @@ 0 0 334 - 313 + 327 @@ -277,30 +277,6 @@ - - - - - - - Plunge Angle - - - - - - - Roll Radius - - - - - - - Segment Length - - - @@ -309,7 +285,14 @@ - + + + 0.000000000000000 + + + mm + + @@ -321,13 +304,24 @@ - - - - 0.000000000000000 + + + + Roll Radius + + + + + + Plunge Angle + + + + + - mm + diff --git a/src/Mod/Path/Gui/Resources/panels/DrillingEdit.ui b/src/Mod/Path/Gui/Resources/panels/DrillingEdit.ui index 09df3c50d..79e1071ee 100644 --- a/src/Mod/Path/Gui/Resources/panels/DrillingEdit.ui +++ b/src/Mod/Path/Gui/Resources/panels/DrillingEdit.ui @@ -34,7 +34,7 @@ 0 0 304 - 367 + 375 @@ -111,8 +111,8 @@ 0 0 - 304 - 367 + 109 + 82 @@ -172,8 +172,8 @@ 0 0 - 304 - 367 + 144 + 82 @@ -233,8 +233,8 @@ 0 0 - 304 - 367 + 223 + 31 diff --git a/src/Mod/Path/Gui/Resources/panels/EngraveEdit.ui b/src/Mod/Path/Gui/Resources/panels/EngraveEdit.ui index 024577e34..e9874ee82 100644 --- a/src/Mod/Path/Gui/Resources/panels/EngraveEdit.ui +++ b/src/Mod/Path/Gui/Resources/panels/EngraveEdit.ui @@ -34,7 +34,7 @@ 0 0 303 - 366 + 374 @@ -111,8 +111,8 @@ 0 0 - 303 - 366 + 109 + 56 @@ -158,8 +158,8 @@ 0 0 - 303 - 366 + 144 + 56 @@ -205,8 +205,8 @@ 0 0 - 303 - 366 + 223 + 31 diff --git a/src/Mod/Path/Gui/Resources/panels/MillFaceEdit.ui b/src/Mod/Path/Gui/Resources/panels/MillFaceEdit.ui index 2795ac19c..917164e99 100644 --- a/src/Mod/Path/Gui/Resources/panels/MillFaceEdit.ui +++ b/src/Mod/Path/Gui/Resources/panels/MillFaceEdit.ui @@ -6,7 +6,7 @@ 0 0 - 374 + 340 453 @@ -33,8 +33,8 @@ 0 0 - 340 - 277 + 322 + 259 @@ -111,8 +111,8 @@ 0 0 - 356 - 124 + 322 + 108 @@ -123,6 +123,9 @@ Depths + + QFormLayout::ExpandingFieldsGrow + @@ -165,19 +168,6 @@ - - - - 3 - - - 0.100000000000000 - - - 1.000000000000000 - - - @@ -185,6 +175,16 @@ + + + + 0 mm + + + mm + + + @@ -192,8 +192,8 @@ 0 0 - 356 - 95 + 144 + 56 @@ -242,8 +242,8 @@ 0 0 - 356 - 296 + 261 + 191 @@ -309,6 +309,13 @@ QFrame::Raised + + + + + + + @@ -316,16 +323,6 @@ - - - - ZigZag Angle - - - - - - @@ -333,6 +330,13 @@ + + + + ZigZag Angle + + + @@ -409,6 +413,11 @@ QLineEdit
Gui/InputField.h
+ + Gui::QuantitySpinBox + QWidget +
Gui/QuantitySpinBox.h
+
diff --git a/src/Mod/Path/Gui/Resources/panels/PocketEdit.ui b/src/Mod/Path/Gui/Resources/panels/PocketEdit.ui index c4ebd835a..ab2988426 100644 --- a/src/Mod/Path/Gui/Resources/panels/PocketEdit.ui +++ b/src/Mod/Path/Gui/Resources/panels/PocketEdit.ui @@ -29,7 +29,7 @@ - 5 + 0 @@ -40,7 +40,7 @@ 0 0 334 - 321 + 343 @@ -117,8 +117,8 @@ 0 0 - 334 - 321 + 114 + 108 @@ -195,8 +195,8 @@ 0 0 - 334 - 321 + 144 + 56 @@ -245,8 +245,8 @@ 0 0 - 334 - 321 + 94 + 24 @@ -259,8 +259,8 @@ 0 0 - 334 - 321 + 178 + 120 @@ -299,6 +299,9 @@ QFrame::Raised + + QFormLayout::ExpandingFieldsGrow + @@ -313,9 +316,6 @@ - - - @@ -323,6 +323,13 @@ + + + + + + + @@ -334,7 +341,7 @@ 0 0 334 - 321 + 343 diff --git a/src/Mod/Path/Gui/Resources/panels/ProfileEdgesEdit.ui b/src/Mod/Path/Gui/Resources/panels/ProfileEdgesEdit.ui index 200acefd7..18f1ac7b6 100644 --- a/src/Mod/Path/Gui/Resources/panels/ProfileEdgesEdit.ui +++ b/src/Mod/Path/Gui/Resources/panels/ProfileEdgesEdit.ui @@ -23,7 +23,7 @@ - 4 + 0 @@ -34,7 +34,7 @@ 0 0 334 - 313 + 330 @@ -111,8 +111,8 @@ 0 0 - 334 - 313 + 109 + 82 @@ -181,8 +181,8 @@ 0 0 - 334 - 313 + 144 + 56 @@ -231,8 +231,8 @@ 0 0 - 334 - 313 + 160 + 111 @@ -288,9 +288,9 @@ 0 - -15 - 320 - 338 + 0 + 278 + 214 @@ -334,8 +334,12 @@ - - + + + + + + @@ -348,29 +352,19 @@ - - - Segment Length - - - - Roll Radius - + Plunge Angle - - - @@ -378,7 +372,7 @@ - + 0.000000000000000 diff --git a/src/Mod/Path/Gui/Resources/panels/ProfileEdit.ui b/src/Mod/Path/Gui/Resources/panels/ProfileEdit.ui index 74293db72..7c1cf3971 100644 --- a/src/Mod/Path/Gui/Resources/panels/ProfileEdit.ui +++ b/src/Mod/Path/Gui/Resources/panels/ProfileEdit.ui @@ -23,7 +23,7 @@ - 4 + 0 @@ -34,7 +34,7 @@ 0 0 381 - 346 + 363 @@ -111,8 +111,8 @@ 0 0 - 381 - 346 + 109 + 82 @@ -178,8 +178,8 @@ 0 0 - 381 - 346 + 144 + 56 @@ -228,8 +228,8 @@ 0 0 - 381 - 346 + 160 + 111 @@ -285,9 +285,9 @@ 0 - -28 - 367 - 384 + 0 + 274 + 251 @@ -345,7 +345,7 @@ - + Plunge Angle @@ -360,22 +360,12 @@ - - - Segment Length - - - - Roll Radius - - - @@ -387,9 +377,6 @@ - - - 0.000000000000000 @@ -399,6 +386,13 @@ + + + + + + + diff --git a/src/Mod/Path/Gui/Resources/panels/SurfaceEdit.ui b/src/Mod/Path/Gui/Resources/panels/SurfaceEdit.ui index ccb092a4b..97e3b1ad7 100644 --- a/src/Mod/Path/Gui/Resources/panels/SurfaceEdit.ui +++ b/src/Mod/Path/Gui/Resources/panels/SurfaceEdit.ui @@ -34,7 +34,7 @@ 0 0 334 - 387 + 395 @@ -112,7 +112,7 @@ 0 0 334 - 387 + 395 @@ -165,19 +165,6 @@ - - - - 3 - - - 0.100000000000000 - - - 1.000000000000000 - - - @@ -185,6 +172,13 @@ + + + + mm + + + @@ -192,8 +186,8 @@ 0 0 - 334 - 387 + 144 + 56 @@ -242,8 +236,8 @@ 0 0 - 334 - 387 + 203 + 31 diff --git a/src/Mod/Path/PathScripts/PathContour.py b/src/Mod/Path/PathScripts/PathContour.py index f113e720f..c02a9d2d4 100644 --- a/src/Mod/Path/PathScripts/PathContour.py +++ b/src/Mod/Path/PathScripts/PathContour.py @@ -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 diff --git a/src/Mod/Path/PathScripts/PathDrilling.py b/src/Mod/Path/PathScripts/PathDrilling.py index 2cd9b79e8..345c9c4e1 100644 --- a/src/Mod/Path/PathScripts/PathDrilling.py +++ b/src/Mod/Path/PathScripts/PathDrilling.py @@ -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: diff --git a/src/Mod/Path/PathScripts/PathEngrave.py b/src/Mod/Path/PathScripts/PathEngrave.py index 638788da8..96ca2e3f2 100644 --- a/src/Mod/Path/PathScripts/PathEngrave.py +++ b/src/Mod/Path/PathScripts/PathEngrave.py @@ -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: diff --git a/src/Mod/Path/PathScripts/PathMillFace.py b/src/Mod/Path/PathScripts/PathMillFace.py index d27c1adf5..13747fe43 100644 --- a/src/Mod/Path/PathScripts/PathMillFace.py +++ b/src/Mod/Path/PathScripts/PathMillFace.py @@ -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) diff --git a/src/Mod/Path/PathScripts/PathPocket.py b/src/Mod/Path/PathScripts/PathPocket.py index 6689e178e..441a72790 100644 --- a/src/Mod/Path/PathScripts/PathPocket.py +++ b/src/Mod/Path/PathScripts/PathPocket.py @@ -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) diff --git a/src/Mod/Path/PathScripts/PathProfile.py b/src/Mod/Path/PathScripts/PathProfile.py index 2ac149e8b..a9348693a 100644 --- a/src/Mod/Path/PathScripts/PathProfile.py +++ b/src/Mod/Path/PathScripts/PathProfile.py @@ -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) diff --git a/src/Mod/Path/PathScripts/PathProfileEdges.py b/src/Mod/Path/PathScripts/PathProfileEdges.py index 2c71d6adf..d999ffe3c 100644 --- a/src/Mod/Path/PathScripts/PathProfileEdges.py +++ b/src/Mod/Path/PathScripts/PathProfileEdges.py @@ -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 diff --git a/src/Mod/Path/PathScripts/PathSurface.py b/src/Mod/Path/PathScripts/PathSurface.py index 613fdd46d..4dd334298 100644 --- a/src/Mod/Path/PathScripts/PathSurface.py +++ b/src/Mod/Path/PathScripts/PathSurface.py @@ -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) diff --git a/src/Mod/Path/PathScripts/PathUtils.py b/src/Mod/Path/PathScripts/PathUtils.py index 2f6763b4d..4e75ef089 100644 --- a/src/Mod/Path/PathScripts/PathUtils.py +++ b/src/Mod/Path/PathScripts/PathUtils.py @@ -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() diff --git a/src/Mod/Path/PathTests/TestPathCore.py b/src/Mod/Path/PathTests/TestPathCore.py new file mode 100644 index 000000000..da9ee3cfc --- /dev/null +++ b/src/Mod/Path/PathTests/TestPathCore.py @@ -0,0 +1,155 @@ +# -*- coding: utf-8 -*- + +# *************************************************************************** +# * * +# * Copyright (c) 2016 sliptonic * +# * * +# * 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}' ) diff --git a/src/Mod/Path/PathTests/TestPathDepthParams.py b/src/Mod/Path/PathTests/TestPathDepthParams.py index 244bb700e..57e51a5d0 100644 --- a/src/Mod/Path/PathTests/TestPathDepthParams.py +++ b/src/Mod/Path/PathTests/TestPathDepthParams.py @@ -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) diff --git a/src/Mod/Path/TestPathApp.py b/src/Mod/Path/TestPathApp.py index 098aa3220..074643ad3 100644 --- a/src/Mod/Path/TestPathApp.py +++ b/src/Mod/Path/TestPathApp.py @@ -24,6 +24,7 @@ import TestApp +from PathTests.TestPathCore import TestPathCore from PathTests.TestPathPost import PathPostTestCases from PathTests.TestPathGeom import TestPathGeom diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index b2a1336c7..553abf3a4 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -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.")); diff --git a/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp b/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp index 1a3e38021..4a88f1627 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp @@ -27,6 +27,7 @@ # include # include # include +# include # include #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("

"%1": multiple selection

" + "

"%2": switch to next valid type

") + .arg(cmdKey).arg(zKey)); ui->listWidgetElements->setSelectionMode(QAbstractItemView::ExtendedSelection); ui->listWidgetElements->setEditTriggers(QListWidget::NoEditTriggers); ui->listWidgetElements->setMouseTracking(true); diff --git a/src/Mod/Sketcher/Gui/TaskSketcherElements.ui b/src/Mod/Sketcher/Gui/TaskSketcherElements.ui index 394068927..0a78b25b2 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherElements.ui +++ b/src/Mod/Sketcher/Gui/TaskSketcherElements.ui @@ -91,7 +91,7 @@ - <html><head/><body><p>&quot;Ctrl&quot;: multiple selection</p><p>&quot;Z&quot;: switch to next valid type</p></body></html> + <html><head/><body><p>&quot;Ctrl&quot;: multiple selection</p><p>&quot;Z&quot;: switch to next valid type</p></body></html> diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index c3d16c369..4a3d4ec8e 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -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((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((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; diff --git a/src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp b/src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp index b2b4d781b..d40584f9e 100644 --- a/src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp +++ b/src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp @@ -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 @@ -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(layoutItem->widget()); - if (litem != sender()) - litem->setSelected(false); - } - ++i; + QWidget *w = layoutItem->widget(); + if (w && w->inherits("ColorPickerItem")) { + ColorPickerItem *litem = reinterpret_cast(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(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(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(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(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(w); - wi->setSelected(true); + lastSel = wi->color(); + Q_EMIT selected(wi->color()); + hide(); + } else if (w && w->inherits("QPushButton")) { + ColorPickerItem *wi = reinterpret_cast(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(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(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(); diff --git a/src/Tools/plugins/widget/customwidgets.cpp b/src/Tools/plugins/widget/customwidgets.cpp index d96b9fb9c..51f70a6df 100644 --- a/src/Tools/plugins/widget/customwidgets.cpp +++ b/src/Tools/plugins/widget/customwidgets.cpp @@ -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(); } } diff --git a/src/Tools/plugins/widget/wizard.cpp b/src/Tools/plugins/widget/wizard.cpp index 7d788baf6..6aae3ac0a 100644 --- a/src/Tools/plugins/widget/wizard.cpp +++ b/src/Tools/plugins/widget/wizard.cpp @@ -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)