14 Replies Latest reply on Jun 10, 2016 10:45 PM by Brandon Plubell

    ePDM GetVar pulling old values??

    Danny Bradford

      Greetings all,

      We have code, seen below, that pulls the Revision of the Drawing. Since there is no object that actually represents the drawing we are pulling the value from a specific sheet. Since users have complete control of the Sheet names we are forced to check for "Sheet1" then since AutoCAD has a similar situation we search for "SH1" next and if neither exist we just grab the next config, ie sheet, from the end.

       

      We had a situation where a user renamed the sheets later in the drawing lifecycle. The current version is 85 and does not contain "Sheet1" but a much older version does contain "Sheet1"

       

      What this has brought to light is that the GetVar, since we are specifically looking for Sheet1 config will seek out that config in the "newest available". How do we force GetVar to only pull from the current, or latest, version of the drawing? In our problem case it should have found nothing for "Sheet1" because that does not exist any longer.

       

       

      Code:

      Public Function ParGetProperty(ByVal configNames As String(), ByVal propertyName As String, ByRef value As Object, ByRef exception As ProcessException, Optional ByVal preferredConfigs As String() = Nothing) As Boolean

      value = Nothing

      exception = Nothing

       

      Try

      Dim properties As IEdmEnumeratorVariable5 = m_File.GetEnumeratorVariable()

       

      If preferredConfigs IsNot Nothing Then '<-- preferredConfigs is a string array with 2 values: "Sheet1" and "SH1"

      For Each configName As String In preferredConfigs

      If properties.GetVar(propertyName, configName, value) Then  '<-- property name in this case is "Revision". This is the problem line!!

      Return True

      End If

      Next

      End If

       

      For Each configName As String In configNames

      If properties.GetVar(propertyName, configName, value) Then

      Return True

      End If

      Next

       

      Return False

       

      Catch pe As ProcessException

      exception = pe

      exception.SendAlertAndLog("EPDM")

      Return False

       

      Catch ex As Exception

      exception = New ProcessException(ex)

      exception.SendAlertAndLog("EPDM")

      Return False

       

      End Try

      End Function

        • Re: ePDM GetVar pulling old values??
          Brandon Plubell

          Danny,

          That is indeed interesting -- something I have not run into yet.

          However, you could try using the variables attached to the document (non configuration specific properties) by using the configurations "@" for SOLIDWORKS and "Model" for AutoCAD (I am pretty certain that AutoCAD configuration is a constant).

          If those configurations do not have values (or are not maintained), you can get the list of configurations from PDM using something like IEdmFile5.GetConfigurations and feed that to the GetVar method. According to documentation, you can optionally add a parameter value of 0 or an empty string to get only configurations for the latest version of the file.

            • Re: ePDM GetVar pulling old values??
              Danny Bradford

              Thanks for the reply Brandon. We have worked through these 2 options and unfortunately none are consistent. The @ configuration does not exist in Solidworks and thus is not always populated.

               

              Additionally, sheets that are added on later revisions do not inherit the proper revision value. If the sheet was added on Rev C the revision value for that specific sheet is still the Initial Revision, not C. This prevents us from just letting ePDM provide any random configuration.

               

              It is quite a mess to be honest. I am very surprised others have not run into this. There seems to be no stable and risk free way to pull attributes from Drawings. Perhaps this is not a common practice?

                • Re: ePDM GetVar pulling old values??
                  Jim Sculley

                  Danny Bradford wrote:

                   

                  It is quite a mess to be honest. I am very surprised others have not run into this. There seems to be no stable and risk free way to pull attributes from Drawings. Perhaps this is not a common practice?

                  I suspect that most people are simply linking a note on the drawing to a variable on the data card that is controlled by transition actions to update it to the proper EPDM revision as the file moves through the workflow.  What exactly is the purpose of your code above?  I'd like to see the bigger picture to make sure you haven't made things overly complicated for yourself.

                    • Re: ePDM GetVar pulling old values??
                      Danny Bradford

                      Hey Jim,

                       

                      This code is built to pull the proper revision of the drawing from ePDM to do other things outside of Solidworks and ePDM. All I need is a reliable way to extract the revision level of the drawing and run with it in a custom developed program. Certainly the relationship between ePDM and the Solidworks Drawing is as you describe. That has worked for us for years now.

                       

                      In reality this is the totality of the code that references the Drawing. All other code simply utilizes the extracted value.

                       

                      You time is appreciated.

                        • Re: ePDM GetVar pulling old values??
                          Jim Sculley

                          If the drawing file is in the vault and it has an EPDM revision, then you can simply use the CurrentRevision property of the IEdmFile5 object for the drawing.  You should not need to use GetVar at all to achieve this.

                            • Re: ePDM GetVar pulling old values??
                              Danny Bradford

                              Hey Jim,

                              Well, not really. This is a check cycle tool we have custom built with its own workflow. The result of the workflow in the custom built system is the release of all related ePDM files. The code above is within the launch of a check cycle workflow and needs the future revision that has not yet occurred in ePDM, not the current release value.

                               

                              The ePDM workflow I built populates the future revision in the Revision attribute initially so that on release the Drawing and Datacard are accurate without further edits.

                               

                              Many thanks for the feedback and I apologize that I did not paint this complete picture and I see now how it has caused some confusion.

                               

                              Danny B

                                • Re: ePDM GetVar pulling old values??
                                  Danny Bradford

                                  Oh, and full disclosure, we are utilizing 2 revisions in ePDM for a single file, one for revision letter and one for an ECO numeric value. I am seeking a solution which will pull in both attributes accurately. For the sake of this forum I am only focused on the one.

                                   

                                  A file can be released at Rev A then have supplemental ECO (Engineering Change Orders) at 1, 2, 3, etc. then the next revision B upon release would be the latest overall file.

                                  • Re: ePDM GetVar pulling old values??
                                    Jim Sculley

                                    Danny Bradford wrote:

                                     

                                    Hey Jim,

                                    Well, not really. This is a check cycle tool we have custom built with its own workflow. The result of the workflow in the custom built system is the release of all related ePDM files. The code above is within the launch of a check cycle workflow and needs the future revision that has not yet occurred in ePDM, not the current release value.

                                    This is working backwards from my point of view, but to each his own.

                                     

                                    Let's go back to your original post in which you said:

                                     

                                    "Since there is no object that actually represents the drawing we are pulling the value from a specific sheet."

                                     

                                    What do you mean that there is no object representing the drawing?

                                     

                                    From a data card standpoint, drawings do not have configurations.  Therefore, when you call GetVar you should be passing in an empty string for the config name as noted in the GetVar API docs. 

                                     

                                    If you truly want to get the value from the latest version of the file, you should be using GetVarFromDB which talks directly to the database, ignoring any changes that have been made locally to the data card.

                                     

                                    Can you describe, in detail, the process from end to end?  For example, if you have assembly ABC.sldasm, containing A.sldprt, B.sldprt and C.sldasm, what is supposed to happen when you use your tool?  What files does your check cycle worflow operate on?  SW files of some other document?

                                      • Re: ePDM GetVar pulling old values??
                                        Danny Bradford

                                        Hey Jim,

                                         

                                        Well, what I meant by my comment on no object for the drawing is this. Each datacard tab represents a specific sheet on the drawing and no overarching, lets call it, "Header" datacard tab. I understand the '@' tab should fill this void, however since there is no interface on the Solidworks side for this tab then it is really useless.Additionally, normally there would be a Drawing level datacard with attributes that pertain to the drawing like revision, description and drawing number so that there is only one value per attribute per drawing, while other attributes on the sheet specific datacard like page number. Placing all attributes on all sheets creates a messy data management and causes issues such as the very issue I am having. New sheets come in with default values that do not match the other sheets.

                                         

                                        Currently I have a datacard with conflicting values. Any APIs that pull the information now must sift through the bad data and pull only the good stuff. Of course there are APIs geared to operate in this environment, but in the end there is a very real risk that occasionally bad data can be grabbed. To anticipate one counter point, the option in the datacard builder to have the value update all tabs does not work if the rev value change happens first then the new tab, ie new sheet, is added later. There is no option to "Keep all attributes identical at all times."

                                         

                                        I am sure there are several comments above I have made that will make some bristle and I hope I have not offended anyone, but I have worked with multiple PLM systems and had workshop reviews of several others. I know what PLM can do (good thing) and also how complex a system can be (bad thing). I have found ePDM absolutely awesome in several ways that blows away the other systems, but I also see significant gaps in the overall architecture that create several brick walls between us and major improvements. But again for the money ePDM kicks butt! 

                                         

                                        We will take the comment from Greg below and give that a whirl and if we are still stuck with this issue I will go into a deeper dive into our process. I do love to share processes and discussions on ways to improve.

                              • Re: ePDM GetVar pulling old values??
                                Brandon Plubell

                                Danny,

                                I just confirmed in my 2015 PDM, there is an "@" tab for SOLIDWORKS drawing files... perhaps it is hidden in your view settings? I am pretty certain it is not specific to our PDM implementation. Additionally, SOLIDWORKS only shows one tab for "File Properties" called "Custom" (which mirrors the data shown on out data card's "@" tab for us).

                                AT tab.png

                                 

                                I think conceptually the "@" tab it is what you are after since PDM has not kept track of revisions for individual sheets but rather for the entire file. However, it may not be maintained so may not work for your documents. Furthermore, if the revision property has not been changed by PDM (in a workflow transition, for example) after it has been in an editable state (and it is not been in an editable state since PDM changed the property), there is no way you can ensure that the value will be accurate or valid (a user could arbitrarily change it). I think this is why Jim Sculley mentioned he thought it was backwards.

                                 

                                What I would probably explore next is looking at the history of the file (same thing as right-clicking -> History in PDM) and finding the last revision it has been at and then checking what the next valid revision will be. This can be done with parsing IEdmHistory.GetHistory and comparing with IEdmRevisionMgr2.GetRevisionNumberComponents2 (though I have not used the revision number components before). This will be the most accurate and consistent way to know what the revision will be after it is released. Notably, it does not rely on PDM variables or SOLIDWORKS properties.

                                  • Re: ePDM GetVar pulling old values??
                                    Danny Bradford

                                    I apologize that I have not been clear as I felt it would clutter this post with far too much info but unfortunately I see it has caused much confusion so let me explain what is going on.

                                     

                                    Situation: Files are all released and are at Rev A. This is true for ePDM rev level, variables, etc.

                                     

                                    User is required to revise the files to Rev B

                                     

                                    User chooses the workflow state to "Revise".

                                     

                                    The Revise option pushes the files to an in work state and the variable in the datacard is Rev B BUT NOT the actual ePDM revision. This is because users can change their mind and roll back or switch to an ECO change which would push the files back to A and then the ECO value to 1 (it begins at 0). Most important reason is the Cold Storage auto delete function keeps the versions tabbed with "Revision: X". since a file and revert and return multiple times a file can change several versions in ePDM before released. We only want that final version to be kept by cold storage.

                                     

                                    Once done the user promotes the file to "Pending" and submits the files to our custom built Check Cycle Tool. This tool manages approvals, rejects, and releases. It will force the files base to in work should there be a reject.

                                     

                                    Eventually all is approved and the Check Cycle Tool will release both the PDF to the released folder and promote all files to released in ePDM which is where the files will adopt the official ePDM revision B.

                                     

                                    While the files are in that Pending state the official ePDM rev is still A so the only place we can systematically find rev B is in the revision field in the datacard which is what I am trying to accomplish.

                                     

                                    The @ tab was the very first thing we attempted because of the very reasons you have stated, however we have found that this tab is completely unreliable and often empty.

                                     

                                    As I mentioned above, a user could be running an ECO which leaves the Rev level and iterates the ECO level or running a revision which resets the ECO to 0 and iterates the revision. The "Last Rev in the History" could be either and does not specify which it is referring to. Pictured below one of these is the Revision and one is the ECO:

                                     

                                     

                                    Hopefully this helps everyone understanding why we have done what we have done. Thanks for your time and interest in this problem and I do hope we are able to resolve it.

                                      • Re: ePDM GetVar pulling old values??
                                        Brandon Plubell

                                        I think what we are looking at (History) is the correct place to look, but you will have to build logic about which revision component to look for then look for the last of that type. You will probably then have to build logic around how you are implementing the two revision components (since it sounds like the numbers can be reset at some point).

                                        As an example: If getting ready to release the next "lettered" revision, look for last "lettered" revision in history (ignore "numbered" revisions).

                                         

                                        I unfortunately do not have any experience working with multiple revision components/schemas (and related API) so cannot give you more specifics. I, too, am working on a revision related project and this method is what I am using for it.

                                • Re: ePDM GetVar pulling old values??
                                  Greg Rupp

                                  Hi Danny,

                                  Just shooting from the hip here... I'm guessing your issue has more to do with the file references you are using. What I mean by that is, if version 50 of your example file does has "sheet1" in it, but your code isn't finding a "sheet1", (or vise versa) are you sure you are getting the correct configNames from the right version of the file? are you using GetFileCopy or IEdmBatchGet to get the version of the file you want?

                                   

                                  Have you tried GetVersionVars? I would read 2014 SOLIDWORKS API Help - GetVersionVars Method (IEdmEnumeratorVariable7)

                                   

                                  Good Luck