![]() ![]() ![]() Error handling (e.g., preventing invalid folder paths) Modularize your code as much as possible. Drawing modification (the “meat” of the macro) 2. ![]() I would recommend writing the code in this order: 1. ![]() For example, let’s say you’re going to write a macro that opens, modifies, and saves every drawing file in a folder specified via a user form. Use Intellisense’s auto-complete to prevent misspellings If you use Find and Replace, replace instances one at a time to make sure you don’t accidentally cause an unintended replacementįocus on code in order of its significance. Type enumerations and member names in lowercase, so that when your cursor moves the next line, you can see if certain letters “snapped” to uppercase, indicating that the name is recognized. Are you sure that you aren’t trying to force the method do something it cannot do? o Example: if you rename a drawing sheet to “Sheet1” but a sheet with that name already exists o Example: if you have two planar faces selected and try to apply a concentric mate 2 "Front Plane", "REFPLANE", 0, 0, 0, False, 0, Nothing, 0Īre you sure the API call does what you think it does? Are you sure you are using the correct API call? o For example, sometimes people get ISldWorks::ActivateDoc and ISldWorks::ActiveDoc confused. Keith Rice, Technical Director, CADSharp LLC Questions to ask yourself if you’re stuck while debugging: Īre you sure you have arguments correct? o For example, the following line will fail to select the plane called “Front Plane” because the second argument should be “PLANE” and not “REFPLANE”. VBA Debugging Tips for SolidWorks API Programmers Version 1.6 ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |