Problem with SaveAs4 using swSaveAsOptions_SaveReferenced

Discussion in 'SolidWorks' started by vadnala, Jul 20, 2005.

  1. vadnala

    vadnala Guest

    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.
     
    vadnala, Jul 20, 2005
    #1
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.