Get the number of holes on a part (use Hole command "From sketch")

Get the number of holes on a part (use Hole command "From sketch")

ngocson8335
Advocate Advocate
700 Views
3 Replies
Message 1 of 4

Get the number of holes on a part (use Hole command "From sketch")

ngocson8335
Advocate
Advocate

Dear Experts,

 

I'm Son, I'm a User Inventor. I'm coding a code to get the number of holes, but I can't get it.

 

Zalo_ScreenShot_8_10_2018_1042779.png

I'm using Microsoft Visual Studio to coding.

 

Please help me to suggest the ways or example codes.

 

Thank you so much.

Ngoc Son
Autodesk User
0 Likes
Accepted solutions (1)
701 Views
3 Replies
Replies (3)
Message 2 of 4

bradeneuropeArthur
Mentor
Mentor
Accepted solution
Public Sub Getthenumberofholesonapart()

Dim a As Application
Set a = ThisApplication

Dim b As PartDocument
Set b = a.ActiveDocument

Dim fe As HoleFeature

MsgBox b.ComponentDefinition.Features.HoleFeatures.Count
End Sub
Public Sub Getthenumberofholesonapart()

Dim a As Application
Set a = ThisApplication

Dim b As PartDocument
Set b = a.ActiveDocument

Dim fe As HoleFeature

MsgBox b.ComponentDefinition.Features.HoleFeatures.Item(1).HoleCenterPoints.Count

End Sub

Regards,

Autodesk Software: Inventor Professional 2018 | Vault Professional 2018 | Autocad Mechanical 2018
Programming Skills: Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
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 !

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

ngocson8335
Advocate
Advocate

That great!!! Thank you for your help!!!

Ngoc Son
Autodesk User
0 Likes
Message 4 of 4

bradeneuropeArthur
Mentor
Mentor

Your thanks are appreciated...

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