PATH:Tooledit:support for units
connected units to ToolEdit and listview in the tooltable library
This commit is contained in:
parent
1d2c392738
commit
605d4da85f
|
@ -31,7 +31,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>334</width>
|
||||
<height>318</height>
|
||||
<height>313</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="icon">
|
||||
|
@ -66,19 +66,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QDoubleSpinBox" name="stepDown">
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
|
@ -93,6 +80,19 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QDoubleSpinBox" name="stepDown">
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="Heights">
|
||||
|
@ -101,7 +101,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>334</width>
|
||||
<height>318</height>
|
||||
<height>313</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="icon">
|
||||
|
@ -151,7 +151,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>334</width>
|
||||
<height>318</height>
|
||||
<height>313</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
|
@ -209,7 +209,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>334</width>
|
||||
<height>318</height>
|
||||
<height>313</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="icon">
|
||||
|
|
|
@ -212,7 +212,7 @@
|
|||
<item row="6" column="1">
|
||||
<widget class="Gui::InputField" name="DiameterField">
|
||||
<property name="text">
|
||||
<string>12.7 mm</string>
|
||||
<string>0 mm</string>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.125000000000000</double>
|
||||
|
@ -231,7 +231,7 @@
|
|||
<item row="8" column="1">
|
||||
<widget class="Gui::InputField" name="LengthOffsetField">
|
||||
<property name="text">
|
||||
<string>25.4 mm</string>
|
||||
<string>0 mm</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>100.000000000000000</double>
|
||||
|
@ -247,7 +247,7 @@
|
|||
<item row="12" column="1">
|
||||
<widget class="Gui::InputField" name="FlatRadiusField">
|
||||
<property name="text">
|
||||
<string>0.00 mm</string>
|
||||
<string>0 mm</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>100.000000000000000</double>
|
||||
|
@ -263,7 +263,7 @@
|
|||
<item row="14" column="1">
|
||||
<widget class="Gui::InputField" name="CornerRadiusField">
|
||||
<property name="text">
|
||||
<string>0.00 mm</string>
|
||||
<string>0 mm</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>100.000000000000000</double>
|
||||
|
@ -272,14 +272,14 @@
|
|||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true"/>
|
||||
<string notr="true">mm</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="18" column="1">
|
||||
<widget class="Gui::InputField" name="CuttingEdgeHeightField">
|
||||
<property name="text">
|
||||
<string>25.4 mm</string>
|
||||
<string>0 mm</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>100.000000000000000</double>
|
||||
|
|
|
@ -190,6 +190,33 @@ class ToolLibraryManager():
|
|||
headers = ["","Tool Num.","Name","Tool Type","Material","Diameter","Length Offset","Flat Radius","Corner Radius","Cutting Edge Angle","Cutting Edge Height"]
|
||||
model = QtGui.QStandardItemModel()
|
||||
model.setHorizontalHeaderLabels(headers)
|
||||
parms = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Units")
|
||||
digits = parms.GetContents()[1][2] # user's number of digits of precision
|
||||
if parms.GetContents()[0][2]==0:
|
||||
suffix = 'mm'
|
||||
conversion = 1.0
|
||||
elif parms.GetContents()[0][2]==3:
|
||||
suffix = 'in'
|
||||
conversion = 25.4
|
||||
else:
|
||||
suffix = ''
|
||||
|
||||
def unitconv(ivalue):
|
||||
parms = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Units")
|
||||
digits = parms.GetContents()[1][2] #get user's number of digits of precision
|
||||
if parms.GetContents()[0][2]==0:
|
||||
suffix = 'mm'
|
||||
conversion = 1.0
|
||||
elif parms.GetContents()[0][2]==3:
|
||||
suffix = 'in'
|
||||
conversion = 25.4
|
||||
else:
|
||||
suffix = ''
|
||||
val = FreeCAD.Units.parseQuantity(str(round(ivalue/conversion,digits))+suffix)
|
||||
displayed_val = val.UserString #just the displayed value-not the internal one
|
||||
|
||||
return displayed_val
|
||||
|
||||
if tt:
|
||||
if len(tt.Tools) == 0:
|
||||
tooldata.append([])
|
||||
|
@ -201,12 +228,12 @@ class ToolLibraryManager():
|
|||
itemName = QtGui.QStandardItem(t.Name)
|
||||
itemToolType = QtGui.QStandardItem(t.ToolType)
|
||||
itemMaterial = QtGui.QStandardItem(t.Material)
|
||||
itemDiameter = QtGui.QStandardItem(str(t.Diameter))
|
||||
itemLengthOffset = QtGui.QStandardItem(str(t.LengthOffset))
|
||||
itemFlatRadius = QtGui.QStandardItem(str(t.FlatRadius))
|
||||
itmCornerRadius = QtGui.QStandardItem(str(t.CornerRadius))
|
||||
itemDiameter = QtGui.QStandardItem(unitconv(t.Diameter))
|
||||
itemLengthOffset = QtGui.QStandardItem(unitconv(t.LengthOffset))
|
||||
itemFlatRadius = QtGui.QStandardItem(unitconv(t.FlatRadius))
|
||||
itmCornerRadius = QtGui.QStandardItem(unitconv(t.CornerRadius))
|
||||
itemCuttingEdgeAngle = QtGui.QStandardItem(str(t.CuttingEdgeAngle))
|
||||
itemCuttingEdgeHeight = QtGui.QStandardItem(str(t.CuttingEdgeHeight))
|
||||
itemCuttingEdgeHeight = QtGui.QStandardItem(unitconv(t.CuttingEdgeHeight))
|
||||
|
||||
row = [itemcheck, itemNumber, itemName, itemToolType, itemMaterial, itemDiameter, itemLengthOffset, itemFlatRadius, itmCornerRadius, itemCuttingEdgeAngle, itemCuttingEdgeHeight]
|
||||
model.appendRow(row)
|
||||
|
|
Loading…
Reference in New Issue
Block a user