10 Replies Latest reply on Feb 9, 2018 8:03 AM by Kassandra Williams

    Roll To Previous

    Kassandra Williams

      Is there a way to put Roll to Previous and Roll to End on a the feature tab. I would use that a lot but it is not quickly accessible. I have looked in the customize -> commands but i cant find it anywhere. I know it is in the edit pull down but that is not very efficient way to go through a part quickly.


      I don't want to use the bar because it is awful to use. The grab area is just too small and it makes it hard to grab and therefore hard to use.


      Thank you


        • Re: Roll To Previous
          Matt Peneguy

          Have you tried right clicking?

          • Re: Roll To Previous
            Glenn Schroeder

            I couldn't find a command to drag onto a Command Manager tab (to be fair I don't have a lot of time to look right now), but you can set a keyboard shortcut for each.  Would that work for you?

            • Re: Roll To Previous
              Kassandra Williams

              Well Roll to Previous is not moving to the function prior to it. Why would that be?

                • Re: Roll To Previous
                  Matt Peneguy

                  Roll to Previous will roll to the last location the Roll Back bar was placed.  It means Roll Back to previous location, not Roll Back 1 feature.

                  Do you need to step back by feature or all the way to the top of the tree?

                    • Re: Roll To Previous
                      Kassandra Williams

                      Well both would be nice. I have occasions where I would use both, but back 1 feature would be used more.

                        • Re: Roll To Previous
                          Matt Peneguy

                          Sorry Kassandra, unfortunately, I don't see a method of grabbing the current roll back bar location in the API documentation.  If I can't get the current location, I don't know how to tell it to move 1 space from its current location.  I'm not saying it is not there, but I can't find it.  But, I'm not a real programmer, either.  So, you may have better luck asking over in the API/macros section for a macro that will roll the rollback bar 1 feature back and a separate one that will roll it forward 1 feature. If someone can create 1, the other should be trivial to create.

                          However, I was able to modify an example from the help to be able to roll the roll back bar all the way to the origin.  If it doesn't get it right to the origin, you can change the number in the macro to make it work:

                          Here's the macro (you get no warranties or guarantees).  Please test it on something not important until you are sure it isn't going to cause you any problems (I'm not sure how it would, but this is always good practice). Like I said I'm not a real programmer...I just play one on these forums sometimes.

                          Option Explicit

                          Sub Main()

                              ' Delay in seconds

                              Const DELAY                    As Single = 1#

                              Dim swApp                      As SldWorks.SldWorks

                              Dim swModel                    As SldWorks.ModelDoc2

                              Dim swModelView                As SldWorks.ModelView

                              Dim swPart                      As SldWorks.PartDoc

                              Dim swAssy                      As SldWorks.AssemblyDoc

                              Dim swFeatMgr                  As SldWorks.FeatureManager

                              Dim swFeat                      As SldWorks.Feature

                              Dim featFace                    As Variant

                              Dim swFace                      As SldWorks.Face2

                              Dim rect                        As Variant

                              Dim featName()                  As String

                              Dim timeNow                    As Single

                              Dim docType                    As Long

                              Dim i                          As Long

                              Dim j                          As Long

                              Dim status                      As Boolean

                              Set swApp = Application.SldWorks

                              Set swModel = swApp.ActiveDoc

                              Set swModelView = swModel.ActiveView

                              Set rect = Nothing

                              Set swFeatMgr = swModel.FeatureManager

                              Set swFeat = swModel.FirstFeature

                              docType = swModel.GetType

                              Select Case docType

                                  Case swDocPART

                                      Set swPart = swModel

                                  Case swDocASSEMBLY

                                      Set swAssy = swModel

                                  Case Else

                                      Debug.Print "Open a part or assembly document, then rerun this macro."

                                      Exit Sub

                              End Select

                              ReDim featName(0)

                              Do While Not swFeat Is Nothing

                                featName(UBound(featName)) = swFeat.Name

                                  ReDim Preserve featName(UBound(featName) + 1)

                                  Set swFeat = swFeat.GetNextFeature




                                  Debug.Print featName(0)

                                ' MsgBox ("featname" & featName(16))

                                  status = swFeatMgr.EditRollback(swMoveRollbackBarToBeforeFeature, featName(16))

                                status = swFeatMgr.EditRollback()

                          End Sub