Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Form_SelectVariable.vb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Public Class Form_SelectVariable

Public objDoc As SolidEdgeFramework.SolidEdgeDocument
Public Valid As Boolean = False
Public LengthUnits As SolidEdgeConstants.UnitOfMeasureLengthReadoutConstants

Private Sub Form_SelectVariable_Load(sender As Object, e As EventArgs) Handles Me.Load

Expand All @@ -24,6 +25,7 @@ Public Class Form_SelectVariable
For Each item In _FindVars

Dim tmpVar As New VarListItem(item)
tmpVar.LengthUnits = LengthUnits
ListBox_Variables.Items.Add(tmpVar)

Next
Expand Down Expand Up @@ -96,6 +98,7 @@ Public Class VarListItem
Public Property objVariable As Object 'SolidEdgeFramework.variable
'Public Property objDimension As SolidEdgeFrameworkSupport.Dimension
Public Property ExName As String
Public Property LengthUnits As SolidEdgeConstants.UnitOfMeasureLengthReadoutConstants

Public Sub New(objVar As Object) 'SolidEdgeFramework.variable)

Expand All @@ -113,10 +116,14 @@ Public Class VarListItem

Dim UnitType = objVar.UnitsType

Value = UC_Slider.CadToValue(objVar.Value, UnitType).ToString
Value = UC_Slider.CadToValue(objVar.Value, UnitType, LengthUnits).ToString

If UnitType = SolidEdgeFramework.UnitTypeConstants.igUnitDistance Then
Value = Value & " mm"
If LengthUnits = UnitOfMeasureLengthReadoutConstants.seLengthInch Then
Value = Value & " in"
ElseIf LengthUnits = UnitOfMeasureLengthReadoutConstants.seLengthMillimeter Then
Value = Value & " mm"
End If
ElseIf UnitType = SolidEdgeFramework.UnitTypeConstants.igUnitAngle Then
Value = Value & " °"
End If
Expand Down
22 changes: 21 additions & 1 deletion Form_VarHandler.vb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Public Class Form_VarHandler

Dim objApp As SolidEdgeFramework.Application
Public objDoc As SolidEdgeFramework.SolidEdgeDocument
Public LengthUnits As SolidEdgeConstants.UnitOfMeasureLengthReadoutConstants

Public Tracker_3D As SolidEdgePart.CoordinateSystem
Public Tracker_2D As SolidEdgeDraft.BlockOccurrence
Expand All @@ -15,6 +16,7 @@ Public Class Form_VarHandler

Dim tmpForm As New Form_SelectVariable
tmpForm.objDoc = objDoc
tmpForm.LengthUnits = LengthUnits
tmpForm.ShowDialog(Me)

If tmpForm.Valid Then
Expand All @@ -26,6 +28,7 @@ Public Class Form_VarHandler
If tmpSlider2.Valid Then

tmpSlider2.objDoc = objDoc
tmpSlider2.LengthUnits = LengthUnits
tmpSlider2.UpdateDoc = BT_Update.Checked
AddHandler tmpSlider2.LB_value.TextChanged, AddressOf Slider_Click

Expand Down Expand Up @@ -102,6 +105,7 @@ Public Class Form_VarHandler

Try
objDoc = objApp.ActiveDocument
LengthUnits = GetLengthUnits(objDoc)
Catch ex As Exception
MsgBox("A Solid Edge Document must be open", MsgBoxStyle.Critical)
End
Expand Down Expand Up @@ -224,7 +228,7 @@ Public Class Form_VarHandler

Private Sub SetupTracker()

Dim tmpTracker As New UC_Tracker("Tracker")
Dim tmpTracker As New UC_Tracker("Tracker", LengthUnits)
If objDoc.Type = DocumentTypeConstants.igDraftDocument Then tmpTracker.Tracker_3D = False

FLP_Vars.Controls.Add(tmpTracker)
Expand All @@ -249,6 +253,7 @@ Public Class Form_VarHandler
Dim tmpWorkFlow As New Form_WorkFlow
tmpWorkFlow.Variables = tmpVariables
tmpWorkFlow.UpdateDoc = BT_Update.Checked
tmpWorkFlow.LengthUnits = LengthUnits

tmpWorkFlow.ShowDialog(Me)

Expand All @@ -264,6 +269,21 @@ Public Class Form_VarHandler

End Sub

Private Function GetLengthUnits(objDoc As SolidEdgeFramework.SolidEdgeDocument) As SolidEdgeConstants.UnitOfMeasureLengthReadoutConstants
Dim tmpLengthUnits As SolidEdgeConstants.UnitOfMeasureLengthReadoutConstants

Dim UnitsOfMeasure = objDoc.UnitsOfMeasure

For Each UnitOfMeasure As SolidEdgeFramework.UnitOfMeasure In UnitsOfMeasure
If UnitOfMeasure.Type = SolidEdgeConstants.UnitTypeConstants.igUnitDistance Then
tmpLengthUnits = UnitOfMeasure.Units
Exit For
End If
Next

Return tmpLengthUnits
End Function

End Class

Public Class MySR
Expand Down
13 changes: 9 additions & 4 deletions Form_WorkFlow.vb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Public Class Form_WorkFlow

Public Variables As List(Of Object)
Public UpdateDoc As Boolean = False
Public LengthUnits As SolidEdgeConstants.UnitOfMeasureLengthReadoutConstants

Private Sub Add_Event_Click(sender As Object, e As EventArgs) Handles Add_Event.Click

Expand All @@ -29,7 +30,7 @@ Public Class Form_WorkFlow
Dim tmpVariable As New EventVariable
tmpVariable.Check = True
tmpVariable.Name = tmpVar.DisplayName
tmpVariable.Value = Math.Round(UC_Slider.CadToValue(tmpVar.value, tmpVar.UnitsType), 2)
tmpVariable.Value = Math.Round(UC_Slider.CadToValue(tmpVar.value, tmpVar.UnitsType, LengthUnits), 2)
tmpVariable.objVar = tmpVar

list.Add(tmpVariable)
Expand Down Expand Up @@ -117,15 +118,16 @@ Public Class Form_WorkFlow

SetSteps(StepEvent)

For i = 1 To 20
'For i = 1 To 20
For i = 1 To StepEvent.steps

Form_VarHandler.objDoc.Parent.DelayCompute = True

For Each tmpRow As DataGridViewRow In StepEvent.DG_Variables.Rows

Dim tmpVariable As Object = tmpRow.Cells("objVar").Value

tmpVariable.Value += UC_Slider.ValueToCad(tmpRow.Tag, tmpVariable.UnitsType)
tmpVariable.Value += UC_Slider.ValueToCad(tmpRow.Tag, tmpVariable.UnitsType, LengthUnits)

Next

Expand All @@ -146,10 +148,13 @@ Public Class Form_WorkFlow

Private Sub SetSteps(stepEvent As UC_WorkFlowEvent)

Dim tmpSteps = stepEvent.steps

For Each tmpRow As DataGridViewRow In stepEvent.DG_Variables.Rows

Dim tmpVariable As Object = tmpRow.Cells("objVar").Value
Dim stepValue As Double = (CDbl(tmpRow.Cells("Value").Value) - UC_Slider.CadToValue(tmpVariable.Value, tmpVariable.UnitsType)) / 20
'Dim stepValue As Double = (CDbl(tmpRow.Cells("Value").Value) - UC_Slider.CadToValue(tmpVariable.Value, tmpVariable.UnitsType, LengthUnits)) / 20
Dim stepValue As Double = (CDbl(tmpRow.Cells("Value").Value) - UC_Slider.CadToValue(tmpVariable.Value, tmpVariable.UnitsType, LengthUnits)) / tmpSteps

tmpRow.Tag = stepValue

Expand Down
Loading