Need Help to Identify the WorkAxis of Parent Hole feature of Circular Pattern

Need Help to Identify the WorkAxis of Parent Hole feature of Circular Pattern

Anonymous
Not applicable
521 Views
5 Replies
Message 1 of 6

Need Help to Identify the WorkAxis of Parent Hole feature of Circular Pattern

Anonymous
Not applicable

Hi ,

Can someone help me to delete a Work Axis of a Hole which is the Parent hole of the circular pattern.

I have written to create Axis for the Parent hole feature of the circular pattern.

 

Dim oPartDoc As PartDocument
Set oPartDoc = ThisApplication.ActiveDocument
Dim oWorkAxis As WorkAxis

 

' Get all the Circular Pattern from Part Feature.
For i = 1 To oPartDoc.ComponentDefinition.Features.CircularPatternFeatures.Count

Dim oCirPattern As CircularPatternFeature
Set oCirPattern = oPartDoc.ComponentDefinition.Features.CircularPatternFeatures.Item(i)

If oCirPattern.ParentFeatures.Item(1).Type = kHoleFeatureObject Then

'To delete if the Axis for the Parent Hole aleady exists -----------------> Need Help here to Identify the Work Axis of  the Parent Hole feature of Circular Pattern
For Each oWorkAxis In oPartDoc.ComponentDefinition.WorkAxes
If oWorkAxis.DefinitionType = kRevolvedFaceWorkAxis Then
oWorkAxis.Delete
End If
Next

Set oWorkAxis = oPartDoc.ComponentDefinition.WorkAxes.AddByRevolvedFace(oCirPattern.ParentFeatures.Item(1).Faces.Item(1), False)
oWorkAxis.Visible = true
MsgBox "Axis Enabled for " & oCirPattern.Name & " 
End If
Next i

 

---------------------------------------------------

 

Thanks in Advance

 

Regards

Alex

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

bradeneuropeArthur
Mentor
Mentor

Hi,

 

Replace this:

 

If oWorkAxis.DefinitionType = 12551 Then ' or kFixedWorkAxis
On Error Resume Next oWorkAxis.Delete End If

For me it works

 

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 6

Anonymous
Not applicable

Hi,

Thanks for answers. My code works. But my intension was to identify workaxis presence for Parent Hole and it exists then it must skip deletion of that particular axis.

 

but at the same time, if the workaxis for the occurrence of the pattern (Pattern element) exists it should delete.

 

Meaning i would like to keep WorkAxis only for the Parent Hole feature of the Pattern, and not its elements. 

2nd point is WorkAxis other than the pattern should Not be disturbed, it may be hole (without pattern/ made of extrude) etc.

 

something like this;

 

For Each oWorkAxis In oPartDoc.ComponentDefinition.WorkAxes
On Error Resume Next

If oWorkAxis.DrivenBy.Item(oCirPattern.ParentFeatures.Item(1).Face.Item(1)) And oWorkAxis.DefinitionType = kRevolvedFaceWorkAxis Then

MsgBox oWorkAxis.Name & " " & oWorkAxis.DefinitionType
' If oWorkAxis.DefinitionType = kRevolvedFaceWorkAxis Then
oWorkAxis.Delete
End If
Next

 

 

Regards

Alex

0 Likes
Message 4 of 6

bradeneuropeArthur
Mentor
Mentor
Accepted solution

Hi,

 

I have tested that and it works for me.

other workaxis keep undisturbed.

 

children axes of the parent (Pattern Hole) will be deleted.

 

only thing I had changed:

 

is the:

"on error"

and:

If oWorkAxis.DefinitionType = kFixedWorkAxis

 

Shall I resend You my code?

 

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 5 of 6

Anonymous
Not applicable

Hi,

The Onerror resume next helped me

 

Thanks

 

0 Likes
Message 6 of 6

bradeneuropeArthur
Mentor
Mentor

Hi,

 

Good to hear it is working for you now.

 

Could You please mark it as solved solution for administrative reasons.

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