Set DIM Precision depend of Value of Dims

Set DIM Precision depend of Value of Dims

ngdnam88
Advocate Advocate
470 Views
2 Replies
Message 1 of 3

Set DIM Precision depend of Value of Dims

ngdnam88
Advocate
Advocate

Dears,

I'm trying control DIM precision of 2D Drawing by iLogic/VB.NET. Could you please help me done it?

The red stick need to show by rule >500 then precision = 0; <500 then precision = 1.1

ngnam1988_0-1686389498702.pngngnam1988_1-1686389566503.png

This ref. post help me got all dims of drawing: https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/get-dimension-tolerance-value-from-a...

Thank you very much!

0 Likes
Accepted solutions (1)
471 Views
2 Replies
Replies (2)
Message 2 of 3

Alexander_Chernikov
Mentor
Mentor
Accepted solution

Hi, you can try next code in VBA or convert it to iLogic

Public Sub Prec_of_Dim()
  Dim oDoc As DrawingDocument
  Set oDoc = ThisApplication.ActiveDocument
  Dim oSheet As Sheet
  Set oSheet = oDoc.ActiveSheet
  Dim oDrDim As DrawingDimension
  Dim dVal As Double
  Dim i As Long
  dVal = 50 ' value in centimeters!
  For i = 1 To oSheet.DrawingDimensions.Count
    Set oDrDim = oSheet.DrawingDimensions(i)
    If oDrDim.ModelValue < dVal Then oDrDim.Precision = 1
    If oDrDim.ModelValue >= dVal Then oDrDim.Precision = 0
  Next
End Sub

Do you find the posts helpful? "LIKE" these posts! | Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням!
Have your question been answered successfully? Click "ACCEPT SOLUTION" button. | На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ"

Олександр Черніков / Alexander Chernikov

EESignature

Facebook | LinkedIn

.


Message 3 of 3

ngdnam88
Advocate
Advocate

I got it! Thank you very much!

0 Likes