Professional Documents
Culture Documents
SolidWorks 2011 - Automação
SolidWorks 2011 - Automação
Creating fast, robust, and FREE user interfaces for SolidWorks automation
Accessing Visual Basic for Applications (VBA) through Excel
Connecting Excel to SolidWorks through VBA
Building SolidWorks VBA code for use in Excel
Accessing Excel references through VBA
Driving SolidWorks automatically and bulk processing with loops
*We know that VBA is not truly object-oriented, but for those that would choose
Excel as a programming environment over Visual Studio 2010, its close enough.
DISCLAIMER!!!
www.razorleaf.com
or
www.slideshare.net
BACKGROUND
Razorleaf Corporation
Services ONLY (were not trying to sell you any products, were neutral)
Bob Mengel
Mechanical Engineer and Automation Developer/Implementer
Paul Gimbel (aka The Sherpa)
Your Options
Pure SolidWorks
Configurations
Design Tables
Configuration Publisher
Smart Components
Mate References
DriveWorksXpress
Design Checker
SolidWorks Task Scheduler
SolidWorks Macros
Run completely inside of SolidWorks
User Interface
Data validation
Macros
Design Table
Embedded in the SolidWorks model
Must edit through SolidWorks
Edit Table In New Window to gain access to Excel
MUST BE IN THE DESIGN TABLE SHEET WHEN YOU EXIT!!
Custom
functions
Macros
Object-Oriented
Some Peoples
Idea of an Excel
User Interface
Data Validation
Lists, error and warning dialogs, tool tips
In-Cell Dropdowns
Input
Messages
Error Messages
Warning Messages
Data Validation
Lists, error and warning dialogs, tool tips
Conditional Formatting
Control users attention based on input
Data Validation
Lists, error and warning dialogs, tool tips
Conditional Formatting
Control users attention based on input
Tools, Protection
Unlock/show only cells you want them to be able to change
Data Validation
Lists, error and warning dialogs, tool tips
Conditional Formatting
Control users attention based on input
Tools, Protection
Unlock/show only cells you want them to be able to change
Control Toolbox
VB-style input devices that can fill in your cells
Data Validation
Lists, error and warning dialogs, tool tips
Conditional Formatting
Control users attention based on input
Tools, Protection
Unlock/show only cells you want them to be able to change
Control Toolbox
and selections
Advanced equation functionality
VBA
Custom
functions
Macros
Object-Oriented
Calculations in Excel
Name Your Cells and Ranges
Just as in SolidWorks, it makes equations easier to read
Add Comments
Voltage
110
240
360
Impedance
1.73
2.9
3.48
VLookup(110,VoltageRange,2,FALSE) = 1.73
VLookup(290,VoltageRange,2,FALSE) = #N/A
VLookup(359,VoltageRange,2,TRUE) =
Searches until it finds a value that is
greater than the search value, then
goes back to take the previous one.
2.9
Criteria1
Criteria2
Criteria3 Criteria 4
Formatting
Charts
Design Binder
Easy User Interfaces
Advanced equation functionality
VBA
Custom
functions
Macros
Object-Oriented
GETTING TO VBA
Custom functions
Macros
Easier to troubleshoot
Easier to maintain
Faster to develop
Accessing VBA
Note: Because were converting a Double to an Integer, this only works for numbers
up to 32767. This was not an issue in my application as the model only supported up
to 48. But you may want to put a check in there so you dont get overflow errors.
3.
http://www.google.com (add
4.
5.
6.
Ctrl-C
Ctrl-V
Tweak
CONNECTING TO SOLIDWORKS
Connecting to SolidWorks
Add the SolidWorks library to your project
Tools> References>
Thickness = Range(TestCell).Value
Running through the cells in a named range
QUESTIONS
(AND HOPEFULLY ANSWERS)
The Process
Add-In
Simulation
Document
Study Manager
Parameters to Drive
Results to Return
Feature Suppression
Run Analysis
Create Mesh
Drive Model
Drive Dimensions
Study
Run
Gather Results
Format Results
More control
some facsimile
thereof)
Our Classes
Parameter
Parameters
Parameter
Parameter
Test Case
Result
Results
Result
Test Cases
Parameter
Parameters
Parameter
Test Case
Results
Result
QUESTIONS
(AND HOPEFULLY ANSWERS)