01-17-2017
12:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
01-17-2017
12:43 AM
Hi, do you want to do the measuring between all workplanes or just some specific ones?
I'm asking because we can either go through all of them (using "For Each") or just through a list of them.
I mean, you can use it like this if the workplanes (or their names) don't change.
In this case I'll use the later option:
Sub Main()
AddMeasurement("Work Plane22", "Work Plane12") ' Left rail and single rail
AddMeasurement("Work Plane23", "Work Plane13") ' Right rail and single rail
AddMeasurement("Work Plane22", "Work Plane20") ' Left rail and double rail
AddMeasurement("Work Plane23", "Work Plane21") ' Right rail and double rail
AddMeasurement("Work Plane13", "Work Plane20") ' Single rail and double rail
Dim HoneyCombMin As Double = 230
Dim MOL As String = vbnullstring
For i = 0 To MyDist.Lenght - 1 'Go through each measurement
If MyDist(i) >= HoneyCombMin Then Continue For
If MOL <> vbnullstring Then MOL = MOL & vbnewline
MOL = MOL & "Value " & i + 1 & " is less than " & HoneyCombMin
Next
If MOL <> vbnullstring Then MsgBox(MOL) 'Show the results (if any)
End Sub
Private MyDist(0) As Double 'Local variable to store the measurements
Private Sub AddMeasurement(WorkPlaneA As String, WorkPlaneB As String)
If Not MyDist(MyDist.Lenght - 1) Is Nothing Then
ReDim Preserve MyDist(MyDist.Lenght)
End If
MyDist(MyDist.Lenght - 1) = Measure.MinimumDistance(WorkPlaneA, WorkPlaneB)
End Sub
We could also add the workplanes' names to an array, so we could use them in the result instead of "value x", so let me know if this is the way you want it to go.
Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
- - - - - - - - - - - - - - -
Regards,
Mike
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods