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

<<  Prev   |   Index   |   Next  >>

Description

Ever wanted to create macros with SolidWorks-native user interfaces? This lesson will show you how to do just that via PropertyManager pages (PMP). At the end of the lesson we also show you how to create previews using temporary bodies.

Notes

Run-time errors in VBA classes are a little quirky. When an object doesn’t get set, you might not get an error at all. Instead, the macro just stops. Or you might get an error on the line of your standard module that calls a procedure within the class, even though the error actually occurred on a line in the class.

If a PMP is open and you need to select one of the following objects, do not use the Select method found within the interface of that object. Instead use IModelDocExtension::SelectByID2, which handles selection correctly regardless of whether the PMP is open.

  • IAnnotation
  • IComponent2
  • IFeature
  • IFeatureManager
  • ISketchHatch
  • ISketchPoint
  • ISketchSegment
  • ISketchSpline

Advanced: It is possible to contain the PMP layout and handling code in the same class. The advantage of this is that you do not need to create Public variables for the resource ID’s in a standard module. For handler argument in ISldWorks::CreatePropertyManagerPage, use “Me” since you are referencing that module.

Lesson Files

Lesson 7.4 code – start
Lesson 7.4 code
Lesson 7.4 – create spike
Code snippets