2 Replies Latest reply on Jun 20, 2016 7:42 AM by テ ソ ン キ ム

    What check GetWhatswrong method?

    テ ソ ン キ ム

      Hi all.

      I have a program what i didn't make.

      But i have to understand this program.

      And i couldn't under stand about GetWhatsWrong method exactly.

       

      please look this simple source.

      ---

      var swApp = new SldWorks();

      ModelDoc2 swModel = swApp.LoadFile4(filePath, "r", swImportData, ref errors);

      ...

      ModelDocExtension swModelExt = swModel.Extension;

      bool ret = swModelExt.SaveAs(convertFile

                          , (int)swSaveAsVersion_e.swSaveAsCurrentVersion

                          , (int)swSaveAsOptions_e.swSaveAsOptions_Copy

                          , swExportPDFData

                          , ref errors

                          , ref warnings);

      object oFeatures;

                      object oErrorCodes;

                      object oWarnings;

                      ret = swModelExt.GetWhatsWrong(out oFeatures, out oErrorCodes, out oWarnings);

      ---

      This program open .x_t file with sloidworks. And save as extension solidworks file.

      And check wrong to use GetWhatsWrong.

      But i can't understand that GetWhatsWrong check what.

      I have a .x_t file. and if i use this program, It make 14 SolidWorks files(drw, part, asm)

      And Get 3 wrong Features finally, And all have ErrorCode 1(unknown err).

       

      I want to know that GetWhatsWrong check about "to save" Or check about all of "swFeatureError_e".

       

      Sorry row English skill. But If you understand my question, please teach me.

      Thank you.

        • Re: What check GetWhatswrong method?
          John Alexander

          From the API documentation:

          2012 SOLIDWORKS API Help - GetWhatsWrong Method (IModelDocExtension)

          Parameters

          Features
          Array of features in the What's Wrong dialog
          ErrorCodes
          Array of error codes corresponding to the features in the What's Wrong dialog as defined in swFeatureError_e
          Warnings
          Array of Booleans corresponding to the features in the What's Wrong dialog indicating whether SolidWorks detected a What's Wrong item as a warning; true if SolidWorks detected a What's Wrong item as a warning, false if not

          Return Value

          True if this method runs successfully, false if not

           

           

          I want to know that GetWhatsWrong check about "to save" Or check about all of "swFeatureError_e".

          I believe this will reveal the contents of the "Whats Wrong" dialog box which will report errors in the model (not just related to saving).

           

          If you want the errors relating to the save operation:

          bool ret = swModelExt.SaveAs(convertFile

                              , (int)swSaveAsVersion_e.swSaveAsCurrentVersion

                              , (int)swSaveAsOptions_e.swSaveAsOptions_Copy

                              , swExportPDFData

                              , ref errors

                              , ref warnings);

           

          'ret' will indicate whether or not the save was successful, 'errors' and 'warnings' will indicate more specifically what was wrong.

          • Re: What check GetWhatswrong method?
            テ ソ ン キ ム

            Thanks for your teaching Jhon.