Change Direction of existing Hole feature to Symmetric

Change Direction of existing Hole feature to Symmetric

J.VandeMerckt
Advocate Advocate
276 Views
5 Replies
Message 1 of 6

Change Direction of existing Hole feature to Symmetric

J.VandeMerckt
Advocate
Advocate

Hi Everyone.
I need to change the the direction of a hole feature on multiple files.
I already have a code which allows a chosen Ilogic rule to run on all open files.

I just can't figure out how to change the direction of a hole to symmetric.
Googling and ChatGPT have not been able to solve it.

Can anyone help me out?
It's a part and the hole is called "Hole2"

Br
Justin

0 Likes
Accepted solutions (2)
277 Views
5 Replies
Replies (5)
Message 2 of 6

J-Camper
Advisor
Advisor
Accepted solution

Try This:

Dim hf As HoleFeature = Feature.InventorFeature("Hole2")
If hf.ExtentType <> PartFeatureExtentEnum.kThroughAllExtent Then MessageBox.Show("""Symmetric Extent Direction"" Option only available on ""Through All"" hole features", "Debug") : Exit Sub
hf.SetThroughAllExtent(PartFeatureExtentDirectionEnum.kSymmetricExtentDirection)
Message 3 of 6

harvey3ELEA
Advocate
Advocate

J-Camper, is there a way to change numerous holes (not limited to "Hole2" in line 1) to symmetric?

0 Likes
Message 4 of 6

J-Camper
Advisor
Advisor
Accepted solution

This should do all hole features in the part:

Dim pDoc As PartDocument = TryCast(ThisDoc.Document, PartDocument)
If pDoc Is Nothing Then Logger.Debug("Not Run in Part Document")

For Each hf As HoleFeature In pDoc.ComponentDefinition.Features.HoleFeatures
	If hf.ExtentType <> PartFeatureExtentEnum.kThroughAllExtent Then Logger.Trace("""Symmetric Extent Direction"" Option only available on ""Through All"" hole features") : Continue For
	hf.SetThroughAllExtent(PartFeatureExtentDirectionEnum.kSymmetricExtentDirection)
Next
Message 5 of 6

J.VandeMerckt
Advocate
Advocate
Thanks Camper.
This exactly what I need.
Best regards
Justin
0 Likes
Message 6 of 6

harvey3ELEA
Advocate
Advocate

Works great!  Thanks once again, J-Camper.

0 Likes