Early and Late Binding
Creating associations between two entities is called binding.
Early binding improves the performance of your program, increases type
checking, and assists in detecting errors in your code.
To implement early binding in the SolidWorks software, you must reference two type libraries:
(Substitute the actual SolidWorks version
number for version.)
These type libraries:
Provide descriptions of all of the available SolidWorks
API objects, properties, methods, events, and constants.
Are automatically referenced when you record a
SolidWorks macro.
To early bind SolidWorks object variables, prefix them with ISldWorks,
which tells Visual Basic to look in the SolidWorks type library. For example:
Change late binding... |
To early binding... |
Dim swApp
As Object |
Dim swApp
As SldWorks.SldWorks |
Dim swModel As Object |
Dim swModel As SldWorks.ModelDoc2 |
Dim swEntity As Object |
Dim swEntity As SldWorks.Entity |