Change the size of the hole

Change the size of the hole

865966724
Contributor Contributor
485 Views
2 Replies
Message 1 of 3

Change the size of the hole

865966724
Contributor
Contributor

I'm looking for some assistance with modifying the holes at the bottom of these two parts. This is just one example, as I have several similar parts that require modification. These parts share a common characteristic - the holes are located near the bottom. My goal is to ensure their sizes are consistent. If anyone could lend a hand, it would be greatly appreciated!😄

微信截图_20230906153806.png4c3abf63ce2127fcd17d3383c2c1cd1.png

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

Andrii_Humeniuk
Advisor
Advisor
Accepted solution

Hi @865966724 . How do you want to ensure consistency across 2 different components? Should it be through the assembly in which these two components reside? Is it necessary to make a connection between the parameters of 2 parts?

This is an example of code that measures the distance between the "XZ Plane" and all HoleFeatures, then picks the one closest to the plane and sets the diameter to 10mm (line 17):

Dim oInvApp As Inventor.Application = ThisApplication
Dim oMT As MeasureTools =  oInvApp.MeasureTools
Dim oDoc As PartDocument = oInvApp.ActiveDocument
Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim oPlane As WorkPlane = oDef.WorkPlanes(2)
Dim oHoles As HoleFeatures = oDef.Features.HoleFeatures
If oHoles.Count = 0 Then Exit Sub
Dim dDistance, dMinDistance As Double
Dim iHole As Integer
For i As Integer = 1 To oHoles.Count
	dDistance = oMT.GetMinimumDistance(oPlane, oHoles(i).HoleCenterPoints(1))
	If dMinDistance = 0 Or dDistance < dMinDistance Then
		dMinDistance = dDistance
		iHole = i
	End If
Next i
oHoles(iHole).HoleDiameter.Value = 1 'Diameter 10 mm
oDoc.Update()

 

Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor

LinkedIn | My free Inventor Addin | My Repositories

Did you find this reply helpful ? If so please use the Accept as Solution/Like.

EESignature

0 Likes
Message 3 of 3

865966724
Contributor
Contributor
Thank you very much for your help! I really appreciate your taking the time to help me. Thank you for your kindness and generosity.Your feedback has been very helpful to me, and I will carefully consider and apply it to my project. Thank you again for your support and encouragement!