Action recognition macro

Action recognition macro

npdedyukhin
Observer Observer
321 Views
2 Replies
Message 1 of 3

Action recognition macro

npdedyukhin
Observer
Observer

Good day, gentlemen!

 

Please tell me, I have a desire to understand one interesting question:

How to refer to the first of the actions in the Action tree? (action is highlighted in red in the screenshot)

 

autodesk-inventor-bearing.jpg

 

I want the system to recognize this action and write the name of this action to a variable, be it Extrusion or Swipe or something else.

For example, I want to see: x_1 = Extrusion.

 

How to refer to the sketch from the first activity?

How to recognize the characteristics of this sketch? What is its geometric shape?

 

So that, for example, the macro then performs the same sketch but in a different location.

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

JelteDeJong
Mentor
Mentor
Accepted solution

For the first part of your question. This iLogic rule will create a parameter with the first feature type.

Dim doc As PartDocument = ThisDoc.Document
Dim def As PartComponentDefinition = doc.ComponentDefinition

Dim firstFeature = def.Features.Item(1)

Dim typeName = CType(firstFeature.Type, ObjectTypeEnum).ToString()
typeName = typeName.Substring(1, typeName.Length - 7)

Try
    def.Parameters.Item("x_1").Value = typeName
Catch ex As Exception
    def.Parameters.UserParameters.AddByValue("x_1", typeName, "text")
End Try

For the rest, it's unclear to me what you try to accomplish. Do you want to copy the sketch someplace?

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

0 Likes
Message 3 of 3

npdedyukhin
Observer
Observer

Hello!

 

Thank you for your help in my endeavor.

 

I answer your question:

When creating parts of the same type, a situation may arise where it is necessary to repeat the same actions. It would be convenient to copy part of the part building steps from an existing part using a macro. This is an experiment. It's interesting what will come of this.

0 Likes