Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
Just to know if there is a quicker way around getting the X, Y or Z coordinates by passing an argument.
For example, I now have a function like below for getting the max. material thickness for a 'Feature' structure in a given cardinal direction. The Feature structure essentially contains a FaceCollection of Faces that make up 1 machining feature.
Public Function featureThickInDir(ByVal feat As Feature, ByVal dir As Integer) As Double
Dim fthick As Double
Dim thick As Double = 0.01
If dir = 0 Then
For Each oFace In feat.Faces
fthick = oFace.Evaluator.RangeBox.MaxPoint.X - oFace.Evaluator.RangeBox.MinPoint.X
thick = Math.Max(thick, fthick)
Next
ElseIf dir = 1 Then
For Each oFace In feat.Faces
fthick = oFace.Evaluator.RangeBox.MaxPoint.Y - oFace.Evaluator.RangeBox.MinPoint.Y
thick = Math.Max(thick, fthick)
Next
ElseIf dir = 2 Then
For Each oFace In feat.Faces
fthick = oFace.Evaluator.RangeBox.MaxPoint.Z - oFace.Evaluator.RangeBox.MinPoint.Z
thick = Math.Max(thick, fthick)
Next
Else
Debug.Print("Utilities.featureThickInDir: not a valid direction")
End If
Return thick
End Function
In short: is there a way to avoid the if-loop here and pass the 'dir' integer directly to the point?
And also thanks to this forum and especially the tutorials of @BrianEkins that got me started!
Cheers.
Solved! Go to Solution.