Description
This important lesson explores the means of getting pre-selected objects and selecting objects using the SolidWorks API.
Notes
Marking is used to specify which entities are used in a particular aspect of feature creation. For example, in order to create a revolved feature you need to have a profile and an axis selected. To specify which selected object is the profile and which is the axis, you need to mark the axis with 16, since this is what the member page for IFeatureManager::FeatureRevolve2 states. You will see marking used in the lesson on feature creation.
You can mark objects using the Mark argument in IModelDocExtension::SelectByID2 or by using the ISelectData::Mark property.
If you intend to select a dimension, display dimension, feature, or component with IModelDocExtension::SelectByID2, use one of these methods to quickly get the name string: IComponent2::GetSelectByIDString, IDimension::GetNameForSelection, IDisplayDimension::GetNameForSelection, IFeature::GetNameForSelection.
Lesson Files
Lesson 3.4 select methods code
Lesson 3.4 SelectionManager code
Homework
Lesson 3.4 homework part A solution
Lesson 3.4 homework part B solution