3 Replies Latest reply on May 1, 2017 2:48 AM by テ ソ ン キ ム

    How get property in file of Solidworks2015

    テ ソ ン キ ム

      Hi.

      I have a problem.

      My application open solidworks files.

      It was to be able to open solidworks2013's file, But It is can't open SolidWorks2015's.

      I debuging source. And i know one.

      first. error happened at "StgOpenStorage".

      I think the reason that solidworks2013's file is "compound file" But 2015 is not.

      So. I Changed method to use from "StgOpenStorage" to "StgOpenStorageEx"

      I set STGFMT_ANY IN "StgOpenStorageEx". And I solved error.

      But!! (Start ask from here)

      Next of that source. My application get propperty inform use by IPropertySetStorage.Open.

      ---source

      IStorage *pStorage = NULL;

      hr = ::StgOpenStorageEx(wcFilename, openMode | STGM_SHARE_EXCLUSIVE, STGFMT_ANY,
      0, NULL, NULL, IID_IPropertySetStorage, (void **)&pStorage);

      IPropertySetStorage *pPropSetStg = NULL;
      hr = pStorage->QueryInterface(IID_IPropertySetStorage, (void **)&pPropSetStg);

      IPropertyStorage *pCustomPropStg = NULL;
      hr = pPropSetStg->Open(FMTID_UserDefinedProperties,openMode | STGM_SHARE_EXCLUSIVE, &pCustomPropStg); <- return err

      error is "STG_E_FILENOTFOUND"

      um...I think the reason about this problem. method of Open, try to open solidworks2015's file by STGFMT_STORAGE(or anyother get rid of STGMT_ANY)

      But, I don't know how can i solve this problem. Please teach me. Thank you!

        • Re: How get property in file of Solidworks2015
          テ ソ ン キ ム

          Thank you for view my question.

          I want to add some comment and information.

          It is vc++ source and IPropertySetStorage is Api of MS.

          It is fect that can open file and get property solidworks 2013 file using IPropertySetStorage, But 2015 file is can't.

          And I think now that no way get 2015 file's property using MS's API.

          I must find other solution. and I think the solution is solidworks API.

          But i can't find how i to do.

          I want to get file's propferty of solidworks 2015 in c++ source.

          Could you teach me some information. Thank you.

          • Re: How get property in file of Solidworks2015
            George Berold

            Hi,

            Did you solve this problem, since I have the same problem and been struggling with it 3 days

              • Re: How get property in file of Solidworks2015
                テ ソ ン キ ム

                The file made of Solidworks2015 can not be open by Windows API.

                If you are using Windows API like StgOpenStorage or others. you have to Changed to use Solidwork API.

                 

                you will be able to open solidworks2015 file if you follow this.(this is c# source)

                 

                String drawPath = @"C:\ABC.SLDDRW"

                int err = 0;

                int war = 0;

                swDocumentTypes_e type = swDocumentTypes_e.swDocDRAWING;

                 

                ModelDoc2 swModel = default(ModelDoc2);

                var swApp = new SldWorks();

                 

                swApp.Visible = true;

                swModel = (ModelDoc2)swApp.OpenDoc6(drawPath, (int)type, (int)swOpenDocOptions_e.swOpenDocOptions_LoadModel, "", ref err, ref war)