Macro - Count Extrude or Revolved features

Macro - Count Extrude or Revolved features

isocam
Collaborator Collaborator
328 Views
1 Reply
Message 1 of 2

Macro - Count Extrude or Revolved features

isocam
Collaborator
Collaborator

Can anybody help?

 

I have a Inventor part (ipt) open.

 

I want to check if the part contains more than one "extrude" or "revolved" features.

 

Does anybody know how to do this with a Inventor macro?

 

All I need to do at present is to put the value in a message box

 

eg:

 

Number of extruded features = 4

 

Many thanks in advance!!!

 

Darren

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

Owner2229
Advisor
Advisor

Hi, something like this?

 

Dim oDoc As Document = ThisApplication.ActiveDocument
Dim oDef As ComponentDefinition = oDoc.Componentdefinition
Dim Revolve As Integer = 0
Dim Extrude As Integer = 0
Dim oFt As PartFeature
For Each oFT In oDef.Features
    If oFT.Type.ToString = "kRevolveFeatureObject" Then
        Revolve = Revolve + 1
    Else If oFT.Type.ToString = "kExtrudeFeatureObject" Then
        Extrude = Extrude + 1
    End If
Next
MsgBox("Revolve features: " & Revolve & vbLf & "Extrude features: " & Extrude)

 

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
0 Likes