Hi All,
First of all, I would like to say Hello and sorry for my bad English. I hope you understand me ...
This is my first steps in Ilogic/VBA in Inventor and you should be patient ...
I have a problem with my Ilogic rule. The rule change tolarance for every hole which have diameter 6 and 8 mm everything works great but when I want prepare a 2D drawings for part , dimensions which tolerance change by rule didn't update. I muust manually open hole window, open tolerance window (the tolerance is changed) and I must click OK button and repeat it for every hole. When I do it, 2D dimensions update...
This is my rule :
Dim oDoc As Document oDoc = ThisApplication.ActiveEditDocument ILO = 0 For Each OTWOR As HoleFeature In oDoc.ComponentDefinition.Features.HoleFeatures If OTWOR.Suppressed = False Then ILO = ILO + 1 If OTWOR.Tapped = True Then b = 0 Else b = 1 Select Case b Case 1 Dim oDef As PartComponentDefinition oDef = oDoc.ComponentDefinition Dim oHole(ILO) As HoleFeature oHole(ILO) = oDef.Features.HoleFeatures.Item(ILO) Dim oDiamParam(ILO) As Parameter oDiamParam(ILO) = oHole(ILO).HoleDiameter Dim srednica1 as Double srednica1 = 8 Dim srednica2 as Double srednica2 = 10 'MessageBox.Show(srednica1, "�rednica 1") Dim oTol(ILO) As Tolerance oTol(ILO) = oDiamParam(ILO).Tolerance Dim aktsrednica As Double aktsrednica = oDiamParam(ILO).Value*10 'MessageBox.Show(aktsrednica, "Aktualna �rednica") aktsr=Round(aktsrednica,0) 'MessageBox.Show(aktsr, "Aktualna �rednica") Select Case aktsr Case 6 If oTol(ILO).ToleranceType() = 31233 Then oTol(ILO).SetToFits(31244,("H8"),("")) InventorVb.DocumentUpdate() Case 8 If oTol(ILO).ToleranceType() = 31233 Then oTol(ILO).SetToFits(31244,("H8"),("")) InventorVb.DocumentUpdate() Case Else InventorVb.DocumentUpdate() End Select InventorVb.DocumentUpdate() Case Else End Select Next OTWOR oDoc.Update() 'MsgBox(NoOfHoles) 'INFORMACJE 'Const kBasicTolerance = 31245 'Const kDefaultTolerance = 31233 'Const kDeviationTolerance = 31236 'Const kLimitLinearTolerance = 31238 'Const kLimitsFitsLinearTolerance = 31242 'Const kLimitsFitsShowSizeTolerance = 31243 'Const kLimitsFitsShowTolerance = 31244 'Const kLimitsFitsStackedTolerance = 31241 'Const kLimitsStackedTolerance = 31237 'Const kMaxTolerance = 31239 'Const kMinTolerance = 31240 'Const kOverrideTolerance = 31234 'Const kReferenceTolerance = 31246 'Const kSymmetricTolerance = 31235
I thinking about my problem and I have idea, but I don't know how to realise it. I think simple way to resolve problem is running by VBA "tolerance window" (as on picture) and autmatic press OK button. I should do that after line :
If oTol(ILO).ToleranceType() = 31233 Then oTol(ILO).SetToFits(31244,("H8"),(""))
Anybody have any idea ?
Best Regards
ralfmj