Sample Code Revit Batch Processor 1.1.11 documentation
ViewModel
ViewModel.PropertyChanged
ViewModel.TextBoxText_SourcePath
ViewModel.TextBoxText_Filter
ViewModel.RadioButton_FilterAnd
ViewModel.RadioButton_FilterOr
ViewModel.convert_list_to_observable_collection()
ViewModel.OnPropertyChanged()
ViewModel.TextBox_Filter_TextChanged()
ViewModel.text_box_source_path_change()
ViewModel.button_ok()
ViewModel.button_cancel()
bim 360 task text file
files on a local server directory
files on a local server directory and it’s subdirectories
local server based files provided through a task text file
location (str) – Can either be a directory, or a fully qualified file path.
includeSubDirs (bool) – If true and location is a directory, subdirectories will be included in file search.
fileExtension (str) – File type filter in ‘.ext’
List of MyFileItem objects.
Reads server based file data, the fully qualified file path, from a task file list file in csv format.
filePathCSV (str) – The fully qualified file path to the task list file.
fileExtension (str) – The file extension filter in format ‘.ext’
A list of MyFileitem objects. If an exception occured an empty list will be returned.
Returns files in a given directory and of a given file extension.
directory (str) – The fully qualified directory path.
file_extension (str) – The file extension filter in format ‘.ext’
List of file items
[FileItem
]
Returns files in a given directory and its sub directories of a given file extension.
directory (str) – The fully qualified directory path.
file_extension (str) – The file extension filter in format ‘.ext’
List of file items
[FileItem
]
Helper used to define workload size (same as file size)
item (FileItem
) – A file item object instance.
The file size.
int
Default task list content for files on a file server location.
item (FileItem
) – A file item object instance.
The item name.(fully qualified file path)
str
Default task list content for files on a BIM 360 cloud drive.
item (FileItem
) – A file item object instance.
The revit version, project guid, file guid separated by a space ‘ ‘
str
Writes out a task list file.
file_name (str) – Fully qualified file path of the task file name including extension.
bucket (WorkloadBucket
) – Workload bucket object instance.
get_data (func(FileItem
) -> str, optional) – Returns data from file item object to be written to file, defaults to BucketToTaskListFileSystem
Result class instance.
Write file status (bool) returned in result.status. False if an exception occurred, otherwise True.
Result.message property contains fully qualified file path to task list file.
On exception:
.status (bool) will be False.
.message will contain the exception message.
Writes out all task list(s) to file(s).
directory_path (str) – Fully qualified directory path containing files to be added to task lists.
file_extension (str) – A file extension filter in format ‘.ext’
task_list_directory (str) – The fully qualified directory path where the task files will be written .
task_files_number (int) – The number of task files to be written.
file_getter (func(str, str) -> FileItem
) – Function accepting a directory and file extension filter and returns file items from directory.
file_data_processor (func(FileItem
) -> str, optional) – Function processing file item and returns a string to be written to task list file, defaults to BucketToTaskListFileSystem
Result class instance.
Write file status (bool) returned in result.status. False if an exception occurred, otherwise True.
Result.message property contains fully qualified file path for each task list file.
On exception:
.status (bool) will be False.
.message will contain the exception message.
Builds a fully qualified task file path.
taskListDirectory (str) – The fully qualified directory where the task file is (to be) located
counter (int) – A counter to be added to the task file name
A fully qualified task file path
str
Writes out an empty task list.
fileName (str) – Fully qualified file path of the task file name including extension.
Result class instance.
Write file status (bool) returned in result.status. False if an exception occurred, otherwise True.
Result.message property contains fully qualified file path to empty task list file.
On exception:
.status (bool) will be False.
.message will contain the exception message.
Entry point.
argv ([str]) – A list of string representing arguments past in.
Processes past in arguments and checks whether inputs are valid.
argv (_type_) – List of arguments
True if arguments past in are valid, otherwise False.
FIle select settings object instance.
bool, FileSelectionSettings
Returns the directory from a fully qualified file path.
file_path (str) – A fully qualified file path.
A fully qualified directory path. On exception an empty string.
str
Retrieves Revit file data from either:
directory on a file server
- a text file containing BIM 360 project data
text file needs to be a .csv
- format:
0 Revit Version:YYYY,Project GUID, File GUID, file size, BIM 360 file path
settings (FileSelectionSettings
) – A file select settings object instance.
List of file items
[FileItem
]
Reads server based file data, the fully qualified file path, from a task file list file in csv format.
filePathCSV (str) – The fully qualified file path to the task list file.
A list of MyFileItem objects. If an exception occurred an empty list will be returned.
Reads a file server based task list file. This file can either be a BIM360 task list file or a task list file containing file server based file path in a single column.
filePath (str) – The fully qualified file path to the task list file.
A list of MyFileItem objects.
Checks whether the first item in a file item list belongs to a BIM 360 project.
Checks whether Project GUID property on file item object is None.
revit_files ([FileItem
]) – List of file items.
True if BIM360 file, otherwise False.
bool
the directory this script lives in
xaml file name of file select UI
xaml full path
A simple win forms message box.
title (str) – The title of the message box.
text (str) – The text displayed in the message box.
style (int) – An int representing the type of buttons shown. (https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.messageboxbuttons?view=windowsdesktop-6.0)
A win form message box.
_type_
Bases: Window
Class constructor
xaml_full_file_name (str) – Fully qualified file path to wpf XAML file.
revitFiles ([str]) – List containing path to files.
settings (FileSelectionSettings
) – A settings object.
Event handler for text changed in TextBox.
Ok button event handler.
Gets the selected rows of files and adds them to .selectedFiles property Sets the dialog result value to True.
sender (_type_) – _description_
EventArgs (_type_) – _description_
Cancel button event handler. Sets the dialogue result value to False.
sender (_type_) – _description_
EventArgs (_type_) – _description_
Source Path text box change event handler
sender (_type_) – _description_
TextChangedEventArgs (_type_) – _description_
_summary_
sender (_type_) – _description_
RoutedEventArgs (_type_) – _description_
_summary_
sender (_type_) – _description_
RoutedEventArgs (_type_) – _description_
A bucket contains a number of files which will eventually be written into task files to be processed by batch processor. The below function attempt to fill these buckets evenly measured on file size.
Distributes a given number of items evenly by workload size into workload buckets.
numberOfBuckets (int) – The number of buckets items are to be distributed to
items ([foo]) – A list of items.
getWorkloadSize (func(foo) -> int) – A function returning the workload size from an item.
A list of workload bucket objects containing items.
list[ WorkloadBucket
]
Python code to sort the tuples using second element of sublist. Inplace way to sort using sort().
Note: not sure a one liner warrants a method…?
sub_li (_type_) – _description_
_description_
_type_