Message 1 of 2
Modify Sample VBA Code to change the sketch plane using sample code
Not applicable
01-05-2021
11:21 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Greetings,
I am getting started with Autodesk Inventor VBA and I hope this question is not a repeat!
I found a sample code from Autodesk Inventor Help Community composed of two subroutines where:
- First Sub, CreateSketchBlockDefinition(), Defines a sketch block that is a rectangle of 4 cm x 3 cm.
- Second Sub, InsertSketchBlockDefinition(), Inserts this sketch at with a corner at (10cm, 10cm) on the xy plane.
Inventor 2020 Help: Create and insert a sketch block definition into a part sketch (autodesk.com)
I have the following questions:
- Is there a good way to learn AutoDesk VBA commands by recording them and seeing the command lines generated in VBA Editor? This is possible to do in Excel by clicking the record macro button. I don't see a record macro button in Autodesk Inventor.
- How can I modify the first subroutine , CreateSketchBlockDefinition(), to include fillets at the four corners of the rectangle?
- How can I modify the second subroutine, InsertSketchBlockDefinition(), to create the sketch on a plane that is different from the xy plane? For example, I would like the sketch to be placed on the active plane or selected plane in Inventor. Most likely it will be to modify the line shown below:
Set oSketch = oCompDef.Sketches.Add(oCompDef.WorkPlanes(3))
But I am not sure how to set the plane to the selected plane in inventor.
Thanks!