BCF Live Connector to Trimble Connect FILE_NAME
-
When using Solibri BCF Live Connector with Trimble Connect with models that ifc filename is different than FILE_NAME property inside ifc file then Trimble Connect does not know what models should be visible. More info in this forum
https://community.trimble.com/question/how-to-relink-model-in-bcf-topics#7162203f-8c47-4049-917b-018c39cd7090Problem would be probably fixed when Solibri would report filename instead FILE_NAME property. Would it be possible to change this from Solibri side?
-
I’ve actually written a python script the change the FILE_NAME to match the IFC file names and it solves the problem.
I have an impression that that’s more of Trimble connect problem since their BCF topics is not robust at all in my experience and they have really long bug fix / development cycle. Solibri has always been the accommodating one, so it’s more useful to report the “bug” here instead on Trimble Connect forum. -
There you go.
I mostly asked Chatgpt to write it for me, and i just kept prompting it, and i added some GUI to make it nicer to use. Feel free to use or modify it (at your own risk, of course.)Here’s the approach of my workflow and the script:
- sync the files from Trimble connect TC to my computer.
- run script to loop through all the IFC file in the folder I’m concerned with.
- in each of these IFC, find the strings of the file name of which line starts with FILE_NAME
- replace it with the file name.
- sync back to TC
It’s rather difficult to ask the BIM author to always match the FILE_NAME to the file name. The FILE_NAME field is set at the time of export by the BIM software, and before the author uploads the IFC file, it would often get renamed manually. So having this simple script is good for housekeeping.
import os import shutil import tkinter as tk from tkinter import filedialog, messagebox import sys ### change the FILE_NAME in the IFC header to match the file name ### if overwrite is set to True, the original file will be overwritten ### then run trimble connect sync to upload the files ### run every time any one uploaded a new version of the IFC file # main function class IFCProcessor: def change_ifc_filename(self, input_file, overwrite=False): base_name, _ = os.path.splitext(os.path.basename(input_file)) folder = os.path.dirname(input_file) with open(input_file, 'r') as file: lines = file.readlines() for line in lines: if line.startswith('FILE_NAME'): parts = line.split(',') current_filename = parts[0].split("'")[1] if current_filename == f"{base_name}.ifc": print(f"The FILE_NAME in the IFC header matches the file name for {input_file}. Skipping this file.") return else: if overwrite: output_file = input_file else: output_file = os.path.join(folder, f"{base_name}_renamed.ifc") shutil.copy2(input_file, output_file) with open(output_file, 'r+') as output: output_lines = output.readlines() output.seek(0) for output_line in output_lines: if output_line.startswith('FILE_NAME'): output_parts = output_line.split(',') output_parts[0] = f"FILE_NAME('{base_name}.ifc'" output_line = ','.join(output_parts) output.write(output_line) output.truncate() return def process_ifc_files_in_folder(self, folder_path, overwrite=False): for dirpath, dirnames, filenames in os.walk(folder_path): for filename in filenames: if filename.lower().endswith('.ifc'): fullpath = os.path.join(dirpath, filename) print(f"Processing file: {fullpath}") self.change_ifc_filename(fullpath, overwrite) class IFCProcessorGUI: def __init__(self, root, processor): self.root = root self.processor = processor self.folder_var = tk.StringVar() self.overwrite_var = tk.BooleanVar() self.create_widgets() def select_folder(self): folder_path = filedialog.askdirectory() self.folder_var.set(folder_path) def process_files(self): folder_path = self.folder_var.get() overwrite = self.overwrite_var.get() print(f"Processing files in folder: {folder_path}") print(f"Overwrite flag is set to: {overwrite}") self.processor.process_ifc_files_in_folder(folder_path, overwrite) messagebox.showinfo("Success", "Files processed successfully!") def create_widgets(self): folder_label = tk.Label(self.root, text="Folder containing IFC files (subfolders will be searched):") folder_entry = tk.Entry(self.root, textvariable=self.folder_var) folder_button = tk.Button(self.root, text="Select Folder", command=self.select_folder) overwrite_check = tk.Checkbutton(self.root, text="Overwrite", variable=self.overwrite_var) process_button = tk.Button(self.root, text="Process Files", command=self.process_files) self.console = tk.Text(self.root) sys.stdout = TextRedirector(self.console, "stdout") folder_label.pack() folder_entry.pack() folder_button.pack() overwrite_check.pack() process_button.pack() self.console.pack() ## Redirect stdout to the console class TextRedirector(object): def __init__(self, widget, tag="stdout"): self.widget = widget self.tag = tag def write(self, str): self.widget.configure(state="normal") self.widget.insert("end", str, (self.tag,)) self.widget.configure(state="disabled") def flush(self): pass if __name__ == "__main__": root = tk.Tk() root.title("IFC FILE_NAME Corrector") # Set the window title here processor = IFCProcessor() gui = IFCProcessorGUI(root, processor) root.mainloop() -
@Wing-Mang
Thank you for the code.
By the way, my testing has shown ifc FILE_NAME in Solibri must be the same as the file name in Trimble Connect. So the last step in your workflow (sync back to TC) is actually redundant -
WE communicated the Problem with Solibri and Connect. This is the result:
This issue was discussed between the Trimble Connect dev team and the Solibri dev team. The conclusions are:
- Immediate Workaround is: go to the IFC file and change the IFC file name header
- Solibri improvement identified: Solibri plans to add a user setting so that: “Add option to map model name based on file name OR the IFC header file name”. Please look for an upcoming new release of the Solibri Office.
-
Hi @Solibrians ,
Do you have any updates on how to resolve the problem?
Or does @Hamo 's answer above always apply?
Thanks -
BCF-API 3.0 has a solution for this. We’ve communicated with Trimble that they could update their implementation.
-
Sorry @Pasi-Paasiala, does this mean that the problem has already been fixed in the last versione 9.13.7 and that the synchronization between Solibri and Trimble Connect works well now? Or does Trimble still have to apply the solution?
Thanks. -
@paola-bronzo Trimble would need to implement BCF-API 3.0. In the meanwhile we’re working on a workaround.
-
This is now done in Solibri 9.13.8.
https://society.solibri.com/topic/2826/solibri-9-13-8-has-been-released
-
M Matti marked this topic as a question on
-
M Matti has marked this topic as solved on
-
M Matti unlocked this topic on
Copyright © 2025 Solibri Inc. | Powered by NodeBB