Rebase and minor adjustments

This commit is contained in:
Roy-043
2025-06-12 22:11:27 +02:00
committed by Yorik van Havre
parent 60753068ec
commit fca41e4003
8 changed files with 73 additions and 180 deletions

View File

@@ -26,7 +26,7 @@
<string>Circular array</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
<item row="0" column="0">
<widget class="QGroupBox" name="main_group">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
@@ -39,13 +39,6 @@
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="label_icon">
<property name="text">
<string notr="true">(Placeholder for the icon)</string>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="grid_values">
<item row="0" column="0">
<widget class="QLabel" name="label_r_distance">
@@ -63,7 +56,7 @@
<string>Distance from one layer of objects to the next layer of objects.</string>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
<string notr="true">mm</string>
</property>
<property name="value">
<double>200.000000000000000</double>
@@ -88,7 +81,7 @@ It cannot be zero.</string>
It cannot be zero.</string>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
<string notr="true">mm</string>
</property>
<property name="value">
<double>100.000000000000000</double>
@@ -133,7 +126,7 @@ It must be at least 2.</string>
</property>
</widget>
</item>
<item row="3" column="1">
<item row="3" column="1">
<widget class="QSpinBox" name="spinbox_symmetry">
<property name="toolTip">
<string>The number of symmetry lines in the circular array.</string>
@@ -148,7 +141,7 @@ It must be at least 2.</string>
</item>
</layout>
</item>
<item row="5" column="0">
<item row="1" column="0">
<widget class="QGroupBox" name="group_center">
<property name="toolTip">
<string>The coordinates of the point through which the axis of rotation passes.
@@ -176,11 +169,11 @@ Change the direction of the axis itself in the property editor.</string>
</sizepolicy>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
<string notr="true">mm</string>
</property>
</widget>
</item>
<item row="1" column="0">
<item row="1" column="0">
<widget class="QLabel" name="label_c_y">
<property name="text">
<string>Y</string>
@@ -196,7 +189,7 @@ Change the direction of the axis itself in the property editor.</string>
</sizepolicy>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
<string notr="true">mm</string>
</property>
</widget>
</item>
@@ -216,7 +209,7 @@ Change the direction of the axis itself in the property editor.</string>
</sizepolicy>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
<string notr="true">mm</string>
</property>
</widget>
</item>
@@ -235,7 +228,7 @@ Change the direction of the axis itself in the property editor.</string>
</layout>
</widget>
</item>
<item row="6" column="0">
<item row="2" column="0">
<layout class="QVBoxLayout" name="vertical_layout">
<item>
<widget class="QCheckBox" name="checkbox_fuse">
@@ -264,7 +257,7 @@ A Link array is more efficient when creating multiple copies, but it cannot be f
</item>
</layout>
</item>
<item row="9" column="0">
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>

View File

@@ -26,7 +26,7 @@
<string>Orthogonal array</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
<item row="0" column="0">
<widget class="QGroupBox" name="main_group">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
@@ -183,7 +183,7 @@ The number must be at least 1 in each direction.</string>
</layout>
</widget>
</item>
<item row="4" column="0">
<item row="3" column="0">
<widget class="QGroupBox" name="group_X">
<property name="toolTip">
<string>Distance between the elements in the X direction.
@@ -212,7 +212,7 @@ Negative values will result in copies produced in the negative direction.</strin
</sizepolicy>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
<string notr="true">mm</string>
</property>
<property name="quantity" stdset="0">
<double>100.000000000000000</double>
@@ -226,7 +226,7 @@ Negative values will result in copies produced in the negative direction.</strin
</property>
</widget>
</item>
<item row="1" column="1">
<item row="1" column="1">
<widget class="Gui::InputField" name="input_X_y">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -235,7 +235,7 @@ Negative values will result in copies produced in the negative direction.</strin
</sizepolicy>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
<string notr="true">mm</string>
</property>
</widget>
</item>
@@ -255,7 +255,7 @@ Negative values will result in copies produced in the negative direction.</strin
</sizepolicy>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
<string notr="true">mm</string>
</property>
</widget>
</item>
@@ -274,7 +274,7 @@ Negative values will result in copies produced in the negative direction.</strin
</layout>
</widget>
</item>
<item row="5" column="0">
<item row="4" column="0">
<widget class="QGroupBox" name="group_Y">
<property name="toolTip">
<string>Distance between the elements in the Y direction.
@@ -303,7 +303,7 @@ Negative values will result in copies produced in the negative direction.</strin
</sizepolicy>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
<string notr="true">mm</string>
</property>
</widget>
</item>
@@ -323,7 +323,7 @@ Negative values will result in copies produced in the negative direction.</strin
</sizepolicy>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
<string notr="true">mm</string>
</property>
<property name="quantity" stdset="0">
<double>100.000000000000000</double>
@@ -346,7 +346,7 @@ Negative values will result in copies produced in the negative direction.</strin
</sizepolicy>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
<string notr="true">mm</string>
</property>
</widget>
</item>
@@ -365,7 +365,7 @@ Negative values will result in copies produced in the negative direction.</strin
</layout>
</widget>
</item>
<item row="6" column="0">
<item row="5" column="0">
<widget class="QGroupBox" name="group_Z">
<property name="toolTip">
<string>Distance between the elements in the Z direction.
@@ -394,7 +394,7 @@ Negative values will result in copies produced in the negative direction.</strin
</sizepolicy>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
<string notr="true">mm</string>
</property>
</widget>
</item>
@@ -414,7 +414,7 @@ Negative values will result in copies produced in the negative direction.</strin
</sizepolicy>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
<string notr="true">mm</string>
</property>
</widget>
</item>
@@ -434,7 +434,7 @@ Negative values will result in copies produced in the negative direction.</strin
</sizepolicy>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
<string notr="true">mm</string>
</property>
<property name="quantity" stdset="0">
<double>100.000000000000000</double>
@@ -456,7 +456,7 @@ Negative values will result in copies produced in the negative direction.</strin
</layout>
</widget>
</item>
<item row="8" column="0">
<item row="6" column="0">
<layout class="QVBoxLayout" name="vertical_layout">
<item>
<widget class="QCheckBox" name="checkbox_fuse">
@@ -485,7 +485,7 @@ A Link array is more efficient when creating multiple copies, but it cannot be f
</item>
</layout>
</item>
<item row="11" column="0">
<item row="7" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>

View File

@@ -26,7 +26,7 @@
<string>Polar array</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
<item row="0" column="0">
<widget class="QGroupBox" name="main_group">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
@@ -39,13 +39,6 @@
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="label_icon">
<property name="text">
<string notr="true">(Placeholder for the icon)</string>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="grid_values">
<item row="0" column="0">
<widget class="QLabel" name="label_angle">
@@ -67,7 +60,7 @@ A negative angle produces a polar pattern in the opposite direction.
The maximum absolute value is 360 degrees.</string>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
<string notr="true">°</string>
</property>
<property name="minimum">
<double>-360.000000000000000</double>
@@ -110,7 +103,7 @@ It must be at least 2.</string>
</item>
</layout>
</item>
<item row="5" column="0">
<item row="1" column="0">
<widget class="QGroupBox" name="group_center">
<property name="toolTip">
<string>The coordinates of the point through which the axis of rotation passes.
@@ -138,7 +131,7 @@ Change the direction of the axis itself in the property editor.</string>
</sizepolicy>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
<string notr="true">mm</string>
</property>
</widget>
</item>
@@ -149,7 +142,7 @@ Change the direction of the axis itself in the property editor.</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="1" column="1">
<widget class="Gui::InputField" name="input_c_y">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -158,7 +151,7 @@ Change the direction of the axis itself in the property editor.</string>
</sizepolicy>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
<string notr="true">mm</string>
</property>
</widget>
</item>
@@ -178,7 +171,7 @@ Change the direction of the axis itself in the property editor.</string>
</sizepolicy>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
<string notr="true">mm</string>
</property>
</widget>
</item>
@@ -197,7 +190,7 @@ Change the direction of the axis itself in the property editor.</string>
</layout>
</widget>
</item>
<item row="6" column="0">
<item row="2" column="0">
<layout class="QVBoxLayout" name="vertical_layout">
<item>
<widget class="QCheckBox" name="checkbox_fuse">
@@ -226,7 +219,7 @@ A Link array is more efficient when creating multiple copies, but it cannot be f
</item>
</layout>
</item>
<item row="9" column="0">
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>

View File

@@ -53,7 +53,7 @@
<string>Enter coordinates or select point with mouse.</string>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
<string notr="true">mm</string>
</property>
</widget>
</item>
@@ -70,7 +70,7 @@
<string>Enter coordinates or select point with mouse.</string>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
<string notr="true">mm</string>
</property>
</widget>
</item>
@@ -87,7 +87,7 @@
<string>Enter coordinates or select point with mouse.</string>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
<string notr="true">mm</string>
</property>
</widget>
</item>
@@ -128,7 +128,7 @@ Uncheck to use working plane coordinate system</string>
<string>Height of the result</string>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
<string notr="true">mm</string>
</property>
<property name="minimum">
<double>0.000000000000000</double>

View File

@@ -78,66 +78,31 @@ class TaskPanelCircularArray:
"""
def __init__(self):
self.name = "Circular array"
_log(translate("draft","Task panel:") + " {}".format(translate("draft","Circular array")))
# The .ui file must be loaded into an attribute
# called `self.form` so that it is displayed in the task panel.
ui_file = ":/ui/TaskPanel_CircularArray.ui"
self.form = Gui.PySideUic.loadUi(ui_file)
icon_name = "Draft_CircularArray"
svg = ":/icons/" + icon_name
pix = QtGui.QPixmap(svg)
icon = QtGui.QIcon.fromTheme(icon_name, QtGui.QIcon(svg))
self.form.setWindowIcon(icon)
self.form.setWindowTitle(translate("draft","Circular array"))
self.form.label_icon.setPixmap(pix.scaled(32, 32))
self.form = Gui.PySideUic.loadUi(":/ui/TaskPanel_CircularArray.ui")
self.form.setWindowTitle(translate("draft", "Circular array"))
self.form.setWindowIcon(QtGui.QIcon(":/icons/Draft_CircularArray.svg"))
# -------------------------------------------------------------------
# Default values for the internal function,
# and for the task panel interface
start_distance = U.Quantity(50.0, App.Units.Length)
length_unit = start_distance.getUserPreferred()[2]
self.r_distance = 2 * start_distance.Value
self.tan_distance = start_distance.Value
self.form.spinbox_r_distance.setProperty('rawValue',
self.r_distance)
self.form.spinbox_r_distance.setProperty('unit', length_unit)
self.form.spinbox_tan_distance.setProperty('rawValue',
self.tan_distance)
self.form.spinbox_tan_distance.setProperty('unit', length_unit)
self.number = 3
self.symmetry = 1
self.form.spinbox_number.setValue(self.number)
self.form.spinbox_symmetry.setValue(self.symmetry)
# Default values for the internal function, and for the task panel interface
self.center = App.Vector()
# TODO: the axis is currently fixed, it should be editable
# or selectable from the task panel
self.axis = App.Vector(0, 0, 1)
start_point = U.Quantity(0.0, App.Units.Length)
length_unit = start_point.getUserPreferred()[2]
self.center = App.Vector(start_point.Value,
start_point.Value,
start_point.Value)
self.form.input_c_x.setProperty('rawValue', self.center.x)
self.form.input_c_x.setProperty('unit', length_unit)
self.form.input_c_y.setProperty('rawValue', self.center.y)
self.form.input_c_y.setProperty('unit', length_unit)
self.form.input_c_z.setProperty('rawValue', self.center.z)
self.form.input_c_z.setProperty('unit', length_unit)
self.r_distance = 100
self.tan_distance = 50
self.number = 3
self.symmetry = 1
self.fuse = params.get_param("Draft_array_fuse")
self.use_link = params.get_param("Draft_array_Link")
self.form.input_c_x.setProperty('rawValue', self.center.x)
self.form.input_c_y.setProperty('rawValue', self.center.y)
self.form.input_c_z.setProperty('rawValue', self.center.z)
self.form.spinbox_r_distance.setProperty('rawValue', self.r_distance)
self.form.spinbox_tan_distance.setProperty('rawValue', self.tan_distance)
self.form.spinbox_number.setValue(self.number)
self.form.spinbox_symmetry.setValue(self.symmetry)
self.form.checkbox_fuse.setChecked(self.fuse)
self.form.checkbox_link.setChecked(self.use_link)
# -------------------------------------------------------------------

View File

@@ -78,20 +78,10 @@ class TaskPanelOrthoArray:
"""
def __init__(self):
self.name = "Orthogonal array"
_log(translate("draft","Task panel:") + " {}".format(translate("draft","Orthogonal array")))
# The .ui file must be loaded into an attribute
# called `self.form` so that it is displayed in the task panel.
ui_file = ":/ui/TaskPanel_OrthoArray.ui"
self.form = Gui.PySideUic.loadUi(ui_file)
icon_name = "Draft_Array"
svg = ":/icons/" + icon_name
pix = QtGui.QPixmap(svg)
icon = QtGui.QIcon.fromTheme(icon_name, QtGui.QIcon(svg))
self.form.setWindowIcon(icon)
self.form.setWindowTitle(translate("draft","Orthogonal array"))
self.form = Gui.PySideUic.loadUi(":/ui/TaskPanel_OrthoArray.ui")
self.form.setWindowTitle(translate("draft", "Orthogonal array"))
self.form.setWindowIcon(QtGui.QIcon(":/icons/Draft_Array.svg"))
# -------------------------------------------------------------------
# Default values for the internal function,
@@ -100,32 +90,21 @@ class TaskPanelOrthoArray:
start_y = params.get_param("YInterval", "Mod/Draft/OrthoArrayLinearMode")
start_z = params.get_param("ZInterval", "Mod/Draft/OrthoArrayLinearMode")
length_unit = App.Units.Quantity(0.0, App.Units.Length).getUserPreferred()[2]
self.v_x = App.Vector(start_x, 0, 0)
self.v_y = App.Vector(0, start_y, 0)
self.v_z = App.Vector(0, 0, start_z)
self.form.input_X_x.setProperty('rawValue', self.v_x.x)
self.form.input_X_x.setProperty('unit', length_unit)
self.form.input_X_y.setProperty('rawValue', self.v_x.y)
self.form.input_X_y.setProperty('unit', length_unit)
self.form.input_X_z.setProperty('rawValue', self.v_x.z)
self.form.input_X_z.setProperty('unit', length_unit)
self.form.input_Y_x.setProperty('rawValue', self.v_y.x)
self.form.input_Y_x.setProperty('unit', length_unit)
self.form.input_Y_y.setProperty('rawValue', self.v_y.y)
self.form.input_Y_y.setProperty('unit', length_unit)
self.form.input_Y_z.setProperty('rawValue', self.v_y.z)
self.form.input_Y_z.setProperty('unit', length_unit)
self.form.input_Z_x.setProperty('rawValue', self.v_z.x)
self.form.input_Z_x.setProperty('unit', length_unit)
self.form.input_Z_y.setProperty('rawValue', self.v_z.y)
self.form.input_Z_y.setProperty('unit', length_unit)
self.form.input_Z_z.setProperty('rawValue', self.v_z.z)
self.form.input_Z_z.setProperty('unit', length_unit)
self.n_x = params.get_param("XNumOfElements", "Mod/Draft/OrthoArrayLinearMode")
self.n_y = params.get_param("YNumOfElements", "Mod/Draft/OrthoArrayLinearMode")
@@ -245,8 +224,8 @@ class TaskPanelOrthoArray:
# we should not ever do this but maybe a sanity check here?
if self.linear_mode:
if not (self.form.radiobutton_x_axis.isChecked() or
self.form.radiobutton_y_axis.isChecked() or
if not (self.form.radiobutton_x_axis.isChecked() or
self.form.radiobutton_y_axis.isChecked() or
self.form.radiobutton_z_axis.isChecked()):
_err(translate("draft","In Linear mode, at least one axis must be selected."))
return False
@@ -442,7 +421,7 @@ class TaskPanelOrthoArray:
if self.linear_mode:
self.form.button_linear_mode.setText(translate("draft", "Switch to ortho mode"))
# check radiobutton based on current cfg
self.update_axis_ui()

View File

@@ -78,54 +78,24 @@ class TaskPanelPolarArray:
"""
def __init__(self):
self.name = "Polar array"
_log(translate("draft","Task panel:") + " {}".format(self.name))
# The .ui file must be loaded into an attribute
# called `self.form` so that it is displayed in the task panel.
ui_file = ":/ui/TaskPanel_PolarArray.ui"
self.form = Gui.PySideUic.loadUi(ui_file)
icon_name = "Draft_PolarArray"
svg = ":/icons/" + icon_name
pix = QtGui.QPixmap(svg)
icon = QtGui.QIcon.fromTheme(icon_name, QtGui.QIcon(svg))
self.form.setWindowIcon(icon)
self.form.setWindowTitle(translate("draft","Polar array"))
self.form.label_icon.setPixmap(pix.scaled(32, 32))
self.form = Gui.PySideUic.loadUi(":/ui/TaskPanel_PolarArray.ui")
self.form.setWindowTitle(translate("draft", "Polar array"))
self.form.setWindowIcon(QtGui.QIcon(":/icons/Draft_PolarArray.svg"))
# -------------------------------------------------------------------
# Default values for the internal function,
# and for the task panel interface
start_angle = U.Quantity(360.0, App.Units.Angle)
angle_unit = start_angle.getUserPreferred()[2]
self.angle = start_angle.Value
# Default values for the internal function, and for the task panel interface
self.center = App.Vector()
self.angle = 360
self.number = 5
self.form.spinbox_angle.setProperty('rawValue', self.angle)
self.form.spinbox_angle.setProperty('unit', angle_unit)
self.form.spinbox_number.setValue(self.number)
start_point = U.Quantity(0.0, App.Units.Length)
length_unit = start_point.getUserPreferred()[2]
self.center = App.Vector(start_point.Value,
start_point.Value,
start_point.Value)
self.form.input_c_x.setProperty('rawValue', self.center.x)
self.form.input_c_x.setProperty('unit', length_unit)
self.form.input_c_y.setProperty('rawValue', self.center.y)
self.form.input_c_y.setProperty('unit', length_unit)
self.form.input_c_z.setProperty('rawValue', self.center.z)
self.form.input_c_z.setProperty('unit', length_unit)
self.fuse = params.get_param("Draft_array_fuse")
self.use_link = params.get_param("Draft_array_Link")
self.form.input_c_x.setProperty('rawValue', self.center.x)
self.form.input_c_y.setProperty('rawValue', self.center.y)
self.form.input_c_z.setProperty('rawValue', self.center.z)
self.form.spinbox_angle.setProperty('rawValue', self.angle)
self.form.spinbox_number.setValue(self.number)
self.form.checkbox_fuse.setChecked(self.fuse)
self.form.checkbox_link.setChecked(self.use_link)
# -------------------------------------------------------------------

View File

@@ -51,16 +51,9 @@ class ShapeStringTaskPanel:
def __init__(self, point=None, size=None, string="", font=""):
self.form = Gui.PySideUic.loadUi(":/ui/TaskShapeString.ui")
self.form.setObjectName("ShapeStringTaskPanel")
self.form.setWindowTitle(translate("draft", "ShapeString"))
self.form.setWindowIcon(QtGui.QIcon(":/icons/Draft_ShapeString.svg"))
unit_length = App.Units.Quantity(0.0, App.Units.Length).getUserPreferred()[2]
self.form.sbX.setProperty("unit", unit_length)
self.form.sbY.setProperty("unit", unit_length)
self.form.sbZ.setProperty("unit", unit_length)
self.form.sbHeight.setProperty("unit", unit_length)
self.global_mode = params.get_param("GlobalMode")
self.form.cbGlobalMode.setChecked(self.global_mode)
self.change_coord_labels()