Change size of Clearance Hole with iLogic

Change size of Clearance Hole with iLogic

johnster100
Collaborator Collaborator
1,219 Views
6 Replies
Message 1 of 7

Change size of Clearance Hole with iLogic

johnster100
Collaborator
Collaborator

Hi,

i'm trying to set a clearance hole with ilogic, but I can't find the option to set the bolt size (say M10). 

clearance hole.png

 

However, when right click on the feature in the model tree and get it's information the M10 value is not there (it only shows the parameter for the size of the hole)

 

Can anyone help?

 

thanks,

John

0 Likes
1,220 Views
6 Replies
Replies (6)
Message 2 of 7

WCrihfield
Mentor
Mentor

Hi @johnster100.  Changing hole feature specs by iLogic can be a pain, because they have become so dynamic, and a lot of the specs shown/available in them is being sourced from spreadsheet files.  In some situations, if you attempt to change a spec to something that's not available within the spreadsheet, it may give an error too.  There are some tricky properties value types involved in some of these scenarios that you may have to deal with.  In the case of a clearance hole, the HoleFeature has a property called ClearanceInfo that returns a HoleClearanceInfo object we will need to deal with.  It is simpler to deal with than some of the other object types.  Once you're at this point, you can either use the SetClearanceInfo method, or just directly specify a new value for the FastenerSize property.  However, as mentioned before, the value you specify must be one that is available in the spreadsheet, while the other settings are the way they are.  The spreadsheet file is called "clearance.xls", and it is one of the standard files installed with Inventor, under the '\Design Data\XLS\en-us\ directory.

for example:

C:\Users\Public\Documents\Autodesk\Inventor 2022\Design Data\XLS\en-US\clearance.xls

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you want and have time, I would appreciate your Vote(s) for My IDEAS 💡or you can Explore My CONTRIBUTIONS

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 7

WCrihfield
Mentor
Mentor

Here is a very simplistic example of an iLogic rule to change an existing hole feature's clearance hole size, by changing its fastener size.

Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
Dim oHole As HoleFeature = oPDef.Features.HoleFeatures.Item(1)
If oHole.IsClearanceHole Then
	'oHole.ClearanceInfo.SetClearanceInfo("ISO","Hex Head Cap Screw ISO 24017", "M10", FastenerFitType.kNormalFitType)
	oHole.ClearanceInfo.FastenerSize = "M10"
End If

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you want and have time, I would appreciate your Vote(s) for My IDEAS 💡or you can Explore My CONTRIBUTIONS

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 4 of 7

WCrihfield
Mentor
Mentor

Just another example showing another possible process for doing something like this by iLogic.

Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
Dim oHFeats As HoleFeatures = oPDef.Features.HoleFeatures
Dim oHole As HoleFeature = oHFeats.Item(1)
If oHole.IsClearanceHole Then
	Dim oStd As String = "ISO"
	Dim oType As String = "Hex Head Cap Screw ISO 24017"
	Dim oSize As String = "M10"
	Dim oFit As FastenerFitType = FastenerFitType.kNormalFitType
	Dim oNewClearanceInfo As HoleClearanceInfo = oHFeats.CreateClearanceInfo(oStd, oType, oSize, oFit)
	oHole.ClearanceInfo = oNewClearanceInfo
End If

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 7

RNDinov8r
Collaborator
Collaborator

So, one thing we did for "custom holes" that we wanted to control, was a new style to the Excel Spread sheet that IV reads the hole data from. 

 

In this case, we wanted to make standard dowel pin holes based on the metric size. So, I added these rows to the sheet and filled in the Size, Shaft Diameter, and Head dimentions appropriatatley...

RNDinov8r_0-1631726894643.png

so, when I fire the hole command in IV, they show up like this now.

RNDinov8r_1-1631727000006.png

Where it automatically assigns the diameter based on the metric size and fit.

 

Using this method, you can just insert more rows to the desired new styles you are looking for. Really, as many rows as you need.

0 Likes
Message 6 of 7

RNDinov8r
Collaborator
Collaborator

So what you see there, are two styles of dowel pin holes..one for thru holes (or blind) and one for holes with breathers. Say for example I put a Ø10mm dowel pin that is a press fit into a 50 mm thick piece of metal...I don't want to bore a 10mm hole all the way thru, so using the C'Bore feature, I can set my C'bore to the dowel pin hole size, then set a depth, and then the breather hole is just a smaller thru hole. My hole note can then tolerance the breather hole to say, ±.010" while the dowl pin hole is held to within 0.001".

 

0 Likes
Message 7 of 7

Marcus_Chong
Contributor
Contributor
Hi,

If we would like to change the thread size from assembly, what will be the code like? The part that we are changing is model states. For example,

Change Text Parameter named Bolt Size - M10 in assembly.
Part1 Model State1 , Hole1 feature M10 changed.
0 Likes