-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUC_Tracker.vb
More file actions
131 lines (93 loc) · 5.05 KB
/
Copy pathUC_Tracker.vb
File metadata and controls
131 lines (93 loc) · 5.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
Public Class UC_Tracker
Public Tracker_3D As Boolean = True
Public NumberOfDecimals As Integer = 2
Public ClosedCurve As Boolean = False
Public LengthUnits As SolidEdgeConstants.UnitOfMeasureLengthReadoutConstants
Public NewWay As Boolean = True
Public ObjDoc As SolidEdgeFramework.SolidEdgeDocument
Public Sub New(
Name As String,
_LengthUnits As SolidEdgeConstants.UnitOfMeasureLengthReadoutConstants,
_ObjDoc As SolidEdgeFramework.SolidEdgeDocument)
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
LB_X.Text = "X: "
LB_Y.Text = "Y: "
LB_Z.Text = "Z: "
LengthUnits = _LengthUnits
ObjDoc = _ObjDoc
End Sub
Public Sub UpdateLabel()
If Not Tracker_3D Then LB_Z.Enabled = False
Dim tmpForm = CType(Me.Parent.Parent, Form_VarHandler)
Dim UU As New UtilsUnits(ObjDoc)
If Not IsNothing(tmpForm.Tracker_3D) Then
Dim objXOffset As Double = Nothing
Dim objYOffset As Double = Nothing
Dim objZOffset As Double = Nothing
Dim objXRotation As Double = Nothing
Dim objYRotation As Double = Nothing
Dim objZRotation As Double = Nothing
Dim objRtP As Boolean = Nothing
Dim objZFirstRot As Double = Nothing
tmpForm.Tracker_3D.GetOrientation(objXOffset, objYOffset, objZOffset, objXRotation, objYRotation, objZRotation, objRtP, objZFirstRot)
If NewWay Then
LB_X.Text = "X: " & Math.Round(UU.CadToValue(objXOffset, SolidEdgeFramework.UnitTypeConstants.igUnitDistance), NumberOfDecimals).ToString
LB_Y.Text = "Y: " & Math.Round(UU.CadToValue(objYOffset, SolidEdgeFramework.UnitTypeConstants.igUnitDistance), NumberOfDecimals).ToString
LB_Z.Text = "Z: " & Math.Round(UU.CadToValue(objZOffset, SolidEdgeFramework.UnitTypeConstants.igUnitDistance), NumberOfDecimals).ToString
Else
LB_X.Text = "X: " & Math.Round(UC_Slider.CadToValue(objXOffset, SolidEdgeFramework.UnitTypeConstants.igUnitDistance, LengthUnits), NumberOfDecimals).ToString
LB_Y.Text = "Y: " & Math.Round(UC_Slider.CadToValue(objYOffset, SolidEdgeFramework.UnitTypeConstants.igUnitDistance, LengthUnits), NumberOfDecimals).ToString
LB_Z.Text = "Z: " & Math.Round(UC_Slider.CadToValue(objZOffset, SolidEdgeFramework.UnitTypeConstants.igUnitDistance, LengthUnits), NumberOfDecimals).ToString
End If
ElseIf Not IsNothing(tmpForm.Tracker_2D) Then
Dim objX As Double = Nothing
Dim objY As Double = Nothing
tmpForm.Tracker_2D.GetOrigin(objX, objY)
If NewWay Then
LB_X.Text = "X: " & Math.Round(UU.CadToValue(objX, SolidEdgeFramework.UnitTypeConstants.igUnitDistance), NumberOfDecimals).ToString
LB_Y.Text = "Y: " & Math.Round(UU.CadToValue(objY, SolidEdgeFramework.UnitTypeConstants.igUnitDistance), NumberOfDecimals).ToString
LB_Z.Text = "Z: -----"
Else
LB_X.Text = "X: " & Math.Round(UC_Slider.CadToValue(objX, SolidEdgeFramework.UnitTypeConstants.igUnitDistance, LengthUnits), NumberOfDecimals).ToString
LB_Y.Text = "Y: " & Math.Round(UC_Slider.CadToValue(objY, SolidEdgeFramework.UnitTypeConstants.igUnitDistance, LengthUnits), NumberOfDecimals).ToString
LB_Z.Text = "Z: -----"
End If
End If
End Sub
Private Sub BT_Delete_Click(sender As Object, e As EventArgs) Handles BT_Delete.Click
Dim tmpForm = CType(Me.Parent.Parent, Form_VarHandler)
tmpForm.BT_Tracker.Checked = False
tmpForm.Trace = False
Dim tmpFLP As FlowLayoutPanel = CType(Me.Parent, FlowLayoutPanel)
If tmpFLP.Controls.Contains(Me) Then tmpFLP.Controls.Remove(Me)
End Sub
Private Sub BT_Settings_Click(sender As Object, e As EventArgs) Handles BT_Settings.Click
Try
NumberOfDecimals = InputBox("Set number of decimals",, NumberOfDecimals)
If NumberOfDecimals > 15 Then NumberOfDecimals = 15
If NumberOfDecimals < 0 Then NumberOfDecimals = 0
Catch ex As Exception
Exit Sub
End Try
UpdateLabel()
End Sub
Private Sub CB_Trace_CheckedChanged(sender As Object, e As EventArgs) Handles CB_Trace.CheckedChanged
Dim tmpForm = CType(Me.Parent.Parent, Form_VarHandler)
tmpForm.Trace = CB_Trace.Checked
If CB_Trace.Checked Then
CB_Trace.Image = My.Resources.TraceSelected
Else
CB_Trace.Image = My.Resources.Trace
End If
End Sub
Private Sub CB_Closed_CheckedChanged(sender As Object, e As EventArgs) Handles CB_Closed.CheckedChanged
ClosedCurve = CB_Closed.Checked
If CB_Closed.Checked Then
CB_Closed.Image = My.Resources.Checked
Else
CB_Closed.Image = My.Resources.Unchecked
End If
End Sub
End Class