
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, I am working with Inventor 2014 and am very new to programing, I have been making some code to auto output some information so we do not need to enter it manually. One part of the program is to detect if the length of the part is in inches or mm and to record the length appropriately.
How I do this is I measure its length to 5 decimal places in mm ( this is all that is needed, and should prevent any small rounding errors from inventor ) then divide this by 25.4 and times by 16. Essentially if this is a hole number it is inches and if it is not it is mm.
The problem I have is that it seems to work randomly. For example 3.5", 3", 13.0625", 33" all wont work but 3.75", 3.0625", 40", 2.5", 12.5", 12.0625" Will work. If someone could please shed some light on what I am doing wrong, or if they have a work around it would be much appreciated.
Thank you!
Dim xxLength As String
If Round(Measure.ExtentsHeight,5)/25.4*16 = Round(Measure.ExtentsHeight/25.4*16,0) Then
xxLength = RoundToFraction(Measure.ExtentsHeight/25.4, 1/16, RoundingMethod.Round).Replace(" ", "-") & Chr(34)
Else
xxLength = Round(Measure.ExtentsHeight,1) & " mm"
End If
MessageBox.Show(xxLength, "Title")
Solved! Go to Solution.