13 Replies Latest reply on Jun 5, 2018 5:27 AM by Guy Lowndes

    Substring in Annotation

    Guy Lowndes

      Hi All,

       

      I have created a major-minor revision numbering system in PDM that works fine on test, I just need to get the major and minor numbers to show it different boxes in the title block of the drawing.

       

      The two options I have are:

      1. Split the revision number into two PDM variables/document properties in the PDM workflow - I've exhausted all possible way of doing this, it appears it isn't possible
      2. Show a sub-string of the current revision number in the title block (i.e  left 2 characters for "part revision", right 2 characters for "issue")

       

      Does anyone know how this might be done (without writing a macro)? I've looked all over and can't find a sub-string, mid, left or right function.

       

      Regards,

       

      Guy

        • Re: Substring in Annotation
          Kevin Chandler

          Hello,

           

          If your numbering is actual numbers, then option two is (kinda) possible.

          Create two global variables for your two number components and do the math as shown:

          The "CustomRev" property has a leading zero because this property is text.

          But when you do the math on it, leading zeros are stripped, so the property that references the global variable won't have this.

          And I don't believe you can conditionally concatenate one either. This is what I meant by "kinda".

          Create custom properties in the part that point at the gv's:

          Link these properties in a note in the drawing:

           

          Cheers,

           

          Kevin

          • Re: Substring in Annotation
            Craig Schultz

            #1..... I think it would be tricky/not possible since you can only have the one rev scheme listed in transitions and workstates.

             

            #2.....You should be able to do this with the two extra variables pulling sub strings.  I have done something similar with in-house number vs vendor number at a previous job.  In your data card, select your "part revision" variable, go to the input formula on the right, select the ">" then functions.  Sub strings are located there.  2017 SOLIDWORKS PDM Help - Input Formula Functions

              • Re: Substring in Annotation
                Guy Lowndes

                Craig,

                 

                Thanks for the reply.

                 

                I tried the data card functions but unfortunately they only work when a value is updated on the card not in a workflow. I think for all other options other than revision numbering this would have been the ideal solution.

                 

                Regards,

                 

                Guy

                  • Re: Substring in Annotation
                    Aleksander Ksiezopolski

                    Hi!

                     

                    I have some idea. You said that spliting is impossible so I guess that revision is completed in single transition, right? So maybe you could split transition to two transitions with one automatic option?

                     

                    Could you send an export file of the workflow?

                     

                    Regards,

                    Alek

                      • Re: Substring in Annotation
                        Guy Lowndes

                        Aleksander,

                         

                        The problem I was seeing when trying to do the revisioning in two stages was that there is only one "Revision" value for the objects in PDM and if I did it in two stages it would overwrite that value with either the minor or major value.

                         

                        Regards,

                         

                        Guy

                          • Re: Substring in Annotation
                            Aleksander Ksiezopolski

                            I mean:

                             

                            transition 1: update "left revision" variable

                            transition 2: update "right revision" variable and "full revision" variable as "left revision""right revision"

                              • Re: Substring in Annotation
                                Guy Lowndes

                                Aleksander,

                                 

                                I did understand what you were trying to say and that solution was my first attempt at a solution but I can only see one way to collect the next or increment revision number:

                                 

                                Revision = %nextrevision%,

                                 

                                This value isn't separated so I can't see how, in each increment, I would know what the next major and minor element would be.

                                 

                                If there is a way of separating this out then I'd prefer to use that.

                                  • Re: Substring in Annotation
                                    Aleksander Ksiezopolski

                                    Look:

                                     

                                    I hope it will be good for your. It's just a very simple example.

                                      • Re: Substring in Annotation
                                        Guy Lowndes

                                        I've had a go but as you can see from the history, it isn't producing the correct result for Revision (These are all minor revision changes):

                                         

                                         

                                        The initial 01.01 revision is along a path that still uses the major-minor revision component.

                                        After that the revision counter is being overwritten by the "increment minor revision" action.

                                          • Re: Substring in Annotation
                                            Guy Lowndes

                                            I almost got it working by incrementing the minor revision as suggested.

                                             

                                            Then changing the "Revision Numbers" in the Major Rev Status to the dual-numbering system and having the increments set to zero for both.

                                             

                                            This produced the following result:

                                             

                                             

                                            You can see that I set the zeros after Rev 01.08.

                                             

                                            It still enters a revision status of 09 when I recalculate the minor revision though.

                                              • Re: Substring in Annotation
                                                Guy Lowndes

                                                Lots of trial and error but I think I've got it.

                                                 

                                                So, what I think happens is that the %nextrevision% variable looks at the revision numbering scheme of the status at the end of the transition and returns what the next revision number would be, it doesn't appear to hold a value.

                                                 

                                                So, I changed the "Update Minor" transition to set the variable "Minor Value" but not to increment the rev.

                                                I also had to say at each state how much the number would increment by.

                                                 

                                                 

                                                 

                                                Resultant history:

                                                 

                                                Thanks for the push in the right direction Aleksander

                              • Re: Substring in Annotation
                                Guy Lowndes

                                I have this figured out, thanks Kevin for pointing me in the right direction.

                                 

                                It got me thinking, how can I generate an equation on a drawing - well the only place is in table - which is fine for title blocks.

                                 

                                The format of the revision numbering system is 00.00

                                 

                                The table is shown below:

                                Column A has the equation  ={0}(#`Rev_Issue`*1) (This is how we get the integer value)

                                Column B has the equation =((#`Rev_Issue`*1)-A2)*100

                                 

                                Now the only problem I have left is that General Tables can't be placed on sheet formats but I think I can sort that out - I'll just place it on the template - hopefully it won't get deleted when someone uses "select all"->delete after a bad day.