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: 

Hole tolerance by Ilogic. Problem with update

0 REPLIES 0
Reply
Message 1 of 1
ralfmj
458 Views, 0 Replies

Hole tolerance by Ilogic. Problem with update

Hi All,

 

First of all,  I would like to say Hello and sorry for my bad English. I hope you understand me ... :smileywink:

 

This is my first steps in Ilogic/VBA in Inventor and you should be patient ... :smileyhappy:

 

I have a problem with my Ilogic rule. The rule change tolarance for every hole which have diameter 6 and 8 mm :smileyhappy: 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

 

medium.png

0 REPLIES 0

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

Post to forums  

Autodesk Design & Make Report