From help of product:
The task type defines how the items attached to the task will be displayed during simulation. For example, a default construction sequence would start with all items hidden, as the task starts the attached items will be displayed in transparent green, then as the task ends the attached items will be displayed as they are in the normal model display. Task types themselves can be defined and new types created on the Configure Tab.
Each task has a task type associated with it, which specifies how the items attached to the task are treated (and displayed) at the start and end of the task during simulation. The available options are:
- None - the items attached to the task will not change.
- Hide - the items attached to the task will be hidden.
- Model Appearance - the items attached to the task will be displayed as they are defined in the model. This may be the original CAD colors or, if you have applied color and transparency overrides in Autodesk Navisworks, then these will be displayed.
- Appearance Definitions - enables you to choose from the list of Appearance Definitions, including ten predefined appearances and any custom appearances you have added.
The corresponding API are:
- SimulationTaskType:A Simulation Task Type informs the Simulation Engine how models attached to a TimelinerTask should be represented at different times during the simulation
- SimulationAppearance: referenced by SimulationTaskTypes objects
- DocumentTimeliner.SimulationAppearanceAddCopy: Adds a copy of the SimulationAppearance at the end of the collection to the DocumentTimeliner
- DocumentTimeliner.SimulationTaskTypeAddCopy: Adds a copy of the SimulationTaskType at the end of the collection to the DocumentTimeliner
This is a code pieces that demos how to create a custom appearance and a custom task type. In this task type, its start status links to the custom appearance.
using Nw = Autodesk.Navisworks.Api; using Tl = Autodesk.Navisworks.Api.Timeliner; public override int Execute(params string[] parameters) { Document oDoc = Autodesk.Navisworks.Api.Application.ActiveDocument; try { Nw.Document doc = Nw.Application.ActiveDocument; Nw.DocumentParts.IDocumentTimeliner tl = doc.Timeliner; Tl.DocumentTimeliner tl_doc = (Tl.DocumentTimeliner)tl; Tl.SimulationAppearance newSimAppearance = new Tl.SimulationAppearance("myAppearance", new Color(1, 1, 1), 0.5); tl_doc.SimulationAppearanceAddCopy(newSimAppearance); Tl.SimulationTaskType newTaskType = new Tl.SimulationTaskType(); newTaskType.DisplayName = "myTaskType"; newTaskType.StartStatus.AppearanceMode = Tl.SimulationAppearanceMode.UserAppearance; newTaskType.StartStatus.SimulationAppearanceName = "myAppearance"; tl_doc.SimulationTaskTypeAddCopy(newTaskType); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } return 0; }