Inventor hole-feature-dialog

Inventor hole-feature-dialog

alexeng2012
Explorer Explorer
284 Views
1 Reply
Message 1 of 2

Inventor hole-feature-dialog

alexeng2012
Explorer
Explorer

I'm Working in sheet fabrication i would like to get the code of hole feature creation so i can change it to create a slot  

0 Likes
285 Views
1 Reply
Reply (1)
Message 2 of 2

JaneFan
Autodesk
Autodesk

Hello, 

 

Please try the following code: 

Before trying the code, please create a part file with a block and a sketch(With a sketch point) in it, as below image shows: 

1.png

Sub test()
Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument

Dim oSk As PlanarSketch
Set oSk = oDoc.ComponentDefinition.Sketches("Sketch2")

Dim oSkPt As SketchPoint
Set oSkPt = oSk.SketchPoints(2)

Dim oObjCol As ObjectCollection
Set oObjCol = ThisApplication.TransientObjects.CreateObjectCollection
Call oObjCol.Add(oSkPt)

Dim oHoleDef As HolePlacementDefinition
Set oHoleDef = oDoc.ComponentDefinition.Features.HoleFeatures.CreateSketchPlacementDefinition(oObjCol)

Dim oHole As HoleFeature
Set oHole = oDoc.ComponentDefinition.Features.HoleFeatures.AddDrilledByThroughAllExtent(oHoleDef, 0.25, kSymmetricExtentDirection)
End Sub

 

 

Then you are supposed to get the hole feature created, as the image below: 

2.png

 

There are many other ways to create hole feature via API, please change the code as needed.

 




Jane Fan
Inventor/Fusion QA Engineer
0 Likes