You need to be logged in to view this content. Please login or become a member.

<<  Prev   |   Index   |   Next  >>


Since features are such an important part of SolidWorks, this lesson is broken up into three parts: feature creation, feature modification, and FeatureManager tree traversal. In less than an hour you’ll learn techniques that might take you a dozen hours to fully understand on your own. The last lesson, on feature traversal, is particularly critical since the techniques shown apply to assembly and drawing traversal as well.


You can also traverse features using ITreeControlItem (see the API Help example “Traverse FeatureManager Design Tree (VBA)”) or IFeatureManager::GetFeatures.

Lesson Files

Lesson 4.2a start code
Lesson 4.2a code
Lesson 4.2b code
Lesson 4.2c – create plate with traversal
Lesson 4.2c – modify features with traversal
Lesson 4.2c code
Code snippets


  1. CryoDesigner

    Since the largest area in not always the largest diameter I found ISurface::CylinderParams to find the largest radius instead. It was exciting when it I got it to work. Just saying.

  2. jmlhunt

    Normally I would use the Hole Wizard to create the hole pattern demonstrated in these tutorials. Should I avoid the Hole Wizard tool while working with the API? What is best practice?

    • Justin, in my experience, the hole wizard API calls have been tedious and/or confusing. If you do go the route of using the hole wizard, you might consider recording a macro of yourself adding the desired hole so you know exactly what code to use.

      • CryoDesigner

        Lately I’ve been working with the hole wizard and learned a lot. To say the hole is confusing is an understatement. To start, the macro recorder doesn’t record correctly, at least not for my 2014 SolidWorks. The company I work for is going to 2016 this year so maybe this will be fixed. Next, the API help has some errors. So I just looked at all this as a challenging puzzle and now I’ve got it to do what I want. When I get time, ha ha, I would like to share what I found out.

        • The hole wizard is difficult to work with and there are at least two distinct ways to create hole wizard features with the SolidWorks API. The first one uses IFeatureManager::HoleWizardX, which attempts to generalize hole wizard creation but does not support all hole wizard types or options. They have released a fifth version of this method, so perhaps this has changed. The second and theoretically more robust approach uses IFeatureManager::CreateDefinition and IFeatureManager::CreateFeature. However, these methods, at least of a couple of years ago, have bugs in them that yield incorrect output.

          Taken together, I don’t have a strong suggestion of which approach you should use. Just use whichever one seems more reliable in your case.

Questions and Comments

You must be logged in to post a comment.