Problem with SaveAs4 using swSaveAsOptions_SaveReferenced



Using Solidworks 2005 SP3 API for saving/exporting an Assembly File
(SLDASM) to a VRML file using the option swSaveAsOptions_SaveReferenced
for saving all components.

Apparently the call does not save all the sub-assemblies/components
though the API says the following

swSaveAsOptions_SaveReferenced \\Supports parts, assemblies, and
drawings. This setting indicates to save all components (sub-assemblies
and parts) in both assemblies and drawings. If a part has an external
reference, then this setting indicates to save the external reference.

Did anyone had the same problem or does it require any other setting. I
am attaching my source code for your reference. I would appreciate if
someone can shed some light here.

LPDISPATCH dispatch = NULL;
DISPID dispid;

( Code to get the dispatch and dispid goes here )

DISPPARAMS dispparms;
memset(&dispparms, 0, sizeof(DISPPARAMS));
dispparms.cArgs = 5;
dispparms.cNamedArgs = 0;
dispparms.rgdispidNamedArgs = NULL;

VARIANTARG* pArg = new VARIANTARG[dispparms.cArgs];
dispparms.rgvarg = pArg;
memset(pArg, 0, sizeof(VARIANT)*dispparms.cArgs);

long Error = 0;
long Warning = 0;
dispparms.rgvarg[0].vt = VT_I4 | VT_BYREF;
dispparms.rgvarg[0].plVal = &Error;
dispparms.rgvarg[1].vt = VT_I4 | VT_BYREF;
dispparms.rgvarg[1].byref = &Warning;
dispparms.rgvarg[2].vt = VT_I4;
dispparms.rgvarg[2].intVal = swSaveAsOptions_SaveReferenced;
dispparms.rgvarg[3].vt = VT_I4;
dispparms.rgvarg[3].intVal = 0;
dispparms.rgvarg[4].vt = VT_BSTR;
dispparms.rgvarg[4].bstrVal = _bstr_t(FileName);

VARIANTARG vaResult;
VariantInit(&vaResult);
UINT nErrArg;

result = dispatch->Invoke(dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT,
DISPATCH_METHOD, &dispparms,
&vaResult, 0, &nErrArg);

Thanks in advance.

.



Relevant Pages

  • Handling security of dynamically generated code?
    ... The code is stored in a database, and is at runtime compiled to an assembly file. ... One idea I was thinking about was to sign my generated assembly with a specific key-file, and then adjust the framework configuration to give assemblies signed with this specific key limited permissions. ... Assembly assembly = CompileScript(Script); ...
    (microsoft.public.dotnet.framework)
  • RE: Assembly signing
    ... the assembly resolver goes through in the order ... the global assembly cache (GAC). ... contains assemblies that have been installed for machine-wide use. ... one similar algorithm to locate the assembly file. ...
    (microsoft.public.dotnet.general)
  • Re: object dispose
    ... As I know this happens because You load the assembly and after You done that, the assembly file cannot be deleted, it has nothing to do with the object being disposed of or not. ... Appdomains not allow unloading assemblies, only a full appdomain can be unloaded. ... Dim Obj As Object ... // call Dispose with false. ...
    (microsoft.public.dotnet.framework)
  • Re: MissingMethodException
    ... assembly file and you are trying to call non-existent method from it. ... Ensure that your all assemblies in this directory are updated correctly. ... > public unsafe void DoSomething() ...
    (microsoft.public.dotnet.framework.compactframework)