maptek.gantt module
- enum PrecedenceType(value)
Bases:
StrEnum
Options for precedence types.
- Member Type:
Valid values are as follows:
- StartStart = <PrecedenceType.StartStart: 'SS'>
- FinishStart = <PrecedenceType.FinishStart: 'FS'>
- StartFinish = <PrecedenceType.StartFinish: 'SF'>
- FinishFinish = <PrecedenceType.FinishFinish: 'FF'>
- class Gantt
Bases:
object
Interface to create/edit/read data in Vulcan Gantt Scheduler.
- classmethod active_project()
Connect to the currently active Gantt project.
- rewind()
Set the active activity back to the first activity in the project.
- next() bool
Set the next visible activity as active.
- Returns:
False if there are more activities left, True if there is no next activity.
- Return type:
- is_eof()
Check if the active activity is valid.
- property activities: Iterator[Activity]
Returns every activity in the project.
This changes the active activity so it can’t be used with next() or rewind() and it can only be iterated once at a time.
- select_activities(ids: list[int]) bool
Select one or more activities by ID.
This will also set the active activity to the first ID in the given list.
- Parameters:
ids (
list[int]
) – The IDs of the activities to select. This list must not be empty.- Returns:
True if successful, False otherwise.
- Return type:
- Raises:
ValueError – If ids is an empty list.
- remove_activities(ids: list[int]) bool
Remove one or more activities from the current project.
- Parameters:
ids (
list[int]
) – The list of activity IDs to remove.- Returns:
True if successful, False otherwise.
- Return type:
- remove_all_activities() bool
Remove all activities from the current project.
- Returns:
True if successful, False otherwise.
- Return type:
- split_activity(id: int, task_bar_index: int, proportion: float, delay: float) bool
Split an activity in the current project.
- Parameters:
id (
int
) – The ID of the activity to split.task_bar_index (
int
) – The 0-based index of the task bar to split.proportion (
float
) – The location of the split in the specified task bar. This should be a number between 0 and 1, e.g. for a 50-50 split, proportion should be 0.5.delay (
float
) – The delay, in days, applied to the new task bar and any subsequent bars for the activity.
- Returns:
True if successful, False otherwise.
- Return type:
- split_activities(ids: list[int], proportion: float, delay: float) bool
Split one or more activities in the current project.
- Parameters:
ids (
list[int]
) – The IDs of the activities to split.proportion (
float
) – The proportion to split at. This is the proportion of work for the activity being split. This should be a number between 0 and 1, e.g. for a 50-50 split, proportion should be 0.5.delay (
float
) – The delay, in days, applied to the new task bar and any subsequent bars for the activity.
- Returns:
True if successful, False otherwise.
- Return type:
- add_precedence(start: str, end: str, type: PrecedenceType, lag: float) bool
Add a precedence between two activities.
- Parameters:
start (
str
) – The start activity and bar, in the format ‘ActivityId.BarId’.end (
str
) – The end activity and bar, in the format ‘ActivityId.BarId’.type (
PrecedenceType
) – The precedence type. See PrecedenceType for valid options.lag (
float
) – The precedence lag.
- Returns:
True if successful, False otherwise.
- Return type:
- get_predecessor_list(id: int) list[str]
Get the list of predecessors for an activity.
- Parameters:
id (
int
) – The ID of the activity to get predecessors for.- Returns:
The predecessors.
- Return type:
list[str]
- get_successor_list(id: int) list[str]
Get the list of successors for an activity.
- Parameters:
id (
int
) – The ID of the activity to get successors for.- Returns:
The successors.
- Return type:
list[str]
- get_attribute_types(attribute_names: list[str]) list[str]
Get the types of given attributes.
- Parameters:
attribute_names (
list[str]
) – The list of attributes to get the types of.- Returns:
The types of the attributes.
- Return type:
list[str]
- property lookup_tables: dict[str, maptek.gantt.GanttLookupTable]
The list of existing GanttLookupTable objects.
- property resources: dict[str, maptek.gantt.GanttResource]
The list of existing GanttResource objects.
- property calendar
Set the global calendar for the Gantt project.
- property filter
Apply a filter to all activities in the Gantt project.
- property period
Set the current period in the Gantt project.
- property precedence_group
Set the current precedence group in the Gantt project.
- property report
Set the current report in the Gantt project.
- clear_filter()
Remove the current filter in the Gantt project, showing all activities.
- clear_period()
Remove the current period in the Gantt project.
- clear_precedence_group()
Remove the current precedence group in the Gantt project.
- clear_report()
Remove the current report in the Gantt project. This disables the summary report calculations and clears the report window.
- clear_leveling_delays_selection(keep_start_end: bool, ids: list[int]) bool
Clear the leveling delays for a selection of activities.
- remove_lookup_table(lookup_table: str | GanttLookupTable) bool
Remove a lookup table from the collection.
- Parameters:
lookup_table (
str | GanttLookupTable
) – The name or object representation of the lookup table to remove.- Returns:
True if successful, False otherwise.
- Return type:
- remove_resource(resource: str | GanttResource) bool
Remove a resource from the collection.
- Parameters:
resource (
str | GanttResource
) – The name or object representation of the resource to remove.- Returns:
True if successful, False otherwise.
- Return type:
- add_filter(filter_name: str, filter_string: str) bool
Add a new filter to the collection in the Gantt project.
- add_lookup_table(name: str, values: str) bool
Add a new lookup table to the collection in the Gantt project.
- add_precedence_group(name: str, line_style: int, line_color: int, is_visible: bool) bool
Add a new precedence group to the collection, and set it as the current precedence group in the Gantt project.
- Parameters:
- Returns:
True if successful, False otherwise.
- Return type:
- add_resource_with_rate_capacity(name: str, calendar_name: str, rate: float, capacity: int) bool
Add a new resource to the collection with rate and capacity.
- property date_format
The date format in use by Vulcan Gantt Scheduler.
- export_current_report(path: str) bool
Export a summary report to csv. If Excel is installed and an xlsx extension is specified, it will export to an xlsx file. If Excel is not installed and an xlsx extension is used, an error will be raised.
- Parameters:
path (
str
) – The output path for the resultant csv/xlsx file.- Raises:
RuntimeError – Runtime error containing information from Gantt on the error.
- Returns:
True if successful, False otherwise.
- Return type:
- export_activities_to_csv(path: str, use_activity_filter: bool) bool
Export the activity grid to csv.
- project_filename(short_path: bool) str
Get the current project filename.
- Parameters:
short_path (
bool
) – True to get the absolute file path, False to get the file name.
- set_pause_ui(pause: bool) bool
Pause or unpause Vulcan Gantt Scheduler to allow queued commands without disrupting related changes. This can be helpful as clearing and populating the grid is the slowest part of most actions.
- pause_ui()
See
set_pause_ui()
- resume_ui()
See
set_pause_ui()
- verify_reserves_setup() bool
Verify the reserves setup.
- Returns:
True if the reserves setup could be verified, False otherwise.
- Return type:
- request_reserves(all_activities: bool)
Runs category reserves using reserve attributes and selected activities.
- Parameters:
all_activities – True to include all activities, False to only include selected activities.
- reserves_results() str
Retrieve reserves results for the most recent category reserves run.
More informative results may be retrieved per activity with Gantt.get_reserves_by_activity_attribute and Gantt.activity_attribute_dates.
- Returns:
The results of the reserves.
- Return type:
- get_reserves_by_activity_attribute(activity_type: str, activity_name: str, attribute_name: str) list[str]
Get reserves by activity attribute.
- Parameters:
activity_type – The type of the activity.
activity_name – The name of the activity.
attribute_name – The name of the attribute.
- Returns:
The reserves matching the activity and attribute.
- Return type:
list[str]
- activity_attribute_dates(activity_type: str, activity_name: str, attribute_name: str) list[str]
Get the dates associated with an activity and attribute.
- Parameters:
activity_type – The type of the activity.
activity_name – The name of the activity.
attribute_name – The name of the attribute.
- Returns:
The list of dates processed for the activity.
- Return type:
list[str]
- setup_reserve_attribute(spec_file: PathLike, block_model: PathLike, use_resolution: bool, account_for_double_counting: bool) bool
Setup a reserve attribute.
- Parameters:
spec_file – The path to the spec file.
block_model – The path to the block model file.
use_resolution – True to use resolution, False otherwise.
account_for_double_counting – True to have VGS automatically remove the overlapping tons/volume/footage etc., while maintaining the original design. False to not automatically remove anything.
- Returns:
True if successful, False otherwise.
- Return type:
- add_spatial_precedence_rule(name: str, group: str, clear: bool, minimum_minable: float, closest: bool, precedence_lag: float, precedence_type: PrecedenceType) SpatialPrecedenceRule
Add a new spatial precedence rule.
- Parameters:
name – The name for the new rule.
group – The precedence group that the new precedence rule will be added to.
clear – True to clear any precedences previously defined in the precedence group.
minimum_minable – Used in combination with precedcence_lag, the minimum minable value is the minimum quantity mined between precedences and used to split the predecessor or successor.Splits can be generated in increments of the minimum minable value for both predecessor and successor activities.
closest – True to consider the closest object by distance, False otherwise.
precedence_lag – Lag between the predecessor bar and successor bar.
precedence_type – The precedence type for the new rule. See PrecedenceType for valid options.
- run_spatial_precedence_rules(spatial_precedence_rules: list[str] | list[maptek.gantt.SpatialPrecedenceRule], log_file: PathLike) bool
Run a set of spatial precedence rules.
- Parameters:
spatial_precedence_rules – The non-empty list of SpatialPrecedenceRules or spatial precedence rule names to run.
log_file – The path to write the results to.
- Returns:
True if successful, False otherwise.
- Return type:
- get_spatial_precedence_rules_result() str
Get the results of the spatial precedence rules.
- Returns:
The results.
- Return type:
- add_summary_report(name: str) SummaryReport
Add a new summary report.
- Parameters:
name – The name for the new summary report.
- Returns:
The newly added summary report.
- Return type:
- update_leveling_setup(start_date: str, end_date: str, clear_previous: bool, minimum_split_days: int, minimum_split_hours: int) bool
Update the leveling setup.
- Parameters:
start_date – The date to start leveling. If start_date and end_date are both the empty string, leveling will be performed on the entire project.
end_date – The date to end leveling.
clear_previous – True to clear the previous leveling setup, False otherwise.
minimum_split_days – The minimum number of days for the new split bar.
minimum_split_hours – The minimum number of hours for the new split bar.
- class GanttLookupTable(table_name: str)
Bases:
object
Object to store information about a lookup table in Vulcan Gantt Scheduler.
- class GanttResource(resource_name: str)
Bases:
object
Object to store information about a resource in Vulcan Gantt Scheduler.
- __init__(resource_name: str)
Construct a new GanttResource.
This should not be used, and GanttResources should instead be gotten through Gantt.resources.
- property default_capacity
Set the default capacity for this resource.
- set_default_capacity_and_method(default_capacity: float)
Set the default capacity and method for this resource.
- Parameters:
default_capacity (
float
) – The value to set.
- property default_rate
Set the default rate for this resource.
- set_default_rate_and_method(default_rate: float)
Set the default rate and method for this resource.
- Parameters:
default_rate (
float
) – The value to set.
- property rate_expression
Set the rate expression for this resource.
- property calendar
Set the calendar for this resource.
- add_variable_rate_item(activity_type_name: str, rate: float) bool
Add a variable rate item to this resource.
- add_variable_rate_item_activity_type_rate(activity_type_name: str) bool
Add a variable rate item to this resource.
This function uses the default rate.
- remove_variable_rate_item(activity_type_name: str) bool
Remove a variable rate item from this resource.
If no variable rate items remain, the rate method is changed to the default rate.
- add_variable_capacity_item(start_date: str, capacity: int) bool
Add a variable capacity item to this resource.
- remove_variable_capacity_item(start_date: str) bool
Remove a variable capacity item from this resource.
- add_to_activity(activity_name: str, activity_type_name: str) bool
Add this resource to an activity.
- add_to_activities() bool
Add this resource to all currently displayed activities.
- Returns:
True if successful, False otherwise.
- Return type:
- remove_from_activity(activity_name: str, activity_type_name: str) bool
Remove this resource from an activity.
- class Activity(id: int)
Bases:
object
Class representing an activity in VGS.
Allows for reading and editing data associated with an activity.
- select()
Select this activity in VGS.
- get_attribute_value(attribute_name: str) str
Get the value of an attribute for the current activity.
- get_attribute_values(attribute_names: list[str]) list[str]
Get the values of one or more attributes for the current activity.
- Parameters:
attribute_names (
list[str]
) – The attributes to get the values of.- Returns:
The attribute values.
- Return type:
list[str]
- set_attribute_value(attribute_name: str, value: str | float) bool
Set the value of an attribute for the current activity.
- split(task_bar_index: int, proportion: float, delay: float) bool
Split this activity.
- Parameters:
task_bar_index (
int
) – The 0-based index of the task bar to split.proportion (
float
) – The location of the split in the specified task bar. This should be a number between 0 and 1, e.g. for a 50-50 split, proportion should be 0.5.delay (
float
) – The delay, in days, applied to the new task bar and any subsequent bars for the activity.
- Returns:
True if successful, False otherwise.
- Return type:
- property type
Set the activity type of this activity.
- class SpatialPrecedenceRule(name: str)
Bases:
object
Class representing a Spatial Precedence Rule in VGS.
These define how objects are processed in Vulcan to create precedences between objects.
- __init__(name: str)
Create a new instance of the SpatialPrecedenceRule class.
This should not be used, and instead should be obtained through Gantt.add_spatial_precedence_rule.
- update(self, group: str, clear: bool, minimum_minable: float, closest: bool, precedence_lag: float, precedence_type: maptek.gantt.PrecedenceType) bool
Update this spatial precedence rule.
- Parameters:
group (
str
) – The precedence group to add this precedence rule to.clear (
bool
) – True to clear any precedences previously defined in the precedence group.minimum_minable (
float
) – Used in combination with precedcence_lag, the minimum minable value is the minimum quantity mined between precedences and used to split the predecessor or successor.Splits can be generated in increments of the minimum minable value for both predecessor and successor activities.closest (
bool
) – True to consider the closest object by distance, False otherwise.precedence_lag (
float
) – Lag between the predecessor bar and successor bar.precedence_type (
PrecedenceType
) – The precedence type to set on this rule.
- Returns:
True if successful, False otherwise.
- Return type:
Overload
update(self, clear: bool, minimum_minable: float, closest: bool, precedence_lag: float, precedence_type: maptek.gantt.PrecedenceType) -> bool
Update this spatial precedence rule.
- Parameters:
clear (
bool
) – True to clear any precedences previously defined in the precedence group.minimum_minable (
float
) – Used in combination with precedcence_lag, the minimum minable value is the minimum quantity mined between precedences and used to split the predecessor or successor.Splits can be generated in increments of the minimum minable value for both predecessor and successor activities.closest (
bool
) – True to consider the closest object by distance, False otherwise.precedence_lag (
float
) – Lag between the predecessor bar and successor bar.precedence_type (
PrecedenceType
) – The precedence type to set on this rule.
- Returns:
True if successful, False otherwise.
- Return type:
- update_predecessor(filter: str, activity_type: str) bool
Update the predecessor of this spatial precedence rule.
Used to restrict activities considered when running the precedence rule.
- Parameters:
filter – The filter to set on the predecessor.
activity_type – The type of activity to set on the predecessor.
- Returns:
True if successful, False otherwise.
- Return type:
- property predecessor_filter
Set the predecessor filter.
- property predecessor_activity_type
Set the predecessor activity type.
- update_successor(filter: str, activity_type: str) bool
Update the successor of the spatial precedence rule.
Used to restrict activities considered when running the precedence rule.
- Parameters:
filter – The filter to set on the successor.
activity_type – The type of activity to set on the successor.
- Returns:
True if successful, False otherwise.
- Return type:
- property successor_filter
Set the successor filter.
- property successor_activity_type
Set the successor activity type.
- property distance_lag
Set the distance lag.
- class SummaryReport(name: str)
Bases:
object
Class representing a Summary Report in VGS.
- property result_type
Set the result type.
- set_default_result_type() bool
Apply the default result type to this summary report.
- Returns:
True if successful, False otherwise.
- Return type:
- add_report_item(name: str, attribute_name: str, weight_name: str) bool
Add a report item to the summary report.
- Parameters:
name – The name of the new report item.
attribute_name – The name of the grade attribute associated with the report item.
weight_name – The name of the attribute to weight the grade attribute by.
- Returns:
True if successful, False otherwise.
- Return type:
- add_report_item_expression(name: str, expression: str) bool
Add an expression to a report item.
- Parameters:
name – The name of the report item.
expression – The expression.
- Returns:
True if successful, False otherwise.
- Return type:
- remove_report_item(name: str) bool
Remove an item from the report.
- Parameters:
name – The name of the item to remove.
- Returns:
True if successful, False otherwise.
- Return type:
- update_report_item(name: str, attribute_name: str, weight_name: str) bool
Update an item in the report.
- Parameters:
name – The name of the report item to update.
attribute_name – The name of the grade attribute to associate with the report item.
weight_name – The name of the attribute to weight the grade attribute by.
- Returns:
True if successful, False otherwise.
- Return type:
- update_report_item_expression(name: str, expression: str) bool
Update a report item expression.
- Parameters:
name – The name of the report item to update.
expression – The new expression.
- Returns:
True if successful, False otherwise.
- Return type: