Inventor using iLogic to change model tolerance of hole feature

bill.leonard
Explorer

Inventor using iLogic to change model tolerance of hole feature

bill.leonard
Explorer
Explorer

Moved from original post for clarity:

Using iLogic to change model tolerance

 

I have a problem similar to the one described in the previous post.  I am using the following statements to set the tolerance for a hole feature:

 

Dim ThisHole As HoleFeature
Set ThisHole = oPartDoc.SelectSet.Item(1)
Call ThisHole.HoleDiameter.Tolerance.SetToFits(kLimitsFitsShowSizeTolerance, "P7", "")

 

As the screenshot below shows, everything appears to work OK when I execute the statement.

Tolerance Picture.JPG

The upper/lower limits show as 7.991/7.976, as they should.  However, as the picture below shows, when I dimension the hole on a drawing with the "use tolerance from part" option, the deviations applied to the diameter are off by a factor of 10. 

Drawing Picture.JPG

I assume this is due to Inventor's internal unit being centimeters instead of millimeters, but I can't figure out how to correct the issue in my code, since there is no place to specify units in the parameters.

 

Can anyone help me out with this?

 

(Apologies if I have posted this in an inappropriate location.  I am new to this forum, and am unfamiliar with the proper protocols.)

0 Likes
Reply
Accepted solutions (1)
1,100 Views
4 Replies
Replies (4)

bradeneuropeArthur
Mentor
Mentor
Hi,

Same issue in inventor 2018.
Seems to be a bug....


Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

0 Likes

bradeneuropeArthur
Mentor
Mentor
Accepted solution

This will reset the value by 1 to the default value:

Please try this.

 

Public Sub main()
Dim opartdoc As PartDocument
Set opartdoc = ThisApplication.ActiveDocument

Dim ThisHole As HoleFeature
Set ThisHole = opartdoc.SelectSet.Item(1)

Dim Express As Variant
Express = ThisHole.HoleDiameter.Value 

Dim h As Tolerance
Set h = ThisHole.HoleDiameter.Tolerance
Call h.SetToFits(kLimitsFitsShowSizeTolerance, "P8", "")

'Reset the value......
ThisHole.HoleDiameter.Value = 1

 

'fill in the default value again.......
ThisHole.HoleDiameter.Value = Express
End Sub

 

 

 

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

0 Likes

bill.leonard
Explorer
Explorer

Excellent!  This worked perfectly.

 

My only issue now is the way the hole value displays in the inventor browser.

As the picture below shows, the hole whose tolerance was set by the code (Hole 1) now displays with 8 trailing zeros, whereas holes dimensioned through Inventor (Hole 2 & Hole 3) display with fewer trailing zeros.

 

Browser Picture.JPG

Do you happen to have any thoughts on how this display issue might be corrected?  If not, it's not that big of a deal.  I still really appreciate your solution to the actual problem!

 

0 Likes

bradeneuropeArthur
Mentor
Mentor
Change the precision of the parameter.
I will take a look for you ASAP next week.

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

0 Likes