8 Replies Latest reply on May 6, 2015 4:47 PM by Charley Saint

    Reference dialog discrepancy

    Jim Sculley

      I have on several occasions noticed differences between the 'Contains' tab and what appears when I click the 'Edit User Defined References' button.  Typically, the latter is empty, like this:

       

      ref-discrepancy.png

       

      Is this a bug or am I missing some subtle feature?

       

      Jim S.

        • Re: Reference dialog discrepancy

          Jim,

           

          I am just starting out as well, but what you are seeing are BOM references in one case and user defined references in the other.  The user defined references are created by using the "copy" and "paste as reference" functionality, which for example would be used for attaching a document to an assembly or part where you don't want it on a bill of material.

           

          Peregrin

            • Re: Reference dialog discrepancy
              Jim Sculley

              Peregrin Maksimovich wrote:

               

              Jim,

               

              I am just starting out as well, but what you are seeing are BOM references in one case and user defined references in the other.  The user defined references are created by using the "copy" and "paste as reference" functionality, which for example would be used for attaching a document to an assembly or part where you don't want it on a bill of material.

               

              Peregrin

              Everything in the view on the left was created using 'Paste As Reference'.  In a seemingly random fashion, the user-defined references are 'cleared' on check-in.  They will still show up in the 'Contains' tab.  They will still show up as referenced during check-in and check-out.  However, the instant you paste a new file as a reference, the old references are deleted and only the new one exists.

               

              Jim S.

                • Re: Reference dialog discrepancy
                  Jim Sculley

                  We are still struggling with ths problem.  We think it is isolated in a small piece of code running in a home-grown C# add-in, but the code is so simple, I think it is exposing a bug either in the API or in EPDM itself.  Attached is the bare bones (only 68 lines)code that I created that still exhibits the problem.  If we have any API experts reading this thread I would appreciate it if you could look at and/or test it and see if there is anything wrong with the code.

                   

                  The add-in is pretty simple.  It expects a folder with a number of .txt files:  one to act as the parent file (I called mine 'parent.txt') and a series of child files named '0.txt' through '9.txt'.  When the add-in is running, right clicking on the 'parent.txt' file (which should be checked in) and selecting 'Add Single' from the context menu will execute the code.

                   

                  The code checks out the parent and adds the next child in numerical order as a reference to the parent.  The parent is then checked in to create a new version, but it remains checked out so that further additions can be made if necessary.

                   

                  When the references are misbehaving, selecting 'Add Single'  once and then checking in the parent will put the file into a state where the contains tab shows a reference, but clicking the 'Edit user defined references' button will show '<No references>'.  Checking in/out will still list all the references, but adding another reference will erase any exisiting items in the contains tab, and from the file.  It doesn't happen every time, but once in this state, it is repeatable after every 'Add Single' operation.

                   

                  Thanks.

                   

                  Jim S.

                    • Re: Reference dialog discrepancy

                      Try what you're attempting to do without using the API. I just tested your scenario and it's working here. (2010 SP0)

                        • Re: Reference dialog discrepancy
                          Jim Sculley

                          Lee Young wrote:

                           

                          Try what you're attempting to do without using the API. I just tested your scenario and it's working here. (2010 SP0)

                          I have not been able to reproduce it outside of the custom code.  This is what leads me to believe it is a problem in the API.  There are subtle differences in the way references are added via the API vs. Windows Explorer.  The API even makes a distinction.  If you look at the API docs for IEdmAddCustomRefs, there are three ways to add references:

                           

                          • AddReferencesClipboard
                          • AddReferencesID
                          • AddReferencesPath

                           

                          Explorer uses the first one.  I'm using the second one.  I also see the problem if I use the AddReference method of the IEdmEnumeratorCustomReference5 class.

                           

                          Jim S.

                            • Re: Reference dialog discrepancy
                              Brian Dalton

                              I'm pretty new to this, but I noticed that your code does not seem to jibe with the example in the help file.  Specifically:

                               

                              --------------------------------------------------------------------------------------------

                              To create new references:

                              1. Create the IEdmAddCustomRefs interface.
                              2. Call AddReferencesClipboard, AddReferencesID, or AddReferencesPath once or more.
                              3. Call the CreateTree method to compute the reference tree.
                              4. Optionally call ShowDlg to display to the user what you are about to do.
                              5. Call CreateReferences to create the new references.

                              --------------------------------------------------------------------------------------------

                               

                              I see where you performed step 2, but no sign of step 3 (CreateTree) or step 5 (CreateReferences).  I haven't done references through the API yet, but I wonder if adding these other two steps may be required.

                               

                              Just a thought....

                    • Re: Reference dialog discrepancy
                      Rick Hombsch

                      We are experiencing the same issue however we are not running any custom add-ins. Does anyone know besides pasted references what other ways are items added to the contains tab for an item?

                       

                      I did notice that the items that are shown in the contains folder are typically parts or assemblies used within that assembly or assembly drawing. Could this be a possible cause of this?

                       

                      -Rick H