Anonymous
587 Views, 2 Replies
05-26-2021
06:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
05-26-2021
06:34 AM
Hi.
I have a bit of code that checks dimensions in an idw to find out if they should display to 1 decimal place or rounded depending on their value, e.g. 20.2 displays as 20.2 but 20.0 displays as 20.
Dim oDoc As DrawingDocument = ThisDoc.Document Dim oSheet As Sheet = oDoc.ActiveSheet For Each oDim As DrawingDimension In oSheet.DrawingDimensions If Round(oDim.ModelValue * 10, 1) -Round(oDim.ModelValue * 10, 0) = 0 Then oDim.Precision = 0 Else oDim.Precision = 1 End If Next
I want to add in another check to see if the dimension is <= 499.4 and then, based on the result:
1. If it is above 499.4 it displays rounded (e.g. 499.5 displays as 500).
2. If it is <=499.4 then it follows the previous rule and displays to a precision of either 0 or 1.
This was one of my attempts:
Dim oDoc As DrawingDocument = ThisDoc.Document Dim oSheet As Sheet = oDoc.ActiveSheet For Each oDim As DrawingDimension In oSheet.DrawingDimensions If oDim.ModelValue > 499.4 Then oDim.Precision = 0 Else If Round(oDim.ModelValue * 10, 1) -Round(oDim.ModelValue * 10, 0) = 0 Then oDim.Precision = 0 Else oDim.Precision = 1 End If End If Next
......... but no joy.
Could anybody please advise the best way to do this?
Thanks,
T
Solved! Go to Solution.