<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: timelineObject for moving bodies in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/timelineobject-for-moving-bodies/m-p/11623968#M4847</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3623640"&gt;@brad.bylls&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think "moveFeats" refers to the adsk.fusion.MoveFeatures object.&lt;/P&gt;
&lt;P&gt;The corresponding adsk.fusion.MoveFeature object must be retrieved with the Item method.&lt;/P&gt;</description>
    <pubDate>Fri, 16 Dec 2022 00:51:50 GMT</pubDate>
    <dc:creator>kandennti</dc:creator>
    <dc:date>2022-12-16T00:51:50Z</dc:date>
    <item>
      <title>timelineObject for moving bodies</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/timelineobject-for-moving-bodies/m-p/11610648#M4840</link>
      <description>&lt;P&gt;I am grouping objects in the timeline.&lt;/P&gt;&lt;P&gt;However, I cannot find the last 'move' timelineObject&lt;/P&gt;&lt;P&gt;I would like to get the 'move' (red arrow) into the group (blue arrow)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Screenshot (31).png" style="width: 316px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1150805i6643AFAE797830E6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot (31).png" alt="Screenshot (31).png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code works and moves the bodies, I just want to get the timelimeObject 'move' into the group.&lt;/P&gt;&lt;P&gt;This is the part of the code I am working with.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Screenshot (30).png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1150807iE7A57CFC21E832F8/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot (30).png" alt="Screenshot (30).png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Dec 2022 02:16:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/timelineobject-for-moving-bodies/m-p/11610648#M4840</guid>
      <dc:creator>brad.bylls</dc:creator>
      <dc:date>2022-12-10T02:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: timelineObject for moving bodies</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/timelineobject-for-moving-bodies/m-p/11611182#M4841</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3623640"&gt;@brad.bylls&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps it is not possible to add elements to a timeline group.&lt;/P&gt;
&lt;P&gt;Therefore, I deleted the timeline group and re-created it.&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;
# Fusion360API Python script

import traceback
import adsk.fusion
import adsk.core


def run(context):
    ui = adsk.core.UserInterface.cast(None)
    try:
        app: adsk.core.Application = adsk.core.Application.get()
        ui = app.userInterface
        des: adsk.fusion.Design = app.activeProduct
        root: adsk.fusion.Component = des.rootComponent

        tlGroup: adsk.fusion.TimelineGroup = des.timeline.timelineGroups[-1]
        targetFeat: adsk.fusion.MoveFeature = root.features.moveFeatures[-1]

        add_group_like(tlGroup, targetFeat)

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))


def add_group_like(
    group: adsk.fusion.TimelineGroup,
    targetFeat: adsk.fusion.MoveFeature) -&amp;gt; adsk.fusion.TimelineGroup:

    # backup
    backupCollapsed = group.isCollapsed 
    backupName = group.name

    # get timeline group items
    startObj: adsk.fusion.TimelineObject = group.item(0)
    endObj: adsk.fusion.TimelineObject= group.item(group.count - 1)

    # delete timeline group
    group.isCollapsed = True
    group.deleteMe(False)

    # get the index that creates the group
    indexes = [
        startObj.index,
        endObj.index,
        targetFeat.timelineObject.index
    ]
    startIdx = min(indexes)
    endIdx = max(indexes)

    # create new timeline group
    des: adsk.fusion.Design = targetFeat.parentComponent.parentDesign
    groups: adsk.fusion.TimelineGroups = des.timeline.timelineGroups
    newGroup: adsk.fusion.TimelineGroup = groups.add(startIdx, endIdx)

    # match state
    newGroup.isCollapsed = backupCollapsed
    newGroup.name = backupName

    return newGroup&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you run it with the attached f3d file, you will see the following.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 273px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1150905iF5AA67479C0E3BC1/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Dec 2022 14:00:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/timelineobject-for-moving-bodies/m-p/11611182#M4841</guid>
      <dc:creator>kandennti</dc:creator>
      <dc:date>2022-12-10T14:00:20Z</dc:date>
    </item>
    <item>
      <title>Re: timelineObject for moving bodies</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/timelineobject-for-moving-bodies/m-p/11615156#M4842</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3787950"&gt;@kandennti&lt;/a&gt;&amp;nbsp;is correct. Fusion doesn't support adding items to an existing group. The exception to this is if you expand the group and move the timeline marker to somewhere within the group, and add a new feature. The new feature will now be part of a group. However, it's not possible to move the timeline marker to the end of the group, so it's after the last feature but still within the group. The best alternative is, as kandennti suggested, and delete and re-create the group.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2022 19:01:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/timelineobject-for-moving-bodies/m-p/11615156#M4842</guid>
      <dc:creator>BrianEkins</dc:creator>
      <dc:date>2022-12-12T19:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: timelineObject for moving bodies</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/timelineobject-for-moving-bodies/m-p/11618657#M4843</link>
      <description>&lt;P&gt;I am not trying to ADD to the group.&lt;/P&gt;&lt;P&gt;I cannot CREATE the group with the move in it.&lt;/P&gt;&lt;P&gt;It tells me that the move does not have a timelineObject.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2022 03:11:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/timelineobject-for-moving-bodies/m-p/11618657#M4843</guid>
      <dc:creator>brad.bylls</dc:creator>
      <dc:date>2022-12-14T03:11:42Z</dc:date>
    </item>
    <item>
      <title>Re: timelineObject for moving bodies</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/timelineobject-for-moving-bodies/m-p/11621012#M4844</link>
      <description>&lt;P&gt;I was not trying to add to a group, I was trying to create the group with 'move' in it and couldn't get the 'timelineObject' for the moveFeats.&lt;/P&gt;&lt;P&gt;Turns out all I needed to do was&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Screenshot (32).png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1152659i7C929DF47B08CA03/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot (32).png" alt="Screenshot (32).png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2022 21:27:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/timelineobject-for-moving-bodies/m-p/11621012#M4844</guid>
      <dc:creator>brad.bylls</dc:creator>
      <dc:date>2022-12-14T21:27:00Z</dc:date>
    </item>
    <item>
      <title>Re: timelineObject for moving bodies</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/timelineobject-for-moving-bodies/m-p/11621205#M4845</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3623640"&gt;@brad.bylls&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;index is a read-only property and cannot be assigned to.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 612px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1152687i84888877DB3978B2/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2022 23:37:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/timelineobject-for-moving-bodies/m-p/11621205#M4845</guid>
      <dc:creator>kandennti</dc:creator>
      <dc:date>2022-12-14T23:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: timelineObject for moving bodies</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/timelineobject-for-moving-bodies/m-p/11623313#M4846</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3787950"&gt;@kandennti&lt;/a&gt;&amp;nbsp;yes I know.&lt;/P&gt;&lt;P&gt;I was just getting the number.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2022 18:42:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/timelineobject-for-moving-bodies/m-p/11623313#M4846</guid>
      <dc:creator>brad.bylls</dc:creator>
      <dc:date>2022-12-15T18:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: timelineObject for moving bodies</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/timelineobject-for-moving-bodies/m-p/11623968#M4847</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3623640"&gt;@brad.bylls&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think "moveFeats" refers to the adsk.fusion.MoveFeatures object.&lt;/P&gt;
&lt;P&gt;The corresponding adsk.fusion.MoveFeature object must be retrieved with the Item method.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2022 00:51:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/timelineobject-for-moving-bodies/m-p/11623968#M4847</guid>
      <dc:creator>kandennti</dc:creator>
      <dc:date>2022-12-16T00:51:50Z</dc:date>
    </item>
  </channel>
</rss>

