SOLIDWORKS API
Help
Macro Features and Strong Name Versioning
If you run different major versions of SOLIDWORKS (e.g., SOLIDWORKS
2008 and
SOLIDWORKS 2009) on the same system, then you should strongly name macro
features that are COM features (i.e., implemented within a DLL file) and
their servers beginning with SOLIDWORKS 2009. Otherwise, SOLIDWORKS cannot
distinguish between macro features created in different major versions
of SOLIDWORKS and may invoke the wrong macro feature if you run a different
major version of SOLIDWORKS than the version just run.
Strongly naming macro features ensures that the macro features are unaffected
when installing or uninstalling different major versions of SOLIDWORKS.
SOLIDWORKS has implemented strong naming to be compatible with your applications
that use macro features.
Strong name versioning of a macro feature allows your application to
choose to use either the version of the macro feature server used to create
the feature or to use the version of the running SOLIDWORKS, if different.
To implement strong name versioning, you must perform the following
steps at each SOLIDWORKS major version release beginning with SOLIDWORKS
2009:
Increment the version number of the type library
in the macro feature server’s IDL file; for example:
...
[
uuid(A0BFC86A-8107-4ACD-886E-398DC76BBC80),
version(17.0),
helpstring("sldFuncFeat
17.0 Type Library")
]
library SLDFUNCFEATLib
...
Increment the version number of the macro feature
server’s type library in your macro feature server’s .h
file; for example:
public IDispatchImpl<IFuncFeatApp, &IID_IFuncFeatApp,
&LIBID_SLDFUNCFEATLib, 17, 0>
Replace the CLSID with a new UUID and increment
the version number of ProgID in all macro feature and macro feature server
files, including the macro feature’s .rgs
file.
Increment ProgID in IFeatureManager::IInsertMacroFeature3
in the macro feature’s .cpp file;
for example:
FeatMan->IInsertMacroFeature3(_bstr_t(baseName),
_bstr_t("SldFuncFeat.LipGrooveFeature.17"),
macroMethods, LipGrooveParamNum, LipGrooveParamName,
LipGrooveParamType, paramVal, LipGrooveDimNum,
dimType,
dimValue, bodyCount, pEditBodies, 3, icons,
swMacroFeatureIsPatternable | swMacroFeatureNoCachedBody,
&pFeat);
Register the version of the macro feature to use
with SOLIDWORKS by including a line
of code similar to the following in your macro feature’s .rgs
file:
CurVer = s ‘SldFuncFeat.LipGrooveFeature.17’
//Substitute your macro feature name and version
which creates the following registry key:
HCLM/SOFTWARE/SOLIDWORKS/SOLIDWORKS 2009/MacroFeatures/SldFuncFeat.LipGrooveFeature/CurVer=SldFuncFeat.LipGrooveFeature.17