Create Hole on Workpoint

Create Hole on Workpoint

Anonymous
Not applicable
784 Views
3 Replies
Message 1 of 4

Create Hole on Workpoint

Anonymous
Not applicable

Hello everyone,

 

I tried to create a hole with the hole feature on a workpoint. I was able to project the workpoint on a sketch and use this sketch to drill the hole. But this way the projected point is not automatically refreshed when workpoint changed. That is why I tried to generate the hole directly by the workpoint like this so far:

            Dim oDoc As Document
            Set oDoc = ThisApplication.ActiveDocument
            
            Dim oDef As ComponentDefinition
            Set oDef = oDoc.ComponentDefinition
   
            ' Create an object collection for the hole center points.
            Dim oHoleCenters As ObjectCollection
            Set oHoleCenters = ThisApplication.TransientObjects.CreateObjectCollection

            oHoleCenters.Add oDef.WorkPoints.Item("COG")
            Dim oCenterPlacementDef As PointHolePlacementDefinition
            Set oCenterPlacementDef = oDef.Features.HoleFeatures.CreatePointPlacementDefinition(oHoleCenters, oDef.WorkAxis.Item(1))
            
            Call oDef.Features.HoleFeatures.AddDrilledByThroughAllExtent(oCenterPlacementDef, "1 cm", kPositiveExtentDirection)

An error occured in line:

            Set oCenterPlacementDef = oDef.Features.HoleFeatures.CreatePointPlacementDefinition(oHoleCenters, oDef.WorkAxis.Item(1))

Can anyone tell me how to set up the holefeature on a workpoint/point correctly?

 

Thanks in advance.

 

Lars

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

dgreatice
Collaborator
Collaborator
Accepted solution

Hi,

 

Did you define that Hole feature at assembly file or Part File?

This my code For Part File

 

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

 

   Dim oDef As PartComponentDefinition
   Set oDef = oDoc.ComponentDefinition

 

   Dim oHoleCenters As Object
   Set oHoleCenters = oDef.WorkPoints.Item("COG")

 

   Dim oCenterPlacementDef As PointHolePlacementDefinition
   Set oCenterPlacementDef = oDef.Features.HoleFeatures.CreatePointPlacementDefinition(oHoleCenters, oDef.WorkAxes.Item(1))

 

   Call oDef.Features.HoleFeatures.AddDrilledByThroughAllExtent(oCenterPlacementDef, 1, kPositiveExtentDirection) 'or maybe use kNegativeExtentDirection. choose one

End Sub

 

Im using Inventor 2014, you can see my example ipt file.

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
Message 3 of 4

Anonymous
Not applicable

Hi,

 

yes, I used it in part file like you. With your code I got it working and modified to my belongings. Thanks a lot.

 

But as usual there occured another question. I set up the tapinfo by:


CreateTapInfo(True, "ISO Metric profile", "M8x1.25", "6H", False, "24mm")

But within the help I don't find the right position to define  this feature

 

Unbenannt.JPG

 

Do you maybe have any ideas about that issue?

0 Likes
Message 4 of 4

dgreatice
Collaborator
Collaborator

Hi,

 

Please create new Thread for different issue. I will glad to help you again.

 

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
0 Likes