How to move the slider on the History Palette

kandennti
Mentor

How to move the slider on the History Palette

kandennti
Mentor
Mentor

Hello everyone.

 

I'm looking for a way to move the HistoryPalette slider.
Do you have any experience?

1.png

 

 

No such feature was found in the "Timeline" Object.

http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-9d25e8b0-926d-4183-ab46-42f2045242ff 

The slider does not respond when you change the markerPosition Property.

 

 

Also, History Palette can be obtained by the following method,

 

historyPalette = ui.palettes.itemById('ShowHistoryPalette')

 

I couldn't find a way to change the slider.

0 Likes
Reply
Accepted solutions (1)
892 Views
8 Replies
Replies (8)

OceanHydroAU
Collaborator
Collaborator

Why do you need to move it?  You can access those things (which are called "Features") and do stuff on them through the API that way.

 

This is where they're at:-

 

design.rootComponent.features

 

This would be the one "10-operations-ago" if you wanted to mess with it:-

 

design.rootComponent.features.item(design.rootComponent.features.count-10)

0 Likes

kandennti
Mentor
Mentor

Thank you, @OceanHydroAU .

 

There was a request on the Japanese forum, "I want to know where the timeline was created for the surface I clicked on in the GUI.


Selecting a surface will mark it on the timeline icon, but it is difficult to find it if the timeline is very long.


Using the API, it is easy to find out "which timeline object was used to create it? is easy to find out, but unless you move the slider, it is difficult to tell the user, just like the GUI.


I tried to deal with this by using rollback, but in the case of long timelines, the amount of recalculation became too much and it became very difficult to use.

0 Likes

nnikbin
Collaborator
Collaborator

Grouping timeline items and ungrouping them (using deleteMe method of TimelineObject with deleteGroupAndContents = false)  changes timeline scrollbar position. Perhaps you can mange these operations to mange scrollbar position.

0 Likes

kandennti
Mentor
Mentor

Thank you @nnikbin .

 

That's a good idea that I hadn't thought of.

I don't have time to try it now, but I will definitely report the results later.

0 Likes

kandennti
Mentor
Mentor

I created a code like this, but the slider did not respond.

        # "idx" is the desired TimeLine object.
        tl: adsk.fusion.Timeline = des.timeline
        tlgrps: adsk.fusion.TimelineGroups = tl.timelineGroups
        tlgrp: des.timeline.timelineGroup
        if idx == tl.count:
            tlgrp = tlgrps.add(idx -1, idx)
        else:
            tlgrp = tlgrps.add(idx, idx + 1)
        
        tlgrp.deleteMe(False)


It didn't achieve my goal, but it was exciting.
Thanks @nnikbin .

0 Likes

nnikbin
Collaborator
Collaborator
Accepted solution

@kandennti 

Adding a dummy feature (for example a BaseFeature) and deleting it will scroll timeline to the end. Creating a group of n items and ungrouping it moves timeline by n items. So the following  code will bring item(index) to the view:

 

app = adsk.core.Application.get()
ui  = app.userInterface

design = app.activeProduct
rootComp = design.rootComponent

baseFeats = rootComp.features.baseFeatures
baseFeat = baseFeats.add()
baseFeat.deleteMe()

index = 80
timeline = design.timeline

groups = design.timeline.timelineGroups
grp = groups.add(0, timeline.count - index - 1)
grp.deleteMe(False)

 

I tried it and it works fine.

 

The only problem is having other timeline groups in the range you want to create a group.  As you know it is not possible to have nested timeline groups. To solve it I think you can save the existing groups ranges, ungroup them, then scroll the timeline and finally recreate the groups. You should consider the effect of ungrouping and grouping existing groups on your scroll computations!

3 Likes

kandennti
Mentor
Mentor

Thank you @nnikbin .

 

Confirmed operation.
"Why do we have to include a dummy?" The question remains, but it is definitely working.

0 Likes

nnikbin
Collaborator
Collaborator

You are welcome @kandennti

 

I added a dummy operation to move the timeline scrollbar to the far right and make the code standalone. Without it, this code is not able to move the scrollbar to the right. For example if the scrollbar is at the far left. It is correct that other operations in the add-in can make this dummy operation redundant.

1 Like