[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
@@ -16,6 +16,7 @@ If FREECAD_EXEC is an executable path, it is used directly.
|
||||
This script returns 0 if all GUI modules run successfully. Otherwise it returns the last non-zero
|
||||
exit code.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
+2
-4
@@ -22,14 +22,12 @@ class ScaleType(IntEnum):
|
||||
NumberProtocol=True,
|
||||
RichCompare=True,
|
||||
)
|
||||
@class_declarations(
|
||||
"""public:
|
||||
@class_declarations("""public:
|
||||
MatrixPy(const Matrix4D & mat, PyTypeObject *T = &Type)
|
||||
:PyObjectBase(new Matrix4D(mat),T){}
|
||||
Matrix4D value() const
|
||||
{ return *(getMatrixPtr()); }
|
||||
"""
|
||||
)
|
||||
""")
|
||||
class Matrix(PyObjectBase):
|
||||
"""
|
||||
Base.Matrix class.
|
||||
|
||||
@@ -15,14 +15,12 @@ from typing import Sequence, overload
|
||||
NumberProtocol=True,
|
||||
RichCompare=True,
|
||||
)
|
||||
@class_declarations(
|
||||
"""public:
|
||||
@class_declarations("""public:
|
||||
PlacementPy(const Placement & pla, PyTypeObject *T = &Type)
|
||||
:PyObjectBase(new Placement(pla),T){}
|
||||
Placement value() const
|
||||
{ return *(getPlacementPtr()); }
|
||||
"""
|
||||
)
|
||||
""")
|
||||
class Placement(PyObjectBase):
|
||||
"""
|
||||
Base.Placement class.
|
||||
|
||||
@@ -14,14 +14,12 @@ from typing import overload, Tuple, List, Final
|
||||
NumberProtocol=True,
|
||||
RichCompare=True,
|
||||
)
|
||||
@class_declarations(
|
||||
"""public:
|
||||
@class_declarations("""public:
|
||||
RotationPy(const Rotation & mat, PyTypeObject *T = &Type)
|
||||
:PyObjectBase(new Rotation(mat),T){}
|
||||
Rotation value() const
|
||||
{ return *(getRotationPtr()); }
|
||||
"""
|
||||
)
|
||||
""")
|
||||
class Rotation(PyObjectBase):
|
||||
"""
|
||||
Base.Rotation class.
|
||||
|
||||
+2
-4
@@ -603,8 +603,7 @@ public:
|
||||
{
|
||||
}
|
||||
#endif
|
||||
~ofstream() override
|
||||
= default;
|
||||
~ofstream() override = default;
|
||||
void open(const FileInfo& fi, ios_base::openmode mode = std::ios::out | std::ios::trunc)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
@@ -638,8 +637,7 @@ public:
|
||||
{
|
||||
}
|
||||
#endif
|
||||
~ifstream() override
|
||||
= default;
|
||||
~ifstream() override = default;
|
||||
void open(const FileInfo& fi, ios_base::openmode mode = std::ios::in)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
|
||||
+2
-4
@@ -11,12 +11,10 @@ from typing import List, Final
|
||||
TwinPointer="BaseType",
|
||||
Delete=True,
|
||||
)
|
||||
@forward_declarations(
|
||||
"""
|
||||
@forward_declarations("""
|
||||
namespace Base {
|
||||
using BaseType = Type;
|
||||
}"""
|
||||
)
|
||||
}""")
|
||||
class Type(PyObjectBase):
|
||||
"""
|
||||
BaseTypePy class.
|
||||
|
||||
+2
-4
@@ -26,8 +26,7 @@ from typing import overload, Sequence
|
||||
sq_inplace_concat=False,
|
||||
sq_inplace_repeat=False,
|
||||
)
|
||||
@class_declarations(
|
||||
"""public:
|
||||
@class_declarations("""public:
|
||||
VectorPy(const Vector3d & vec, PyTypeObject *T = &Type)
|
||||
:PyObjectBase(new Vector3d(vec),T){}
|
||||
VectorPy(const Vector3f & vec, PyTypeObject *T = &Type)
|
||||
@@ -36,8 +35,7 @@ from typing import overload, Sequence
|
||||
{ return *(getVectorPtr()); }
|
||||
private:
|
||||
Py::List sequence;
|
||||
"""
|
||||
)
|
||||
""")
|
||||
class Vector(PyObjectBase):
|
||||
"""
|
||||
Base.Vector class.
|
||||
|
||||
@@ -698,9 +698,10 @@ bool CallTipsList::eventFilter(QObject* watched, QEvent* event)
|
||||
Q_EMIT itemActivated(currentItem());
|
||||
return false;
|
||||
}
|
||||
else if (ke->key() == Qt::Key_Shift || ke->key() == Qt::Key_Control
|
||||
|| ke->key() == Qt::Key_Meta || ke->key() == Qt::Key_Alt
|
||||
|| ke->key() == Qt::Key_AltGr) {
|
||||
else if (
|
||||
ke->key() == Qt::Key_Shift || ke->key() == Qt::Key_Control
|
||||
|| ke->key() == Qt::Key_Meta || ke->key() == Qt::Key_Alt || ke->key() == Qt::Key_AltGr
|
||||
) {
|
||||
// filter these meta keys to avoid to call keyboardSearch()
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -116,8 +116,10 @@ PyObject* CommandPy::listByShortcut(PyObject* args)
|
||||
matches.emplace_back(c->getName());
|
||||
}
|
||||
}
|
||||
else if (action->shortcut().toString().remove(spc).toUpper()
|
||||
== QString::fromLatin1(shortcut_to_find).remove(spc).toUpper()) {
|
||||
else if (
|
||||
action->shortcut().toString().remove(spc).toUpper()
|
||||
== QString::fromLatin1(shortcut_to_find).remove(spc).toUpper()
|
||||
) {
|
||||
matches.emplace_back(c->getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,33 +344,25 @@ void DlgParameterImp::onGroupSelected(QTreeWidgetItem* item)
|
||||
// filling up Int nodes
|
||||
std::vector<std::pair<std::string, long>> mcIntMap = _hcGrp->GetIntMap();
|
||||
for (const auto& It3 : mcIntMap) {
|
||||
(
|
||||
void
|
||||
)new ParameterInt(paramValue, QString::fromUtf8(It3.first.c_str()), It3.second, _hcGrp);
|
||||
(void)new ParameterInt(paramValue, QString::fromUtf8(It3.first.c_str()), It3.second, _hcGrp);
|
||||
}
|
||||
|
||||
// filling up Float nodes
|
||||
std::vector<std::pair<std::string, double>> mcFloatMap = _hcGrp->GetFloatMap();
|
||||
for (const auto& It4 : mcFloatMap) {
|
||||
(
|
||||
void
|
||||
)new ParameterFloat(paramValue, QString::fromUtf8(It4.first.c_str()), It4.second, _hcGrp);
|
||||
(void)new ParameterFloat(paramValue, QString::fromUtf8(It4.first.c_str()), It4.second, _hcGrp);
|
||||
}
|
||||
|
||||
// filling up bool nodes
|
||||
std::vector<std::pair<std::string, bool>> mcBoolMap = _hcGrp->GetBoolMap();
|
||||
for (const auto& It5 : mcBoolMap) {
|
||||
(
|
||||
void
|
||||
)new ParameterBool(paramValue, QString::fromUtf8(It5.first.c_str()), It5.second, _hcGrp);
|
||||
(void)new ParameterBool(paramValue, QString::fromUtf8(It5.first.c_str()), It5.second, _hcGrp);
|
||||
}
|
||||
|
||||
// filling up UInt nodes
|
||||
std::vector<std::pair<std::string, unsigned long>> mcUIntMap = _hcGrp->GetUnsignedMap();
|
||||
for (const auto& It6 : mcUIntMap) {
|
||||
(
|
||||
void
|
||||
)new ParameterUInt(paramValue, QString::fromUtf8(It6.first.c_str()), It6.second, _hcGrp);
|
||||
(void)new ParameterUInt(paramValue, QString::fromUtf8(It6.first.c_str()), It6.second, _hcGrp);
|
||||
}
|
||||
paramValue->setSortingEnabled(sortingEnabled);
|
||||
}
|
||||
|
||||
@@ -430,10 +430,8 @@ def GeneratePackageIcon(
|
||||
return
|
||||
absolute_filename = Path(subdirectory) / Path(relative_filename)
|
||||
if hasattr(wb_handle, "Icon") and wb_handle.Icon:
|
||||
Log(
|
||||
f"Init: Packaged workbench {workbench_metadata.Name} specified icon\
|
||||
in class {workbench_metadata.Classname}"
|
||||
)
|
||||
Log(f"Init: Packaged workbench {workbench_metadata.Name} specified icon\
|
||||
in class {workbench_metadata.Classname}")
|
||||
Log(" ... replacing with icon from package.xml data.\n")
|
||||
wb_handle.__dict__["Icon"] = str(absolute_filename.resolve())
|
||||
|
||||
|
||||
@@ -1360,8 +1360,9 @@ void ManualAlignment::probePickedCallback(void* ud, SoEventCallback* n)
|
||||
Gui::getMainWindow()->showMessage(tr("No point was picked"));
|
||||
}
|
||||
}
|
||||
else if (mbe->getButton() == SoMouseButtonEvent::BUTTON2
|
||||
&& mbe->getState() == SoButtonEvent::UP) {
|
||||
else if (
|
||||
mbe->getButton() == SoMouseButtonEvent::BUTTON2 && mbe->getState() == SoButtonEvent::UP
|
||||
) {
|
||||
ManualAlignment* self = ManualAlignment::instance();
|
||||
if (self->myAlignModel.isEmpty() || self->myFixedGroup.isEmpty()) {
|
||||
return;
|
||||
|
||||
@@ -123,9 +123,11 @@ SbBool BlenderNavigationStyle::processSoEvent(const SoEvent* const ev)
|
||||
this->seekToPoint(pos); // implicitly calls interactiveCountInc()
|
||||
processed = true;
|
||||
}
|
||||
else if (press
|
||||
&& (this->currentmode == NavigationStyle::PANNING
|
||||
|| this->currentmode == NavigationStyle::ZOOMING)) {
|
||||
else if (
|
||||
press
|
||||
&& (this->currentmode == NavigationStyle::PANNING
|
||||
|| this->currentmode == NavigationStyle::ZOOMING)
|
||||
) {
|
||||
newmode = NavigationStyle::DRAGGING;
|
||||
saveCursorPosition(ev);
|
||||
this->centerTime = ev->getTime();
|
||||
|
||||
@@ -120,9 +120,11 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent* const ev)
|
||||
this->seekToPoint(pos); // implicitly calls interactiveCountInc()
|
||||
processed = true;
|
||||
}
|
||||
else if (press
|
||||
&& (this->currentmode == NavigationStyle::PANNING
|
||||
|| this->currentmode == NavigationStyle::ZOOMING)) {
|
||||
else if (
|
||||
press
|
||||
&& (this->currentmode == NavigationStyle::PANNING
|
||||
|| this->currentmode == NavigationStyle::ZOOMING)
|
||||
) {
|
||||
newmode = NavigationStyle::DRAGGING;
|
||||
saveCursorPosition(ev);
|
||||
this->centerTime = ev->getTime();
|
||||
|
||||
@@ -129,8 +129,9 @@ SbBool InventorNavigationStyle::processSoEvent(const SoEvent* const ev)
|
||||
setupPanningPlane(getCamera());
|
||||
this->lockrecenter = false;
|
||||
}
|
||||
else if (!press && ev->wasShiftDown()
|
||||
&& (this->currentmode != NavigationStyle::SELECTION)) {
|
||||
else if (
|
||||
!press && ev->wasShiftDown() && (this->currentmode != NavigationStyle::SELECTION)
|
||||
) {
|
||||
SbTime tmp = (ev->getTime() - this->centerTime);
|
||||
float dci = (float)QApplication::doubleClickInterval() / 1000.0f;
|
||||
// is it just a left click?
|
||||
@@ -325,9 +326,11 @@ SbBool InventorNavigationStyle::processSoEvent(const SoEvent* const ev)
|
||||
if (ev->isOfType(SoMouseWheelEvent::getClassTypeId())) {
|
||||
processed = inherited::processSoEvent(ev);
|
||||
}
|
||||
else if ((curmode == NavigationStyle::SELECTION || newmode == NavigationStyle::SELECTION
|
||||
|| viewer->isEditing())
|
||||
&& !processed) {
|
||||
else if (
|
||||
(curmode == NavigationStyle::SELECTION || newmode == NavigationStyle::SELECTION
|
||||
|| viewer->isEditing())
|
||||
&& !processed
|
||||
) {
|
||||
processed = inherited::processSoEvent(ev);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -125,9 +125,11 @@ SbBool RevitNavigationStyle::processSoEvent(const SoEvent* const ev)
|
||||
this->seekToPoint(pos); // implicitly calls interactiveCountInc()
|
||||
processed = true;
|
||||
}
|
||||
else if (press
|
||||
&& (this->currentmode == NavigationStyle::PANNING
|
||||
|| this->currentmode == NavigationStyle::ZOOMING)) {
|
||||
else if (
|
||||
press
|
||||
&& (this->currentmode == NavigationStyle::PANNING
|
||||
|| this->currentmode == NavigationStyle::ZOOMING)
|
||||
) {
|
||||
newmode = NavigationStyle::DRAGGING;
|
||||
saveCursorPosition(ev);
|
||||
this->centerTime = ev->getTime();
|
||||
|
||||
@@ -123,9 +123,11 @@ SbBool SolidWorksNavigationStyle::processSoEvent(const SoEvent* const ev)
|
||||
this->seekToPoint(pos); // implicitly calls interactiveCountInc()
|
||||
processed = true;
|
||||
}
|
||||
else if (press
|
||||
&& (this->currentmode == NavigationStyle::PANNING
|
||||
|| this->currentmode == NavigationStyle::ZOOMING)) {
|
||||
else if (
|
||||
press
|
||||
&& (this->currentmode == NavigationStyle::PANNING
|
||||
|| this->currentmode == NavigationStyle::ZOOMING)
|
||||
) {
|
||||
newmode = NavigationStyle::DRAGGING;
|
||||
saveCursorPosition(ev);
|
||||
this->centerTime = ev->getTime();
|
||||
|
||||
@@ -122,9 +122,11 @@ SbBool TouchpadNavigationStyle::processSoEvent(const SoEvent* const ev)
|
||||
this->seekToPoint(pos); // implicitly calls interactiveCountInc()
|
||||
processed = true;
|
||||
}
|
||||
else if (press
|
||||
&& (this->currentmode == NavigationStyle::PANNING
|
||||
|| this->currentmode == NavigationStyle::ZOOMING)) {
|
||||
else if (
|
||||
press
|
||||
&& (this->currentmode == NavigationStyle::PANNING
|
||||
|| this->currentmode == NavigationStyle::ZOOMING)
|
||||
) {
|
||||
newmode = NavigationStyle::DRAGGING;
|
||||
saveCursorPosition(ev);
|
||||
this->centerTime = ev->getTime();
|
||||
|
||||
+42
-36
@@ -183,36 +183,38 @@ inline void Gui::Notify(TNotifier&& notifier, TCaption&& caption, TMessage&& mes
|
||||
// Send also to log for developer only
|
||||
auto msg = std::string(message).append("\n"); // use untranslated message
|
||||
|
||||
if constexpr (std::is_base_of_v<
|
||||
App::DocumentObject,
|
||||
std::remove_pointer_t<typename std::decay<TNotifier>::type>>) {
|
||||
if constexpr (
|
||||
std::is_base_of_v<App::DocumentObject, std::remove_pointer_t<typename std::decay<TNotifier>::type>>
|
||||
) {
|
||||
Base::Console()
|
||||
.send<type, Base::IntendedRecipient::Developer, Base::ContentType::Untranslated>(
|
||||
notifier->getFullLabel(),
|
||||
msg.c_str()
|
||||
);
|
||||
}
|
||||
else if constexpr (std::is_base_of_v<
|
||||
Gui::ViewProviderDocumentObject,
|
||||
std::remove_pointer_t<typename std::decay<TNotifier>::type>>) {
|
||||
else if constexpr (
|
||||
std::is_base_of_v<
|
||||
Gui::ViewProviderDocumentObject,
|
||||
std::remove_pointer_t<typename std::decay<TNotifier>::type>>
|
||||
) {
|
||||
Base::Console()
|
||||
.send<type, Base::IntendedRecipient::Developer, Base::ContentType::Untranslated>(
|
||||
notifier->getObject()->getFullLabel(),
|
||||
msg.c_str()
|
||||
);
|
||||
}
|
||||
else if constexpr (std::is_base_of_v<
|
||||
Gui::Document,
|
||||
std::remove_pointer_t<typename std::decay<TNotifier>::type>>) {
|
||||
else if constexpr (
|
||||
std::is_base_of_v<Gui::Document, std::remove_pointer_t<typename std::decay<TNotifier>::type>>
|
||||
) {
|
||||
Base::Console()
|
||||
.send<type, Base::IntendedRecipient::Developer, Base::ContentType::Untranslated>(
|
||||
notifier->getDocument()->Label.getStrValue(),
|
||||
msg.c_str()
|
||||
);
|
||||
}
|
||||
else if constexpr (std::is_base_of_v<
|
||||
App::Document,
|
||||
std::remove_pointer_t<typename std::decay<TNotifier>::type>>) {
|
||||
else if constexpr (
|
||||
std::is_base_of_v<App::Document, std::remove_pointer_t<typename std::decay<TNotifier>::type>>
|
||||
) {
|
||||
Base::Console()
|
||||
.send<type, Base::IntendedRecipient::Developer, Base::ContentType::Untranslated>(
|
||||
notifier->Label.getStrValue(),
|
||||
@@ -269,30 +271,32 @@ inline void Gui::Notify(TNotifier&& notifier, TCaption&& caption, TMessage&& mes
|
||||
// trailing newline is not necessary as translated messages are not shown in logs
|
||||
auto msg = QStringLiteral("%1. %2").arg(caption).arg(message); // QString
|
||||
|
||||
if constexpr (std::is_base_of_v<
|
||||
App::DocumentObject,
|
||||
std::remove_pointer_t<typename std::decay<TNotifier>::type>>) {
|
||||
if constexpr (
|
||||
std::is_base_of_v<App::DocumentObject, std::remove_pointer_t<typename std::decay<TNotifier>::type>>
|
||||
) {
|
||||
Base::Console().send<type, recipient, content>(notifier->getFullLabel(), msg.toUtf8());
|
||||
}
|
||||
else if constexpr (std::is_base_of_v<
|
||||
Gui::ViewProviderDocumentObject,
|
||||
std::remove_pointer_t<typename std::decay<TNotifier>::type>>) {
|
||||
else if constexpr (
|
||||
std::is_base_of_v<
|
||||
Gui::ViewProviderDocumentObject,
|
||||
std::remove_pointer_t<typename std::decay<TNotifier>::type>>
|
||||
) {
|
||||
Base::Console().send<type, recipient, content>(
|
||||
notifier->getObject()->getFullLabel(),
|
||||
msg.toUtf8()
|
||||
);
|
||||
}
|
||||
else if constexpr (std::is_base_of_v<
|
||||
Gui::Document,
|
||||
std::remove_pointer_t<typename std::decay<TNotifier>::type>>) {
|
||||
else if constexpr (
|
||||
std::is_base_of_v<Gui::Document, std::remove_pointer_t<typename std::decay<TNotifier>::type>>
|
||||
) {
|
||||
Base::Console().send<type, recipient, content>(
|
||||
notifier->getDocument()->Label.getStrValue(),
|
||||
msg.toUtf8()
|
||||
);
|
||||
}
|
||||
else if constexpr (std::is_base_of_v<
|
||||
App::Document,
|
||||
std::remove_pointer_t<typename std::decay<TNotifier>::type>>) {
|
||||
else if constexpr (
|
||||
std::is_base_of_v<App::Document, std::remove_pointer_t<typename std::decay<TNotifier>::type>>
|
||||
) {
|
||||
Base::Console().send<type, recipient, content>(
|
||||
notifier->Label.getStrValue(),
|
||||
msg.toUtf8()
|
||||
@@ -307,30 +311,32 @@ inline void Gui::Notify(TNotifier&& notifier, TCaption&& caption, TMessage&& mes
|
||||
// (depending on the configuration).
|
||||
auto msg = std::string(message).append("\n");
|
||||
|
||||
if constexpr (std::is_base_of_v<
|
||||
App::DocumentObject,
|
||||
std::remove_pointer_t<typename std::decay<TNotifier>::type>>) {
|
||||
if constexpr (
|
||||
std::is_base_of_v<App::DocumentObject, std::remove_pointer_t<typename std::decay<TNotifier>::type>>
|
||||
) {
|
||||
Base::Console().send<type, recipient, content>(notifier->getFullLabel(), msg.c_str());
|
||||
}
|
||||
else if constexpr (std::is_base_of_v<
|
||||
Gui::ViewProviderDocumentObject,
|
||||
std::remove_pointer_t<typename std::decay<TNotifier>::type>>) {
|
||||
else if constexpr (
|
||||
std::is_base_of_v<
|
||||
Gui::ViewProviderDocumentObject,
|
||||
std::remove_pointer_t<typename std::decay<TNotifier>::type>>
|
||||
) {
|
||||
Base::Console().send<type, recipient, content>(
|
||||
notifier->getObject()->getFullLabel(),
|
||||
msg.c_str()
|
||||
);
|
||||
}
|
||||
else if constexpr (std::is_base_of_v<
|
||||
Gui::Document,
|
||||
std::remove_pointer_t<typename std::decay<TNotifier>::type>>) {
|
||||
else if constexpr (
|
||||
std::is_base_of_v<Gui::Document, std::remove_pointer_t<typename std::decay<TNotifier>::type>>
|
||||
) {
|
||||
Base::Console().send<type, recipient, content>(
|
||||
notifier->getDocument()->Label.getStrValue(),
|
||||
msg.c_str()
|
||||
);
|
||||
}
|
||||
else if constexpr (std::is_base_of_v<
|
||||
App::Document,
|
||||
std::remove_pointer_t<typename std::decay<TNotifier>::type>>) {
|
||||
else if constexpr (
|
||||
std::is_base_of_v<App::Document, std::remove_pointer_t<typename std::decay<TNotifier>::type>>
|
||||
) {
|
||||
Base::Console().send<type, recipient, content>(
|
||||
notifier->Label.getStrValue(),
|
||||
msg.c_str()
|
||||
|
||||
@@ -1807,8 +1807,10 @@ bool OverlayManager::eventFilter(QObject* o, QEvent* ev)
|
||||
if (auto titleBar = qobject_cast<OverlayTitleBar*>(OverlayTabWidget::_Dragging)) {
|
||||
titleBar->endDrag();
|
||||
}
|
||||
else if (auto splitHandle
|
||||
= qobject_cast<OverlaySplitterHandle*>(OverlayTabWidget::_Dragging)) {
|
||||
else if (
|
||||
auto splitHandle
|
||||
= qobject_cast<OverlaySplitterHandle*>(OverlayTabWidget::_Dragging)
|
||||
) {
|
||||
splitHandle->endDrag();
|
||||
}
|
||||
}
|
||||
@@ -1861,8 +1863,9 @@ bool OverlayManager::eventFilter(QObject* o, QEvent* ev)
|
||||
if (auto titleBar = qobject_cast<OverlayTitleBar*>(OverlayTabWidget::_Dragging)) {
|
||||
titleBar->endDrag();
|
||||
}
|
||||
else if (auto splitHandle
|
||||
= qobject_cast<OverlaySplitterHandle*>(OverlayTabWidget::_Dragging)) {
|
||||
else if (
|
||||
auto splitHandle = qobject_cast<OverlaySplitterHandle*>(OverlayTabWidget::_Dragging)
|
||||
) {
|
||||
splitHandle->endDrag();
|
||||
}
|
||||
}
|
||||
@@ -1909,8 +1912,10 @@ bool OverlayManager::eventFilter(QObject* o, QEvent* ev)
|
||||
// probably do not matter.
|
||||
return true;
|
||||
}
|
||||
else if (ev->type() != QEvent::MouseButtonPress && ev->type() != QEvent::MouseButtonDblClick
|
||||
&& QApplication::mouseButtons() != Qt::NoButton) {
|
||||
else if (
|
||||
ev->type() != QEvent::MouseButtonPress && ev->type() != QEvent::MouseButtonDblClick
|
||||
&& QApplication::mouseButtons() != Qt::NoButton
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1925,8 +1930,10 @@ bool OverlayManager::eventFilter(QObject* o, QEvent* ev)
|
||||
&& pos == d->_lastPos) {
|
||||
hit = 1;
|
||||
}
|
||||
else if (ev->type() == QEvent::Wheel && !d->wheelDelay.isNull()
|
||||
&& (isNear(pos, d->wheelPos) || d->wheelDelay > QTime::currentTime())) {
|
||||
else if (
|
||||
ev->type() == QEvent::Wheel && !d->wheelDelay.isNull()
|
||||
&& (isNear(pos, d->wheelPos) || d->wheelDelay > QTime::currentTime())
|
||||
) {
|
||||
d->wheelDelay = QTime::currentTime().addMSecs(
|
||||
OverlayParams::getDockOverlayWheelDelay()
|
||||
);
|
||||
|
||||
+13
-24
@@ -19,6 +19,7 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
"""Auto code generator for overlay widgets related parameters in Preferences/View"""
|
||||
|
||||
import cog
|
||||
import inspect, sys
|
||||
from os import path
|
||||
@@ -101,12 +102,10 @@ class ParamAnimationCurve(ParamProxy):
|
||||
|
||||
def init_widget(self, param, row, group_name):
|
||||
super().init_widget(param, row, group_name)
|
||||
cog.out(
|
||||
f"""
|
||||
cog.out(f"""
|
||||
{auto_comment()}
|
||||
for (const auto &item : OverlayParams::AnimationCurveTypes)
|
||||
{param.widget_name}->addItem(item);"""
|
||||
)
|
||||
{param.widget_name}->addItem(item);""")
|
||||
cog.out(
|
||||
f"""
|
||||
{param.widget_name}->setCurrentIndex({param.namespace}::{param.class_name}::default{param.name}());"""
|
||||
@@ -295,40 +294,30 @@ Params = [
|
||||
|
||||
|
||||
def declare():
|
||||
cog.out(
|
||||
f"""
|
||||
cog.out(f"""
|
||||
{auto_comment()}
|
||||
#include <QString>
|
||||
"""
|
||||
)
|
||||
""")
|
||||
|
||||
params_utils.declare_begin(sys.modules[__name__])
|
||||
cog.out(
|
||||
f"""
|
||||
cog.out(f"""
|
||||
{auto_comment()}
|
||||
static const std::vector<QString> AnimationCurveTypes;
|
||||
"""
|
||||
)
|
||||
""")
|
||||
params_utils.declare_end(sys.modules[__name__])
|
||||
|
||||
|
||||
def define():
|
||||
params_utils.define(sys.modules[__name__])
|
||||
cog.out(
|
||||
f"""
|
||||
cog.out(f"""
|
||||
{auto_comment()}
|
||||
const std::vector<QString> OverlayParams::AnimationCurveTypes = {{"""
|
||||
)
|
||||
const std::vector<QString> OverlayParams::AnimationCurveTypes = {{""")
|
||||
for item in AnimationCurveTypes:
|
||||
cog.out(
|
||||
f"""
|
||||
QStringLiteral("{item}"),"""
|
||||
)
|
||||
cog.out(
|
||||
f"""
|
||||
cog.out(f"""
|
||||
QStringLiteral("{item}"),""")
|
||||
cog.out(f"""
|
||||
}};
|
||||
"""
|
||||
)
|
||||
""")
|
||||
|
||||
|
||||
params_utils.init_params(Params, NameSpace, ClassName, ParamPath)
|
||||
|
||||
@@ -1549,8 +1549,10 @@ void OverlayTabWidget::setOverlayMode(bool enable)
|
||||
if (!enable && isTransparent()) {
|
||||
option = OverlayOption::ShowTab;
|
||||
}
|
||||
else if (enable && !isTransparent()
|
||||
&& (autoMode == AutoMode::EditShow || autoMode == AutoMode::AutoHide)) {
|
||||
else if (
|
||||
enable && !isTransparent()
|
||||
&& (autoMode == AutoMode::EditShow || autoMode == AutoMode::AutoHide)
|
||||
) {
|
||||
option = OverlayOption::Disable;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -548,8 +548,10 @@ static void copyTemplateParameters(
|
||||
}
|
||||
}
|
||||
|
||||
static void copyTemplateParameters(/*const*/ ParameterManager& templateParameterManager,
|
||||
ParameterManager& outputParameterManager)
|
||||
static void copyTemplateParameters(
|
||||
/*const*/ ParameterManager& templateParameterManager,
|
||||
ParameterManager& outputParameterManager
|
||||
)
|
||||
{
|
||||
auto groups = templateParameterManager.GetGroups();
|
||||
for (auto& group : groups) {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
"""Auto code generator for preference page of Display/UI"""
|
||||
|
||||
import cog, sys
|
||||
from os import path
|
||||
|
||||
|
||||
@@ -585,8 +585,10 @@ void PythonConsole::keyPressEvent(QKeyEvent* e)
|
||||
|| e->matches(QKeySequence::SelectAll)) {
|
||||
PythonTextEditor::keyPressEvent(e);
|
||||
}
|
||||
else if (!e->text().isEmpty()
|
||||
&& (e->modifiers() == Qt::NoModifier || e->modifiers() == Qt::ShiftModifier)) {
|
||||
else if (
|
||||
!e->text().isEmpty()
|
||||
&& (e->modifiers() == Qt::NoModifier || e->modifiers() == Qt::ShiftModifier)
|
||||
) {
|
||||
this->moveCursor(QTextCursor::End);
|
||||
PythonTextEditor::keyPressEvent(e);
|
||||
}
|
||||
|
||||
@@ -2499,7 +2499,9 @@ PyObject* SelectionSingleton::sAddSelection(PyObject* /*self*/, PyObject* args)
|
||||
char* docname;
|
||||
char* subname = nullptr;
|
||||
float x = 0, y = 0, z = 0;
|
||||
if (PyArg_ParseTuple(args, "ss|sfffO!", &docname, &objname, &subname, &x, &y, &z, &PyBool_Type, &clearPreselect)) {
|
||||
if (
|
||||
PyArg_ParseTuple(args, "ss|sfffO!", &docname, &objname, &subname, &x, &y, &z, &PyBool_Type, &clearPreselect)
|
||||
) {
|
||||
Selection()
|
||||
.addSelection(docname, objname, subname, x, y, z, nullptr, Base::asBoolean(clearPreselect));
|
||||
Py_Return;
|
||||
@@ -2593,15 +2595,9 @@ PyObject* SelectionSingleton::sUpdateSelection(PyObject* /*self*/, PyObject* arg
|
||||
PyObject* show;
|
||||
PyObject* object;
|
||||
char* subname = nullptr;
|
||||
if (!PyArg_ParseTuple(
|
||||
args,
|
||||
"O!O!|s",
|
||||
&PyBool_Type,
|
||||
&show,
|
||||
&(App::DocumentObjectPy::Type),
|
||||
&object,
|
||||
&subname
|
||||
)) {
|
||||
if (
|
||||
!PyArg_ParseTuple(args, "O!O!|s", &PyBool_Type, &show, &(App::DocumentObjectPy::Type), &object, &subname)
|
||||
) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -264,8 +264,10 @@ int yyi;
|
||||
# ifndef YYSTACK_ALLOC_MAXIMUM
|
||||
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
|
||||
# endif
|
||||
# if (defined __cplusplus && !defined _STDLIB_H \
|
||||
&& !((defined YYMALLOC || defined malloc) && (defined YYFREE || defined free)))
|
||||
# if ( \
|
||||
defined __cplusplus && !defined _STDLIB_H \
|
||||
&& !((defined YYMALLOC || defined malloc) && (defined YYFREE || defined free)) \
|
||||
)
|
||||
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
|
||||
# ifndef _STDLIB_H
|
||||
# define _STDLIB_H 1
|
||||
@@ -289,8 +291,10 @@ void free(void*); /* INFRINGES ON USER NAME SPACE */
|
||||
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
|
||||
|
||||
|
||||
#if (!defined yyoverflow \
|
||||
&& (!defined __cplusplus || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
|
||||
#if ( \
|
||||
!defined yyoverflow \
|
||||
&& (!defined __cplusplus || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)) \
|
||||
)
|
||||
|
||||
/* A type that is properly aligned for any stack member. */
|
||||
union yyalloc
|
||||
|
||||
@@ -188,8 +188,10 @@ void SoFCSelection::doAction(SoAction* action)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (selaction->getType() == Gui::SoSelectionElementAction::None
|
||||
|| selaction->getType() == Gui::SoSelectionElementAction::Remove) {
|
||||
else if (
|
||||
selaction->getType() == Gui::SoSelectionElementAction::None
|
||||
|| selaction->getType() == Gui::SoSelectionElementAction::Remove
|
||||
) {
|
||||
SelContextPtr ctx
|
||||
= Gui::SoFCSelectionRoot::getActionContext(action, this, selContext, false);
|
||||
if (ctx && ctx->isSelected()) {
|
||||
|
||||
@@ -1130,9 +1130,11 @@ void SoBoxSelectionRenderAction::apply(SoNode* node)
|
||||
}
|
||||
PRIVATE(this)->selectsearch->reset();
|
||||
}
|
||||
else if (selection->isHighlighted()
|
||||
&& selection->selected.getValue() == SoFCSelection::NOTSELECTED
|
||||
&& selection->style.getValue() == SoFCSelection::BOX) {
|
||||
else if (
|
||||
selection->isHighlighted()
|
||||
&& selection->selected.getValue() == SoFCSelection::NOTSELECTED
|
||||
&& selection->style.getValue() == SoFCSelection::BOX
|
||||
) {
|
||||
PRIVATE(this)->basecolor->rgb.setValue(selection->colorHighlight.getValue());
|
||||
|
||||
if (!PRIVATE(this)->selectsearch) {
|
||||
@@ -1177,9 +1179,10 @@ void SoBoxSelectionRenderAction::apply(SoPath* path)
|
||||
// because this will destroy the box immediately
|
||||
selection->touch(); // force a redraw when dehighlighting
|
||||
}
|
||||
else if (selection->isHighlighted()
|
||||
&& selection->selected.getValue() == SoFCSelection::NOTSELECTED
|
||||
&& selection->style.getValue() == SoFCSelection::BOX) {
|
||||
else if (
|
||||
selection->isHighlighted() && selection->selected.getValue() == SoFCSelection::NOTSELECTED
|
||||
&& selection->style.getValue() == SoFCSelection::BOX
|
||||
) {
|
||||
PRIVATE(this)->basecolor->rgb.setValue(selection->colorHighlight.getValue());
|
||||
|
||||
if (!PRIVATE(this)->selectsearch) {
|
||||
|
||||
@@ -380,8 +380,10 @@ void SoFCUnifiedSelection::doAction(SoAction* action)
|
||||
currentHighlightPath = nullptr;
|
||||
}
|
||||
}
|
||||
else if (preselectionMode.getValue() != OFF
|
||||
&& preselectAction->SelChange.Type == SelectionChanges::SetPreselect) {
|
||||
else if (
|
||||
preselectionMode.getValue() != OFF
|
||||
&& preselectAction->SelChange.Type == SelectionChanges::SetPreselect
|
||||
) {
|
||||
if (currentHighlightPath) {
|
||||
SoHighlightElementAction highlightAction;
|
||||
highlightAction.apply(currentHighlightPath);
|
||||
@@ -529,8 +531,10 @@ void SoFCUnifiedSelection::doAction(SoAction* action)
|
||||
selectionAction.apply(this->getChild(i));
|
||||
}
|
||||
}
|
||||
else if (selectionMode.getValue() == ON
|
||||
&& selectionAction->SelChange.Type == SelectionChanges::SetSelection) {
|
||||
else if (
|
||||
selectionMode.getValue() == ON
|
||||
&& selectionAction->SelChange.Type == SelectionChanges::SetSelection
|
||||
) {
|
||||
std::vector<ViewProvider*> vps;
|
||||
if (this->pcDocument) {
|
||||
vps = this->pcDocument->getViewProvidersOfType(
|
||||
@@ -921,8 +925,10 @@ void SoFCUnifiedSelection::handleEvent(SoHandleEventAction* action)
|
||||
}
|
||||
}
|
||||
// mouse press events for (de)selection
|
||||
else if (event->isOfType(SoMouseButtonEvent::getClassTypeId())
|
||||
&& selectionMode.getValue() == SoFCUnifiedSelection::ON) {
|
||||
else if (
|
||||
event->isOfType(SoMouseButtonEvent::getClassTypeId())
|
||||
&& selectionMode.getValue() == SoFCUnifiedSelection::ON
|
||||
) {
|
||||
const auto e = static_cast<const SoMouseButtonEvent*>(event);
|
||||
if (SoMouseButtonEvent::isButtonReleaseEvent(e, SoMouseButtonEvent::BUTTON1)) {
|
||||
// check to see if the mouse is over a geometry...
|
||||
@@ -1810,8 +1816,9 @@ bool SoFCSelectionRoot::doActionPrivate(Stack& stack, SoAction* action)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (action->getWhatAppliedTo() != SoAction::NODE
|
||||
&& action->getCurPathCode() != SoAction::BELOW_PATH) {
|
||||
else if (
|
||||
action->getWhatAppliedTo() != SoAction::NODE && action->getCurPathCode() != SoAction::BELOW_PATH
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -246,8 +246,10 @@ public:
|
||||
|| label->datumtype.getValue() == SoDatumLabel::DISTANCEY) {
|
||||
corners = computeDistanceBBox();
|
||||
}
|
||||
else if (label->datumtype.getValue() == SoDatumLabel::RADIUS
|
||||
|| label->datumtype.getValue() == SoDatumLabel::DIAMETER) {
|
||||
else if (
|
||||
label->datumtype.getValue() == SoDatumLabel::RADIUS
|
||||
|| label->datumtype.getValue() == SoDatumLabel::DIAMETER
|
||||
) {
|
||||
corners = computeRadiusDiameterBBox();
|
||||
}
|
||||
else if (label->datumtype.getValue() == SoDatumLabel::ANGLE) {
|
||||
|
||||
@@ -326,8 +326,7 @@ void TaskTransform::updatePositionAndRotationUi() const
|
||||
|
||||
auto setPositionValues = [&](const Base::Vector3d& vec, auto* x, auto* y, auto* z) {
|
||||
[[maybe_unused]]
|
||||
auto blockers
|
||||
= {QSignalBlocker(x), QSignalBlocker(y), QSignalBlocker(z)};
|
||||
auto blockers = {QSignalBlocker(x), QSignalBlocker(y), QSignalBlocker(z)};
|
||||
|
||||
x->setValue(fixNegativeZero(vec.x));
|
||||
y->setValue(fixNegativeZero(vec.y));
|
||||
@@ -336,8 +335,7 @@ void TaskTransform::updatePositionAndRotationUi() const
|
||||
|
||||
auto setRotationValues = [&](const Base::Rotation& rot, auto* x, auto* y, auto* z) {
|
||||
[[maybe_unused]]
|
||||
auto blockers
|
||||
= {QSignalBlocker(x), QSignalBlocker(y), QSignalBlocker(z)};
|
||||
auto blockers = {QSignalBlocker(x), QSignalBlocker(y), QSignalBlocker(z)};
|
||||
|
||||
double alpha, beta, gamma;
|
||||
rot.getEulerAngles(eulerSequence(), alpha, beta, gamma);
|
||||
|
||||
@@ -628,8 +628,10 @@ int ToolBarManager::toolBarIconSize(QWidget* widget) const
|
||||
s *= 0.6;
|
||||
}
|
||||
}
|
||||
else if (widget->parentWidget() == menuBarLeftAreaWidget
|
||||
|| widget->parentWidget() == menuBarRightAreaWidget) {
|
||||
else if (
|
||||
widget->parentWidget() == menuBarLeftAreaWidget
|
||||
|| widget->parentWidget() == menuBarRightAreaWidget
|
||||
) {
|
||||
if (_menuBarIconSize > 0) {
|
||||
s = _menuBarIconSize;
|
||||
}
|
||||
|
||||
+8
-9
@@ -2232,8 +2232,10 @@ Qt::DropAction getDropAction(int size, const int type)
|
||||
if (QApplication::keyboardModifiers() == Qt::ControlModifier) {
|
||||
return Qt::CopyAction;
|
||||
}
|
||||
else if (QApplication::keyboardModifiers() == Qt::AltModifier
|
||||
&& (size == 1 || type == TreeWidget::DocumentType)) {
|
||||
else if (
|
||||
QApplication::keyboardModifiers() == Qt::AltModifier
|
||||
&& (size == 1 || type == TreeWidget::DocumentType)
|
||||
) {
|
||||
return Qt::LinkAction;
|
||||
}
|
||||
else {
|
||||
@@ -4746,13 +4748,10 @@ void DocumentItem::populateItem(DocumentObjectItem* item, bool refresh, bool del
|
||||
auto it = ObjectMap.find(child);
|
||||
if (it == ObjectMap.end() || it->second->items.empty()) {
|
||||
auto vp = getViewProvider(child);
|
||||
if (!vp
|
||||
|| !createNewItem(
|
||||
*vp,
|
||||
item,
|
||||
i,
|
||||
it == ObjectMap.end() ? DocumentObjectDataPtr() : it->second
|
||||
)) {
|
||||
if (
|
||||
!vp
|
||||
|| !createNewItem(*vp, item, i, it == ObjectMap.end() ? DocumentObjectDataPtr() : it->second)
|
||||
) {
|
||||
--i;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
"""Auto code generator for parameters in Preferences/TreeView"""
|
||||
|
||||
import sys
|
||||
from os import path
|
||||
|
||||
|
||||
@@ -416,8 +416,10 @@ void View3DSettings::OnChange(ParameterGrp::SubjectType& rCaller, ParameterGrp::
|
||||
_viewer->setEnabledNaviCube(rGrp.GetBool("ShowNaviCube", true));
|
||||
}
|
||||
}
|
||||
else if (strcmp(Reason, "AxisXColor") == 0 || strcmp(Reason, "AxisYColor") == 0
|
||||
|| strcmp(Reason, "AxisZColor") == 0) {
|
||||
else if (
|
||||
strcmp(Reason, "AxisXColor") == 0 || strcmp(Reason, "AxisYColor") == 0
|
||||
|| strcmp(Reason, "AxisZColor") == 0
|
||||
) {
|
||||
for (auto _viewer : _viewers) {
|
||||
_viewer->updateColors();
|
||||
}
|
||||
@@ -653,9 +655,11 @@ void NaviCubeSettings::parameterChanged(const char* Name)
|
||||
float opacity = static_cast<float>(hGrp->GetInt("InactiveOpacity", 50)) / 100;
|
||||
nc->setInactiveOpacity(opacity);
|
||||
}
|
||||
else if (strcmp(Name, "TextTop") == 0 || strcmp(Name, "TextBottom") == 0
|
||||
|| strcmp(Name, "TextFront") == 0 || strcmp(Name, "TextRear") == 0
|
||||
|| strcmp(Name, "TextLeft") == 0 || strcmp(Name, "TextRight") == 0) {
|
||||
else if (
|
||||
strcmp(Name, "TextTop") == 0 || strcmp(Name, "TextBottom") == 0
|
||||
|| strcmp(Name, "TextFront") == 0 || strcmp(Name, "TextRear") == 0
|
||||
|| strcmp(Name, "TextLeft") == 0 || strcmp(Name, "TextRight") == 0
|
||||
) {
|
||||
std::vector<std::string> labels;
|
||||
QByteArray frontByteArray = tr("FRONT").toUtf8();
|
||||
labels.push_back(hGrp->GetASCII("TextFront", frontByteArray.constData()));
|
||||
|
||||
@@ -363,16 +363,20 @@ Base::Rotation Gui::ViewProviderDragger::orthonormalize(
|
||||
z = x.Cross(y);
|
||||
z.Normalize();
|
||||
}
|
||||
else if (components.testFlag(Gui::ViewProviderDragger::DraggerComponent::XRot)
|
||||
&& components.testFlag(Gui::ViewProviderDragger::DraggerComponent::ZRot)) {
|
||||
else if (
|
||||
components.testFlag(Gui::ViewProviderDragger::DraggerComponent::XRot)
|
||||
&& components.testFlag(Gui::ViewProviderDragger::DraggerComponent::ZRot)
|
||||
) {
|
||||
x.Normalize();
|
||||
z = z - x * (x * z);
|
||||
z.Normalize();
|
||||
y = z.Cross(x);
|
||||
y.Normalize();
|
||||
}
|
||||
else if (components.testFlag(Gui::ViewProviderDragger::DraggerComponent::YRot)
|
||||
&& components.testFlag(Gui::ViewProviderDragger::DraggerComponent::ZRot)) {
|
||||
else if (
|
||||
components.testFlag(Gui::ViewProviderDragger::DraggerComponent::YRot)
|
||||
&& components.testFlag(Gui::ViewProviderDragger::DraggerComponent::ZRot)
|
||||
) {
|
||||
y.Normalize();
|
||||
z = z - y * (y * z);
|
||||
z.Normalize();
|
||||
|
||||
@@ -393,8 +393,10 @@ void ViewProviderGeometryObject::handleChangedPropertyName(
|
||||
prop.Restore(reader);
|
||||
ShapeAppearance.setDiffuseColor(prop.getValue());
|
||||
}
|
||||
else if (strcmp(PropName, "ShapeMaterial") == 0
|
||||
&& strcmp(TypeName, App::PropertyMaterial::getClassTypeId().getName()) == 0) {
|
||||
else if (
|
||||
strcmp(PropName, "ShapeMaterial") == 0
|
||||
&& strcmp(TypeName, App::PropertyMaterial::getClassTypeId().getName()) == 0
|
||||
) {
|
||||
App::PropertyMaterial prop;
|
||||
prop.Restore(reader);
|
||||
ShapeAppearance.setValue(prop.getValue());
|
||||
|
||||
@@ -126,8 +126,9 @@ void ViewProviderInventorObject::updateData(const App::Property* prop)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (prop->isDerivedFrom<App::PropertyPlacement>()
|
||||
&& strcmp(prop->getName(), "Placement") == 0) {
|
||||
else if (
|
||||
prop->isDerivedFrom<App::PropertyPlacement>() && strcmp(prop->getName(), "Placement") == 0
|
||||
) {
|
||||
// Note: If R is the rotation, c the rotation center and t the translation
|
||||
// vector then Inventor applies the following transformation: R*(x-c)+c+t
|
||||
// In FreeCAD a placement only has a rotation and a translation part but
|
||||
|
||||
@@ -226,7 +226,9 @@ PyObject* ViewProviderPy::canDropObject(PyObject* args, PyObject* kw)
|
||||
PyObject* pyElements = Py_None;
|
||||
const char* subname = nullptr;
|
||||
static const std::array<const char*, 5> kwlist {"obj", "owner", "subname", "elem", nullptr};
|
||||
if (!Base::Wrapped_ParseTupleAndKeywords(args, kw, "|OOsO", kwlist, &obj, &owner, &subname, &pyElements)) {
|
||||
if (
|
||||
!Base::Wrapped_ParseTupleAndKeywords(args, kw, "|OOsO", kwlist, &obj, &owner, &subname, &pyElements)
|
||||
) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -252,8 +252,9 @@ void ViewProviderVRMLObject::updateData(const App::Property* prop)
|
||||
SoInput::removeDirectory(subpath.constData());
|
||||
}
|
||||
}
|
||||
else if (prop->isDerivedFrom<App::PropertyPlacement>()
|
||||
&& strcmp(prop->getName(), "Placement") == 0) {
|
||||
else if (
|
||||
prop->isDerivedFrom<App::PropertyPlacement>() && strcmp(prop->getName(), "Placement") == 0
|
||||
) {
|
||||
// Note: If R is the rotation, c the rotation center and t the translation
|
||||
// vector then Inventor applies the following transformation: R*(x-c)+c+t
|
||||
// In FreeCAD a placement only has a rotation and a translation part but
|
||||
|
||||
+3
-2
@@ -1206,8 +1206,9 @@ bool ToolTip::eventFilter(QObject* o, QEvent* e)
|
||||
// removeEventFilter();
|
||||
this->hidden = true;
|
||||
}
|
||||
else if (e->type() == QEvent::Timer && !this->hidden
|
||||
&& displayTime.elapsed() < 5000) {
|
||||
else if (
|
||||
e->type() == QEvent::Timer && !this->hidden && displayTime.elapsed() < 5000
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1285,8 +1285,10 @@ bool PropertyEditor::eventFilter(QObject* object, QEvent* event)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (mouse_event->type() == QEvent::MouseButtonPress
|
||||
&& mouse_event->button() == Qt::LeftButton && !dragInProgress) {
|
||||
else if (
|
||||
mouse_event->type() == QEvent::MouseButtonPress
|
||||
&& mouse_event->button() == Qt::LeftButton && !dragInProgress
|
||||
) {
|
||||
if (indexResizable(mouse_event->pos()).isValid()) {
|
||||
dragInProgress = true;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
@@ -1298,8 +1300,10 @@ bool PropertyEditor::eventFilter(QObject* object, QEvent* event)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (mouse_event->type() == QEvent::MouseButtonRelease
|
||||
&& mouse_event->button() == Qt::LeftButton && dragInProgress) {
|
||||
else if (
|
||||
mouse_event->type() == QEvent::MouseButtonRelease
|
||||
&& mouse_event->button() == Qt::LeftButton && dragInProgress
|
||||
) {
|
||||
dragInProgress = false;
|
||||
|
||||
auto hGrp = App::GetApplication().GetParameterGroupByPath(
|
||||
|
||||
@@ -222,8 +222,7 @@ DistanceType getDistanceType(App::DocumentObject* joint)
|
||||
}
|
||||
}
|
||||
|
||||
else if (isFaceType(obj1, elt1, GeomAbs_Cylinder)
|
||||
|| isFaceType(obj2, elt2, GeomAbs_Cylinder)) {
|
||||
else if (isFaceType(obj1, elt1, GeomAbs_Cylinder) || isFaceType(obj2, elt2, GeomAbs_Cylinder)) {
|
||||
if (!isFaceType(obj1, elt1, GeomAbs_Cylinder)) {
|
||||
swapJCS(joint); // make sure cylinder is first if its not 2 cylinders.
|
||||
std::swap(elt1, elt2);
|
||||
@@ -789,8 +788,9 @@ void collectComponentsRecursively(
|
||||
}
|
||||
}
|
||||
|
||||
else if (obj->isDerivedFrom<App::GeoFeature>()
|
||||
&& !obj->isDerivedFrom<App::LocalCoordinateSystem>()) {
|
||||
else if (
|
||||
obj->isDerivedFrom<App::GeoFeature>() && !obj->isDerivedFrom<App::LocalCoordinateSystem>()
|
||||
) {
|
||||
results.push_back(obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ if App.GuiUp:
|
||||
import UtilsAssembly
|
||||
import Preferences
|
||||
|
||||
|
||||
__title__ = "Assembly Command Create Exploded View"
|
||||
__author__ = "Ondsel"
|
||||
__url__ = "https://www.freecad.org"
|
||||
|
||||
@@ -36,7 +36,6 @@ import UtilsAssembly
|
||||
import Preferences
|
||||
import CommandCreateJoint
|
||||
|
||||
|
||||
__title__ = "Assembly Command Insert Component"
|
||||
__author__ = "Ondsel"
|
||||
__url__ = "https://www.freecad.org"
|
||||
|
||||
@@ -33,7 +33,6 @@ if App.GuiUp:
|
||||
import UtilsAssembly
|
||||
import Assembly_rc
|
||||
|
||||
|
||||
__title__ = "Assembly Command to Solve Assembly"
|
||||
__author__ = "Ondsel"
|
||||
__url__ = "https://www.freecad.org"
|
||||
|
||||
@@ -25,7 +25,6 @@ import math
|
||||
|
||||
import FreeCAD as App
|
||||
|
||||
|
||||
if App.GuiUp:
|
||||
import FreeCADGui as Gui
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import TestApp
|
||||
from AssemblyTests.TestCore import TestCore
|
||||
from AssemblyTests.TestCommandInsertLink import TestCommandInsertLink
|
||||
|
||||
|
||||
# Use the modules so that code checkers don't complain (flake8)
|
||||
True if TestCore else False
|
||||
True if TestCommandInsertLink else False
|
||||
|
||||
+1
-1
@@ -47,6 +47,7 @@ wall = Arch.makeWall(length=5000, width=200, height=3000) # mm units
|
||||
wall.recompute()
|
||||
```
|
||||
"""
|
||||
|
||||
__title__ = "FreeCAD Arch API"
|
||||
__author__ = "Yorik van Havre"
|
||||
__url__ = "https://www.freecad.org"
|
||||
@@ -73,7 +74,6 @@ from ArchSql import *
|
||||
# Currently makeStructure, makeStructuralSystem need migration
|
||||
from ArchStructure import *
|
||||
|
||||
|
||||
# make functions
|
||||
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ import FreeCAD
|
||||
from FreeCAD import Vector
|
||||
from draftutils.translate import translate
|
||||
|
||||
|
||||
WindowPresets = [
|
||||
"Fixed",
|
||||
"Open 1-pane",
|
||||
|
||||
@@ -19,7 +19,6 @@ import struct
|
||||
|
||||
import numpy
|
||||
|
||||
|
||||
# Exceptions
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ Defines some routines for calculating normals and transforming points.
|
||||
|
||||
import numpy
|
||||
|
||||
|
||||
# Can push numpy.float64 (or even numpy.float80) into this if you
|
||||
# would like to use higher precision when calculating; results will be
|
||||
# converted back to numpy.float32
|
||||
|
||||
@@ -51,7 +51,7 @@ class BIM_ImagePlane:
|
||||
self.tracker = DraftTrackers.rectangleTracker()
|
||||
self.basepoint = None
|
||||
self.opposite = None
|
||||
(filename, _filter) = QtGui.QFileDialog.getOpenFileName(
|
||||
filename, _filter = QtGui.QFileDialog.getOpenFileName(
|
||||
QtGui.QApplication.activeWindow(),
|
||||
translate("BIM", "Select Image"),
|
||||
None,
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
|
||||
|
||||
QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
# Copyright (c) 2025 The FreeCAD Project
|
||||
|
||||
"""Unit tests for the ArchReport and ArchSql modules."""
|
||||
|
||||
import FreeCAD
|
||||
import Arch
|
||||
import Draft
|
||||
|
||||
@@ -59,7 +59,6 @@ from importers import exportIFCHelper
|
||||
from importers import exportIFCStructuralTools
|
||||
from importers.importIFCHelper import dd2dms
|
||||
|
||||
|
||||
PARAMS = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/BIM")
|
||||
|
||||
# Templates and other definitions ****
|
||||
|
||||
@@ -257,7 +257,7 @@ def insert(srcfile, docname, skip=[], only=[], root=None, preferences=None):
|
||||
floors = ifcfile.by_type("IfcBuildingStorey")
|
||||
openings = ifcfile.by_type("IfcOpeningElement")
|
||||
materials = ifcfile.by_type("IfcMaterial")
|
||||
(products, annotations) = importIFCHelper.buildRelProductsAnnotations(
|
||||
products, annotations = importIFCHelper.buildRelProductsAnnotations(
|
||||
ifcfile, preferences["ROOT_ELEMENT"]
|
||||
)
|
||||
|
||||
@@ -1018,7 +1018,7 @@ def insert(srcfile, docname, skip=[], only=[], root=None, preferences=None):
|
||||
# Only if x==0 then we can not determine TrueNorth.
|
||||
# But that would actually be an invalid IFC file, because the magnitude
|
||||
# of the (twodimensional) direction vector for TrueNorth shall be greater than zero.
|
||||
(x, y) = modelRC.TrueNorth.DirectionRatios[:2]
|
||||
x, y = modelRC.TrueNorth.DirectionRatios[:2]
|
||||
obj.Declination = ((math.degrees(math.atan2(y, x)) - 90 + 180) % 360) - 180
|
||||
if FreeCAD.GuiUp:
|
||||
obj.ViewObject.CompassRotation.Value = obj.Declination
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
# ***************************************************************************
|
||||
|
||||
"""Helper functions that are used by IFC importer and exporter."""
|
||||
|
||||
import math
|
||||
|
||||
import FreeCAD
|
||||
|
||||
@@ -1109,22 +1109,18 @@ def export(exportList, filename):
|
||||
FreeCAD.Console.PrintError(
|
||||
translate("Arch", "Error: IfcOpenShell is not installed") + "\n"
|
||||
)
|
||||
print(
|
||||
"""importIFC: ifcOpenShell is not installed. IFC export is unavailable.
|
||||
print("""importIFC: ifcOpenShell is not installed. IFC export is unavailable.
|
||||
Note: IFC export currently requires an experimental version of IfcOpenShell
|
||||
available from https://github.com/aothms/IfcOpenShell"""
|
||||
)
|
||||
available from https://github.com/aothms/IfcOpenShell""")
|
||||
return
|
||||
|
||||
if (not hasattr(ifcw, "IfcFile")) and (not hasattr(ifcw, "file")):
|
||||
FreeCAD.Console.PrintError(
|
||||
translate("Arch", "Error: your IfcOpenShell version is too old") + "\n"
|
||||
)
|
||||
print(
|
||||
"""importIFC: The version of IfcOpenShell installed on this system does not
|
||||
print("""importIFC: The version of IfcOpenShell installed on this system does not
|
||||
have IFC export capabilities. IFC export currently requires an experimental
|
||||
version of IfcOpenShell available from https://github.com/aothms/IfcOpenShell"""
|
||||
)
|
||||
version of IfcOpenShell available from https://github.com/aothms/IfcOpenShell""")
|
||||
return
|
||||
import Draft
|
||||
import Arch
|
||||
|
||||
@@ -38,7 +38,6 @@ import zipfile
|
||||
import FreeCAD
|
||||
from FreeCAD import Base
|
||||
|
||||
|
||||
DEBUG = True
|
||||
|
||||
|
||||
|
||||
@@ -751,7 +751,7 @@ class SH3DImporter:
|
||||
handler = self.handlers[xpath]
|
||||
|
||||
def _process(tuple):
|
||||
(i, elm) = tuple
|
||||
i, elm = tuple
|
||||
_msg(
|
||||
f"Importing {tag_name}#{i} ({self.current_object_count + 1}/{self.total_object_count})…"
|
||||
)
|
||||
@@ -923,7 +923,7 @@ class SH3DImporter:
|
||||
handler = self.handlers[ET_XPATH_LEVEL]
|
||||
|
||||
def _create_slab(tuple):
|
||||
(i, floor) = tuple
|
||||
i, floor = tuple
|
||||
_msg(f"Creating slab#{i} for floor '{floor.Label}'…")
|
||||
try:
|
||||
# with Transaction(f"Creating slab#{i} for floor '{floor.Label}'"):
|
||||
@@ -1598,7 +1598,7 @@ class RoomHandler(BaseHandler):
|
||||
for j in range(i + 1, len(edges)): # Avoid duplicate checks
|
||||
e1 = edges[i]
|
||||
e2 = edges[j]
|
||||
(dist, vectors, _) = e1.distToShape(e2)
|
||||
dist, vectors, _ = e1.distToShape(e2)
|
||||
if dist > 0:
|
||||
continue
|
||||
for v1, v2 in vectors:
|
||||
@@ -2008,7 +2008,7 @@ class WallHandler(BaseHandler):
|
||||
Returns:
|
||||
Rectangle, Rectangle, spine: both section and the line for the wall
|
||||
"""
|
||||
(start, end, _, _, _, _) = wall_details
|
||||
start, end, _, _, _, _ = wall_details
|
||||
|
||||
a1, a2, _ = self._get_normal_angles(wall_details)
|
||||
|
||||
@@ -2030,7 +2030,7 @@ class WallHandler(BaseHandler):
|
||||
Returns:
|
||||
Rectangle, Rectangle, spine: both section and the arc for the wall
|
||||
#"""
|
||||
(start, end, _, _, _, _) = wall_details
|
||||
start, end, _, _, _, _ = wall_details
|
||||
|
||||
a1, a2, (invert_angle, center, radius) = self._get_normal_angles(wall_details)
|
||||
|
||||
@@ -2096,8 +2096,8 @@ class WallHandler(BaseHandler):
|
||||
# In case the walls are to be joined we determine the intersection
|
||||
# of both wall which depends on their respective thickness.
|
||||
# Calculate the left and right side of each wall
|
||||
(start, end, thickness, height_start, height_end, _) = wall_details
|
||||
(s_start, s_end, s_thickness, _, _, _) = sibling_details
|
||||
start, end, thickness, height_start, height_end, _ = wall_details
|
||||
s_start, s_end, s_thickness, _, _, _ = sibling_details
|
||||
|
||||
lside, rside = self._get_sides(start, end, thickness)
|
||||
s_lside, s_rside = self._get_sides(s_start, s_end, s_thickness)
|
||||
@@ -2118,7 +2118,7 @@ class WallHandler(BaseHandler):
|
||||
if debug_geometry:
|
||||
_log(f"section: {section}")
|
||||
else:
|
||||
(start, end, thickness, height_start, height_end, _) = wall_details
|
||||
start, end, thickness, height_start, height_end, _ = wall_details
|
||||
height = height_start if at_start else height_end
|
||||
center = start if at_start else end
|
||||
z_rotation = a1 if at_start else a2
|
||||
@@ -2173,7 +2173,7 @@ class WallHandler(BaseHandler):
|
||||
Vector: the center of the circle for a curved wall section
|
||||
float: the radius of said circle
|
||||
"""
|
||||
(start, end, _, _, _, arc_extent) = wall_details
|
||||
start, end, _, _, _, arc_extent = wall_details
|
||||
|
||||
angle_start = angle_end = 0
|
||||
invert_angle = False
|
||||
@@ -2298,7 +2298,7 @@ class WallHandler(BaseHandler):
|
||||
if self.importer.preferences["DECORATE_SURFACES"]:
|
||||
floor = App.ActiveDocument.getObject(obj.ReferenceFloorName)
|
||||
|
||||
(left_face_name, left_face, right_face_name, right_face) = self.get_faces(obj)
|
||||
left_face_name, left_face, right_face_name, right_face = self.get_faces(obj)
|
||||
|
||||
self._create_facebinders(floor, obj, left_face_name, right_face_name)
|
||||
|
||||
@@ -2693,7 +2693,7 @@ class DoorOrWindowHandler(BaseFurnitureHandler):
|
||||
)
|
||||
|
||||
# Get the left and right face for the main_wall
|
||||
(_, wall_lface, _, wall_rface) = self.get_faces(main_wall)
|
||||
_, wall_lface, _, wall_rface = self.get_faces(main_wall)
|
||||
|
||||
# The general process is as follow:
|
||||
# 1- Find the bounding box face whose normal is properly oriented
|
||||
@@ -2767,12 +2767,12 @@ class DoorOrWindowHandler(BaseFurnitureHandler):
|
||||
# correspondence between a catalog ID and a specific window preset from
|
||||
# the parts library. Only using Opening / Fixed / Simple Door
|
||||
catalog_id = elm.get("catalogId")
|
||||
(windowtype, ifc_type) = DOOR_MODELS.get(catalog_id, (None, None))
|
||||
windowtype, ifc_type = DOOR_MODELS.get(catalog_id, (None, None))
|
||||
if not windowtype:
|
||||
_wrn(
|
||||
f"Unknown catalogId {catalog_id} for element {elm.get('id')}. Defaulting to 'Simple Door'"
|
||||
)
|
||||
(windowtype, ifc_type) = ("Simple door", "Door")
|
||||
windowtype, ifc_type = ("Simple door", "Door")
|
||||
|
||||
# See the https://wiki.freecad.org/Arch_Window for details about these values
|
||||
# NOTE: These are simple heuristic to get reasonable windows
|
||||
|
||||
@@ -36,7 +36,6 @@ from importers import importIFCHelper
|
||||
from . import ifc_tools
|
||||
from . import ifc_import
|
||||
|
||||
|
||||
PARAMS = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/NativeIFC")
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
import FreeCAD
|
||||
|
||||
|
||||
params = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/NativeIFC")
|
||||
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ import FreeCAD
|
||||
|
||||
from . import ifc_import
|
||||
|
||||
|
||||
FILES = [
|
||||
"IfcOpenHouse_IFC4.ifc",
|
||||
"FZK_haus.ifc",
|
||||
|
||||
@@ -45,7 +45,6 @@ from . import ifc_psets
|
||||
from . import ifc_objects
|
||||
from . import ifc_generator
|
||||
|
||||
|
||||
IFC_FILE_PATH = None # downloaded IFC file path
|
||||
FCSTD_FILE_PATH = None # saved FreeCAD file
|
||||
PARAMS = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/NativeIFC")
|
||||
|
||||
@@ -31,7 +31,6 @@ from urllib.request import urlopen
|
||||
import xml.sax
|
||||
from zipfile import ZipFile
|
||||
|
||||
|
||||
URL = "https://ifc43-docs.standards.buildingsmart.org/IFC/RELEASE/IFC4x3/HTML/annex-a-psd.zip"
|
||||
|
||||
QTO_TYPES = {
|
||||
|
||||
@@ -400,8 +400,10 @@ private:
|
||||
if (PyObject_TypeCheck(pShapes, &(Part::TopoShapePy::Type))) {
|
||||
shapes.push_back(static_cast<Part::TopoShapePy*>(pShapes)->getTopoShapePtr()->getShape());
|
||||
}
|
||||
else if (PyObject_TypeCheck(pShapes, &(PyList_Type))
|
||||
|| PyObject_TypeCheck(pShapes, &(PyTuple_Type))) {
|
||||
else if (
|
||||
PyObject_TypeCheck(pShapes, &(PyList_Type))
|
||||
|| PyObject_TypeCheck(pShapes, &(PyTuple_Type))
|
||||
) {
|
||||
Py::Sequence shapeSeq(pShapes);
|
||||
for (Py::Sequence::iterator it = shapeSeq.begin(); it != shapeSeq.end(); ++it) {
|
||||
PyObject* item = (*it).ptr();
|
||||
@@ -474,8 +476,10 @@ private:
|
||||
if (PyObject_TypeCheck(pShapes, &(Part::TopoShapePy::Type))) {
|
||||
shapes.push_back(static_cast<Part::TopoShapePy*>(pShapes)->getTopoShapePtr()->getShape());
|
||||
}
|
||||
else if (PyObject_TypeCheck(pShapes, &(PyList_Type))
|
||||
|| PyObject_TypeCheck(pShapes, &(PyTuple_Type))) {
|
||||
else if (
|
||||
PyObject_TypeCheck(pShapes, &(PyList_Type))
|
||||
|| PyObject_TypeCheck(pShapes, &(PyTuple_Type))
|
||||
) {
|
||||
Py::Sequence shapeSeq(pShapes);
|
||||
for (Py::Sequence::iterator it = shapeSeq.begin(); it != shapeSeq.end(); ++it) {
|
||||
PyObject* item = (*it).ptr();
|
||||
|
||||
@@ -4136,14 +4136,18 @@ void Area::toPath(
|
||||
arcPlane = ArcPlaneXY;
|
||||
cmd = "G17";
|
||||
}
|
||||
else if (fabs(dir.Z()) < Precision::Confusion()
|
||||
&& fabs(dir.X()) < Precision::Confusion()) {
|
||||
else if (
|
||||
fabs(dir.Z()) < Precision::Confusion()
|
||||
&& fabs(dir.X()) < Precision::Confusion()
|
||||
) {
|
||||
clockwise = dir.Y() < 0;
|
||||
arcPlane = ArcPlaneZX;
|
||||
cmd = "G18";
|
||||
}
|
||||
else if (fabs(dir.Y()) < Precision::Confusion()
|
||||
&& fabs(dir.Z()) < Precision::Confusion()) {
|
||||
else if (
|
||||
fabs(dir.Y()) < Precision::Confusion()
|
||||
&& fabs(dir.Z()) < Precision::Confusion()
|
||||
) {
|
||||
clockwise = dir.X() < 0;
|
||||
arcPlane = ArcPlaneYZ;
|
||||
cmd = "G19";
|
||||
|
||||
@@ -327,7 +327,9 @@ PyObject* AreaPy::getShape(PyObject* args, PyObject* keywds)
|
||||
PyObject* pcObj = Py_False;
|
||||
short index = -1;
|
||||
static const std::array<const char*, 3> kwlist {"index", "rebuild", nullptr};
|
||||
if (!Base::Wrapped_ParseTupleAndKeywords(args, keywds, "|hO!", kwlist, &index, &PyBool_Type, &pcObj)) {
|
||||
if (
|
||||
!Base::Wrapped_ParseTupleAndKeywords(args, keywds, "|hO!", kwlist, &index, &PyBool_Type, &pcObj)
|
||||
) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -373,8 +375,9 @@ PyObject* AreaPy::add(PyObject* args, PyObject* keywds)
|
||||
Py_INCREF(this);
|
||||
return this;
|
||||
}
|
||||
else if (PyObject_TypeCheck(pcObj, &(PyList_Type))
|
||||
|| PyObject_TypeCheck(pcObj, &(PyTuple_Type))) {
|
||||
else if (
|
||||
PyObject_TypeCheck(pcObj, &(PyList_Type)) || PyObject_TypeCheck(pcObj, &(PyTuple_Type))
|
||||
) {
|
||||
Py::Sequence shapeSeq(pcObj);
|
||||
for (Py::Sequence::iterator it = shapeSeq.begin(); it != shapeSeq.end(); ++it) {
|
||||
PyObject* item = (*it).ptr();
|
||||
@@ -499,8 +502,10 @@ PyObject* AreaPy::makeSections(PyObject* args, PyObject* keywds)
|
||||
if (PyObject_TypeCheck(heights, &(PyFloat_Type))) {
|
||||
h.push_back(PyFloat_AsDouble(heights));
|
||||
}
|
||||
else if (PyObject_TypeCheck(heights, &(PyList_Type))
|
||||
|| PyObject_TypeCheck(heights, &(PyTuple_Type))) {
|
||||
else if (
|
||||
PyObject_TypeCheck(heights, &(PyList_Type))
|
||||
|| PyObject_TypeCheck(heights, &(PyTuple_Type))
|
||||
) {
|
||||
Py::Sequence shapeSeq(heights);
|
||||
h.reserve(shapeSeq.size());
|
||||
for (Py::Sequence::iterator it = shapeSeq.begin(); it != shapeSeq.end(); ++it) {
|
||||
|
||||
@@ -328,9 +328,11 @@ void PathSegmentWalker::walk(PathSegmentVisitor& cb, const Base::Vector3d& start
|
||||
// relative mode
|
||||
absolutecenter = false;
|
||||
}
|
||||
else if ((name == "G73") || (name == "G74") || (name == "G81") || (name == "G82")
|
||||
|| (name == "G83") || (name == "G84") || (name == "G85") || (name == "G86")
|
||||
|| (name == "G89")) {
|
||||
else if (
|
||||
(name == "G73") || (name == "G74") || (name == "G81") || (name == "G82")
|
||||
|| (name == "G83") || (name == "G84") || (name == "G85") || (name == "G86")
|
||||
|| (name == "G89")
|
||||
) {
|
||||
// drill,tap,bore
|
||||
|
||||
// Check for RetractMode annotation (G98 or G99)
|
||||
|
||||
@@ -28,7 +28,6 @@ import Path
|
||||
from CAMTests import PathTestUtils
|
||||
from Path.Post.scripts import centroid_legacy_post as postprocessor
|
||||
|
||||
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ import Path
|
||||
import CAMTests.PathTestUtils as PathTestUtils
|
||||
from Path.Post.Processor import PostProcessorFactory
|
||||
|
||||
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ import CAMTests.PathTestUtils as PathTestUtils
|
||||
from Path.Post.Processor import PostProcessorFactory
|
||||
import Path.Dressup.Utils as PathDressup
|
||||
|
||||
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ from CAMTests import PathTestUtils
|
||||
from CAMTests import PostTestMocks
|
||||
from Path.Post.Processor import PostProcessorFactory
|
||||
|
||||
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ import CAMTests.PathTestUtils as PathTestUtils
|
||||
import CAMTests.PostTestMocks as PostTestMocks
|
||||
from Path.Post.Processor import PostProcessorFactory
|
||||
|
||||
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ import CAMTests.PathTestUtils as PathTestUtils
|
||||
import CAMTests.PostTestMocks as PostTestMocks
|
||||
from Path.Post.Processor import PostProcessorFactory
|
||||
|
||||
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import CAMTests.PathTestUtils as PathTestUtils
|
||||
from importlib import reload
|
||||
from Path.Post.scripts import grbl_legacy_post as postprocessor
|
||||
|
||||
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ import Path
|
||||
import CAMTests.PathTestUtils as PathTestUtils
|
||||
from Path.Post.Processor import PostProcessorFactory
|
||||
|
||||
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ import CAMTests.PostTestMocks as PostTestMocks
|
||||
from Path.Post.Processor import PostProcessorFactory
|
||||
from Machine.models.machine import Machine, Toolhead, ToolheadType
|
||||
|
||||
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ import Path
|
||||
import CAMTests.PathTestUtils as PathTestUtils
|
||||
from Path.Post.scripts import mach3_mach4_legacy_post as postprocessor
|
||||
|
||||
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ import Path
|
||||
import CAMTests.PathTestUtils as PathTestUtils
|
||||
from Path.Post.Processor import PostProcessorFactory
|
||||
|
||||
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ import Path
|
||||
import CAMTests.PathTestUtils as PathTestUtils
|
||||
from Path.Post.Processor import PostProcessorFactory
|
||||
|
||||
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import Path
|
||||
import Path.Base.Drillable as Drillable
|
||||
import CAMTests.PathTestUtils as PathTestUtils
|
||||
|
||||
|
||||
if False:
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
|
||||
@@ -28,7 +28,6 @@ import Path.Base.Language as PathLanguage
|
||||
import CAMTests.PathTestUtils as PathTestUtils
|
||||
import math
|
||||
|
||||
|
||||
# Path.Log.setLevel(Path.Log.Level.DEBUG)
|
||||
Path.Log.setLevel(Path.Log.Level.NOTICE)
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ import Path
|
||||
import Path.Base.Generator.helix as generator
|
||||
import CAMTests.PathTestUtils as PathTestUtils
|
||||
|
||||
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class TestPathOpDeburr(PathTestUtils.PathTestBase):
|
||||
tool.FlatRadius = 0
|
||||
tool.CuttingEdgeAngle = 180
|
||||
|
||||
(depth, offset, __, info) = PathDeburr.toolDepthAndOffset(1, 0.01, tool, True)
|
||||
depth, offset, __, info = PathDeburr.toolDepthAndOffset(1, 0.01, tool, True)
|
||||
self.assertRoughly(0.01, depth)
|
||||
self.assertRoughly(9, offset)
|
||||
self.assertFalse(info)
|
||||
@@ -52,7 +52,7 @@ class TestPathOpDeburr(PathTestUtils.PathTestBase):
|
||||
# legacy tools - no problem, same result
|
||||
tool.CuttingEdgeAngle = 0
|
||||
|
||||
(depth, offset, __, info) = PathDeburr.toolDepthAndOffset(1, 0.01, tool, True)
|
||||
depth, offset, __, info = PathDeburr.toolDepthAndOffset(1, 0.01, tool, True)
|
||||
self.assertRoughly(0.01, depth)
|
||||
self.assertRoughly(9, offset)
|
||||
self.assertFalse(info)
|
||||
@@ -63,12 +63,12 @@ class TestPathOpDeburr(PathTestUtils.PathTestBase):
|
||||
tool.FlatRadius = 0
|
||||
tool.CuttingEdgeAngle = 90
|
||||
|
||||
(depth, offset, __, info) = PathDeburr.toolDepthAndOffset(1, 0, tool, True)
|
||||
depth, offset, __, info = PathDeburr.toolDepthAndOffset(1, 0, tool, True)
|
||||
self.assertRoughly(1, depth)
|
||||
self.assertRoughly(0, offset)
|
||||
self.assertFalse(info)
|
||||
|
||||
(depth, offset, __, info) = PathDeburr.toolDepthAndOffset(1, 0.2, tool, True)
|
||||
depth, offset, __, info = PathDeburr.toolDepthAndOffset(1, 0.2, tool, True)
|
||||
self.assertRoughly(1.2, depth)
|
||||
self.assertRoughly(0.2, offset)
|
||||
self.assertFalse(info)
|
||||
@@ -79,12 +79,12 @@ class TestPathOpDeburr(PathTestUtils.PathTestBase):
|
||||
tool.FlatRadius = 0.3
|
||||
tool.CuttingEdgeAngle = 90
|
||||
|
||||
(depth, offset, __, info) = PathDeburr.toolDepthAndOffset(1, 0, tool, True)
|
||||
depth, offset, __, info = PathDeburr.toolDepthAndOffset(1, 0, tool, True)
|
||||
self.assertRoughly(1, depth)
|
||||
self.assertRoughly(0.3, offset)
|
||||
self.assertFalse(info)
|
||||
|
||||
(depth, offset, __, info) = PathDeburr.toolDepthAndOffset(2, 0.2, tool, True)
|
||||
depth, offset, __, info = PathDeburr.toolDepthAndOffset(2, 0.2, tool, True)
|
||||
self.assertRoughly(2.2, depth)
|
||||
self.assertRoughly(0.5, offset)
|
||||
self.assertFalse(info)
|
||||
@@ -95,12 +95,12 @@ class TestPathOpDeburr(PathTestUtils.PathTestBase):
|
||||
tool.FlatRadius = 0.1
|
||||
tool.CuttingEdgeAngle = 60
|
||||
|
||||
(depth, offset, __, info) = PathDeburr.toolDepthAndOffset(1, 0.5, tool, True)
|
||||
depth, offset, __, info = PathDeburr.toolDepthAndOffset(1, 0.5, tool, True)
|
||||
self.assertRoughly(2.232051, depth)
|
||||
self.assertRoughly(0.388675, offset)
|
||||
self.assertFalse(info)
|
||||
|
||||
(depth, offset, __, info) = PathDeburr.toolDepthAndOffset(3, 1, tool, True)
|
||||
depth, offset, __, info = PathDeburr.toolDepthAndOffset(3, 1, tool, True)
|
||||
self.assertRoughly(6.196153, depth)
|
||||
self.assertRoughly(0.677350, offset)
|
||||
self.assertFalse(info)
|
||||
@@ -111,12 +111,12 @@ class TestPathOpDeburr(PathTestUtils.PathTestBase):
|
||||
tool.FlatRadius = 0.1
|
||||
tool.CuttingEdgeAngle = 30
|
||||
|
||||
(depth, offset, __, info) = PathDeburr.toolDepthAndOffset(1, 0.5, tool, True)
|
||||
depth, offset, __, info = PathDeburr.toolDepthAndOffset(1, 0.5, tool, True)
|
||||
self.assertRoughly(4.232051, depth)
|
||||
self.assertRoughly(0.233975, offset)
|
||||
self.assertFalse(info)
|
||||
|
||||
(depth, offset, __, info) = PathDeburr.toolDepthAndOffset(3, 1, tool, True)
|
||||
depth, offset, __, info = PathDeburr.toolDepthAndOffset(3, 1, tool, True)
|
||||
self.assertRoughly(12.196155, depth)
|
||||
self.assertRoughly(0.367949, offset)
|
||||
self.assertFalse(info)
|
||||
@@ -129,15 +129,15 @@ class TestPathOpDeburr(PathTestUtils.PathTestBase):
|
||||
self.Diameter = dia
|
||||
|
||||
tool = FakeEndmill(10)
|
||||
(depth, offset, __, info) = PathDeburr.toolDepthAndOffset(1, 0.1, tool, True)
|
||||
depth, offset, __, info = PathDeburr.toolDepthAndOffset(1, 0.1, tool, True)
|
||||
self.assertRoughly(0.1, depth)
|
||||
self.assertRoughly(4, offset)
|
||||
self.assertTrue(info)
|
||||
(depth, offset, __, info) = PathDeburr.toolDepthAndOffset(1, 0.1, tool, not info)
|
||||
depth, offset, __, info = PathDeburr.toolDepthAndOffset(1, 0.1, tool, not info)
|
||||
self.assertRoughly(0.1, depth)
|
||||
self.assertRoughly(4, offset)
|
||||
self.assertTrue(info)
|
||||
(depth, offset, __, info) = PathDeburr.toolDepthAndOffset(1, 0.1, tool, not info)
|
||||
depth, offset, __, info = PathDeburr.toolDepthAndOffset(1, 0.1, tool, not info)
|
||||
self.assertRoughly(0.1, depth)
|
||||
self.assertRoughly(4, offset)
|
||||
self.assertTrue(info)
|
||||
@@ -151,15 +151,15 @@ class TestPathOpDeburr(PathTestUtils.PathTestBase):
|
||||
self.CuttingEdgeAngle = angle
|
||||
|
||||
tool = FakePointyBit(10, 90)
|
||||
(depth, offset, __, info) = PathDeburr.toolDepthAndOffset(1, 0.1, tool, True)
|
||||
depth, offset, __, info = PathDeburr.toolDepthAndOffset(1, 0.1, tool, True)
|
||||
self.assertRoughly(1.1, depth)
|
||||
self.assertRoughly(0.1, offset)
|
||||
self.assertTrue(info)
|
||||
(depth, offset, __, info) = PathDeburr.toolDepthAndOffset(1, 0.1, tool, not info)
|
||||
depth, offset, __, info = PathDeburr.toolDepthAndOffset(1, 0.1, tool, not info)
|
||||
self.assertRoughly(1.1, depth)
|
||||
self.assertRoughly(0.1, offset)
|
||||
self.assertTrue(info)
|
||||
(depth, offset, __, info) = PathDeburr.toolDepthAndOffset(1, 0.1, tool, not info)
|
||||
depth, offset, __, info = PathDeburr.toolDepthAndOffset(1, 0.1, tool, not info)
|
||||
self.assertRoughly(1.1, depth)
|
||||
self.assertRoughly(0.1, offset)
|
||||
self.assertTrue(info)
|
||||
|
||||
@@ -31,7 +31,6 @@ from Path.Tool.library import Library
|
||||
from Path.Tool.shape import ToolBitShapeBullnose
|
||||
from Path.Tool.toolbit import ToolBitEndmill, ToolBitBullnose
|
||||
|
||||
|
||||
TOOL_DIR = pathlib.Path(os.path.realpath(__file__)).parent.parent / "Tools"
|
||||
SHAPE_DIR = TOOL_DIR / "Shape"
|
||||
BIT_DIR = TOOL_DIR / "Bit"
|
||||
|
||||
@@ -6,7 +6,6 @@ from unittest.mock import patch, MagicMock, call
|
||||
from Path.Tool.shape import doc
|
||||
import os
|
||||
|
||||
|
||||
mock_freecad = MagicMock(Name="FreeCAD_Mock")
|
||||
mock_freecad.Console = MagicMock()
|
||||
mock_freecad.Console.PrintWarning = MagicMock()
|
||||
|
||||
@@ -28,7 +28,6 @@ import Path
|
||||
import CAMTests.PathTestUtils as PathTestUtils
|
||||
from Path.Post.Processor import PostProcessorFactory
|
||||
|
||||
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ import Path
|
||||
import CAMTests.PathTestUtils as PathTestUtils
|
||||
from Path.Post.Processor import PostProcessorFactory
|
||||
|
||||
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ from typing import Dict, Any, List, Optional, Tuple, Callable
|
||||
from collections import namedtuple
|
||||
from enum import Enum
|
||||
|
||||
|
||||
if False:
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
################################################################################
|
||||
|
||||
"""Machine editor package."""
|
||||
|
||||
from .machine_editor import MachineEditorDialog
|
||||
|
||||
__all__ = ["MachineEditorDialog"]
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
"""
|
||||
Helper module for managing postprocessor properties in the machine editor.
|
||||
"""
|
||||
|
||||
from PySide import QtGui
|
||||
from typing import Dict, Any
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ import Path.Base.PropertyBag as PathPropertyBag
|
||||
import Path.Base.Util as PathUtil
|
||||
import re
|
||||
|
||||
|
||||
__title__ = "Property Bag Editor"
|
||||
__author__ = "sliptonic (Brad Collette)"
|
||||
__url__ = "https://www.freecad.org"
|
||||
|
||||
@@ -29,7 +29,6 @@ import Path
|
||||
import Path.Dressup.Utils as PathDressup
|
||||
import math
|
||||
|
||||
|
||||
# lazily loaded modules
|
||||
from lazy_loader.lazy_loader import LazyLoader
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ import Path.Dressup.Tags as PathDressupTag
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
import Path.Dressup.Utils as PathDressup
|
||||
|
||||
|
||||
if False:
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
|
||||
@@ -31,7 +31,6 @@ import PathScripts.PathUtils as PathUtils
|
||||
import copy
|
||||
import math
|
||||
|
||||
|
||||
# lazily loaded modules
|
||||
from lazy_loader.lazy_loader import LazyLoader
|
||||
|
||||
@@ -661,7 +660,7 @@ class PathData:
|
||||
self.baseWire = self.findBottomWire(self.edges)
|
||||
|
||||
def findBottomWire(self, edges):
|
||||
(minZ, maxZ) = self.findZLimits(edges)
|
||||
minZ, maxZ = self.findZLimits(edges)
|
||||
self.minZ = minZ
|
||||
self.maxZ = maxZ
|
||||
bottom = [
|
||||
@@ -717,7 +716,7 @@ class PathData:
|
||||
R = radius if radius else self.defaultTagRadius()
|
||||
|
||||
# start assigning tags on the longest segment
|
||||
(shortestEdge, longestEdge) = self.shortestAndLongestPathEdge()
|
||||
shortestEdge, longestEdge = self.shortestAndLongestPathEdge()
|
||||
startIndex = 0
|
||||
for i in range(0, len(self.baseWire.Edges)):
|
||||
edge = self.baseWire.Edges[i]
|
||||
@@ -758,12 +757,12 @@ class PathData:
|
||||
|
||||
for i in range(startIndex + 1, len(self.baseWire.Edges)):
|
||||
edge = self.baseWire.Edges[i]
|
||||
(currentLength, lastTagLength) = self.processEdge(
|
||||
currentLength, lastTagLength = self.processEdge(
|
||||
i, edge, currentLength, lastTagLength, tagDistance, minLength, edgeDict
|
||||
)
|
||||
for i in range(0, startIndex):
|
||||
edge = self.baseWire.Edges[i]
|
||||
(currentLength, lastTagLength) = self.processEdge(
|
||||
currentLength, lastTagLength = self.processEdge(
|
||||
i, edge, currentLength, lastTagLength, tagDistance, minLength, edgeDict
|
||||
)
|
||||
|
||||
|
||||
@@ -1346,7 +1346,7 @@ class TaskPanel:
|
||||
Draft.rotate(sel.Object, angle, sel.Object.Shape.BoundBox.Center, axis)
|
||||
|
||||
def alignSetOrigin(self):
|
||||
(obj, by) = self.alignMoveToOrigin()
|
||||
obj, by = self.alignMoveToOrigin()
|
||||
|
||||
for base in self.obj.Model.Group:
|
||||
if base != obj:
|
||||
|
||||
@@ -32,7 +32,6 @@ import Path.Main.Stock as PathStock
|
||||
import json
|
||||
import os
|
||||
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
if False:
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user