Find all holes without sketches.

Find all holes without sketches.

shastu
Advisor Advisor
530 Views
3 Replies
Message 1 of 4

Find all holes without sketches.

shastu
Advisor
Advisor

I have a vba program, but it only works for files that are 2019 or later.  Any files before that causes problems because of the holes that were created without sketches.  Is there a way to look through a part and identify all holes that don't have a sketch?  If so, then all I would have to do is edit each one of them before I run my other code because in Inventor if I just edit the hole and then select the OK button, it creates a new sketch.

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

bradeneuropeArthur
Mentor
Mentor

What do you mean with:

  • Hole without sketched? A hole is most times created with a sketch! Do you mean a sketch that is Cut-extruded?
  • What kind o holes do you mean? What shape for instance? Round Square etc...

What is actually the problem with your program and the holes created different?

Maybe the solution is easier if we would know the issues!

 

Regards,

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 4

JelteDeJong
Mentor
Mentor
Accepted solution

Is this what you mean?

Dim doc As PartDocument = ThisDoc.Document
For Each hole As HoleFeature In doc.ComponentDefinition.Features.HoleFeatures
    If hole.Sketch Is Nothing Then
        MsgBox(hole.Name & " has none sketch")
    Else
        MsgBox(hole.Name & " belongs to " & hole.Sketch.Name)
    End If
Next

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 4 of 4

shastu
Advisor
Advisor

That is exactly what I want only I needed it in VBA so I changed it to this:

 

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

Dim hole As HoleFeature
For Each hole In oDoc.ComponentDefinition.Features.HoleFeatures
    If hole.Sketch Is Nothing Then
        MsgBox (hole.Name & " has none sketch")
    Else
        MsgBox (hole.Name & " belongs to " & hole.Sketch.Name)
    End If
Next
End Sub

 

Thank you so much!!!

0 Likes