6 Replies Latest reply on Dec 28, 2017 6:05 PM by Jacob Corder

    Checking files in and out in SOLIDWORKS PDM Standard

    Amen Allah Jlili

      Forum,

       

      I understand that the SOLIDWORKS API is not available for SOLIDWORKS PDM Standard (BUMMMER). Is it possible to check files in and out of a vault through another means of automation without having to resort to the EPDM interops?

       

      Any solution in VB.NET or C# (or even pointers really)

       

      Thanks everyone!

        • Re: Checking files in and out in SOLIDWORKS PDM Standard
          Jacob Corder

          of course there is buddy.

           

          Direct database modifications.

          the EPDM API is basically access to all of their stored procedures in the SQL database.

           

          be careful because solidworks will not fix a database that has been directly updated

           

          so to lock a file you will need to get the document id

           

          this is retrieved from DBO.Documents

          but first you need to get the File path from the model

           

          Dim FileName as string = SwModel.GetPathName.

           

          Dim rootFolder as string = 'you can retrieve this or program it in. this in ConisioMasterDB. you will need to know the vault root folder and to do that

          also you will get the database name from ConisioMasterDB

           

          execute sql query to ConisioMasterDB

          Select VaultName, DatabaseName from ConisioMasterDB.DBO.FileVaults

           

          Use DatabaseName and vault name to strip out the root directory from FileName

           

          generally you will be left with this

          Dim DirName a string = system.io.path.getdirectoryName
          C:\<ROOT FOLDER>\FolderPath\FileName

           

          i am working on a sample project right now.  it will get you started at least

          • Re: Checking files in and out in SOLIDWORKS PDM Standard
            Jacob Corder

            First do me a favor. Is the SQL express dataset available to be queried against? If not then my sample may not work especially if it is locked down unlike pdm professional.

              • Re: Checking files in and out in SOLIDWORKS PDM Standard
                Amen Allah Jlili

                I'm not sure. It's only available to the admin but not users I'd assume. I remain interessed in what you are writing so please continue doing that and post it here if you like!

                  • Re: Checking files in and out in SOLIDWORKS PDM Standard
                    Jacob Corder

                    ok.  DO NOT USE THIS IT COULD DESTROY YOUR VAULT.

                     

                    understanding the table links in the PDM Database is key to direct edit.  I WILL NEVER SUGGEST THAT ANYONE EVER DO THIS IT IS A TERRIBLE IDEA AND SHOULD NEVER BE DONE.

                     

                    howerever attached is a text file representing the code i wrote quickly.

                     

                    i have not debugged nor tested any of the code. just wrote it from what i could see in the database as I will not test this on my end.  ever.. Dont do it.

                     

                    unless your name is Amen Allah Jlili heheheh

                     

                    take the text to Telerik website to convert to C# if you want.

                     

                    otherwise just make a new vb project and paste it in a new class.

                     

                    there are 2 classes

                     

                    PDMVault and PDMFile

                     

                    AGAIN I CANNOT STRESS THIS ENOUGH THIS COULD COST YOUR COMPANY THOUSANDS OF DOLLARS AND CAUSE ALL OF YOUR VAULT DATA TO BECOME CORRUPT.

                     

                     

                     

                    Good luck

                • Re: Checking files in and out in SOLIDWORKS PDM Standard
                  Jacob Corder

                  so i was able to get into the CAD Addin through enterprise and it does have a lock call.  i executed it and it does lock the file.  however i believe pre selection is required.

                   

                  so this will toggle check in and out. but it does prompt for a verification screen.

                   

                  i believe if you select a component in the assembly or if it is just a  part or drawing it will attempt to check those files out.

                   

                  hopefully selecting components automatically selects them in the EPDM Addin.

                   

                  test it out bud