Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Set DIM Precision depend of Value of Dims

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
ngnam1988
305 Views, 2 Replies

Set DIM Precision depend of Value of Dims

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!

Tags (3)
2 REPLIES 2
Message 2 of 3

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
ngnam1988
in reply to: ngnam1988

I got it! Thank you very much!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report