Hello all, I’ve made a script tool that does a lot of work to creating SLPK files from different formats of BIM files. Additionally, this particular tool allows for batch mode processing, which implies that a number of files can be processed at once.
Current Challenge:
With batch processing enabled, tools can generate anything between 5 and 15 SLPK files each taking about 20GB space. By working throughout the day with it, 100GB or more are likely to accumulate depending on the number of BIMs converted into SLPK format.
Feature Request:
I would like this tool improved by adding a way for the end user to;
Estimate Storage Requirements: users should have an opportunity for calculating the probable amount of storage space required for converting the BIMs indicated in batch mode before starting it.
Storage Availability Check: there should also be an indication from the program either warning or error messages when there is insufficient hard storage when saving SLPK files which expect output sizes.
This functionality should operate on-the-fly enabling users make informed decisions before initiating as process does.
I have done this feature on a simple Scrip tool as testing, but it works with the normal tool (Not in Batch mode). So here's the code.
- as a testing phase i just give 1GB hard storage needed for each 100MB of BIM files.
Main code:
import arcpy
import os
def estimate_storage_consumption(bim_file):
"""Estimate storage consumption based on the size of the BIM file."""
file_size_mb = os.path.getsize(bim_file) / (1024 * 1024) # Convert bytes to MB
estimated_storage_gb = (file_size_mb / 100) * 1 # 100MB of BIM = 1GB of storage
return estimated_storage_gb
def main():
# Get parameters from ArcGIS Pro
bim_file = arcpy.GetParameterAsText(0)
output_gdb = arcpy.GetParameterAsText(1)
estimate_storage = arcpy.GetParameter(2)
# If the checkbox is checked, estimate storage consumption
if estimate_storage:
estimated_storage_gb = estimate_storage_consumption(bim_file)
arcpy.AddMessage(f"Estimated storage consumption: {estimated_storage_gb:.2f} GB")
# Define the output dataset name and spatial reference (adjust as needed)
out_dataset_name = "BIM_Dataset"
coord_system_wkt = "" # Specify your coordinate system WKT here or leave empty if not needed
# Execute the BIMFileToGeodatabase tool
arcpy.conversion.BIMFileToGeodatabase(
in_bim_file_workspace=str(bim_file),
out_gdb_path=output_gdb,
out_dataset_name=out_dataset_name,
spatial_reference=coord_system_wkt,
identifier="",
include_floorplan="EXCLUDE_FLOORPLAN"
)
if __name__ == "__main__":
main()
Validation part:
import arcpy
import os
class ToolValidator:
def __init__(self):
# Set self.params for use in other validation methods.
self.params = arcpy.GetParameterInfo()
def initializeParameters(self):
return
def updateParameters(self):
return
def updateMessages(self):
# Check if the checkbox (third parameter) is checked
if self.params[2].value:
bim_file = self.params[0].valueAsText
if bim_file and os.path.isfile(bim_file):
# Calculate the estimated storage consumption
file_size_mb = os.path.getsize(bim_file) / (1024 * 1024) # Convert bytes to MB
estimated_storage_gb = (file_size_mb / 100) * 1 # 100MB of BIM = 1GB of storage
# Set the warning message on the checkbox parameter
self.params[2].setWarningMessage(f"Estimated storage consumption: {estimated_storage_gb:.2f} GB")
else:
# Clear any messages if the BIM file is not valid
self.params[2].clearMessage()
else:
# Clear the warning message if the checkbox is not checked
self.params[2].clearMessage()
Image
![mohammedAlsaket_0-1724089720947.png mohammedAlsaket_0-1724089720947.png](https://community.esri.com/t5/image/serverpage/image-id/112797i487D5FD87A1E73FA/image-size/medium?v=v2&px=400)