Skip to content

Commit da4fd28

Browse files
committed
qtvcp -hole_circle: add chord length info
In case you want to hand layout a bolt circle
1 parent 5dd57ea commit da4fd28

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

lib/python/qtvcp/lib/gcode_utility/hole_circle.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,14 @@ def validate(self):
224224
except:
225225
self.valid = False
226226

227+
try:
228+
angle = (180/self.num_holes)
229+
chord_length = (2 * self.radius) * math.sin(math.radians(angle))
230+
self.label_chord_length.setText('{:.3f}'.format(chord_length))
231+
except Exception as e:
232+
print(e)
233+
self.label_chord_length.setText('')
234+
227235
try:
228236
self.first = float(self.lineEdit_first.text())
229237
if self.first < 360.0:

lib/python/qtvcp/lib/gcode_utility/hole_circle.ui

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1189,7 +1189,7 @@
11891189
<property name="alignment">
11901190
<set>Qt::AlignCenter</set>
11911191
</property>
1192-
<layout class="QVBoxLayout" name="layout_gb_preview" stretch="1,0">
1192+
<layout class="QVBoxLayout" name="layout_gb_preview" stretch="1,0,0">
11931193
<property name="spacing">
11941194
<number>4</number>
11951195
</property>
@@ -1215,6 +1215,24 @@
12151215
</property>
12161216
</layout>
12171217
</item>
1218+
<item>
1219+
<layout class="QHBoxLayout" name="horizontalLayout_14">
1220+
<item>
1221+
<widget class="QLabel" name="label_2">
1222+
<property name="text">
1223+
<string>CHORD LENGTH</string>
1224+
</property>
1225+
</widget>
1226+
</item>
1227+
<item>
1228+
<widget class="QLabel" name="label_chord_length">
1229+
<property name="text">
1230+
<string/>
1231+
</property>
1232+
</widget>
1233+
</item>
1234+
</layout>
1235+
</item>
12181236
<item alignment="Qt::AlignBottom">
12191237
<widget class="QWidget" name="widget_macro" native="true">
12201238
<property name="maximumSize">

0 commit comments

Comments
 (0)