OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
rename ifc model to simple name to avoid issues in the conversion pipeline
Markus Kahlee66aa6e6fe4
diff --git a/modules/bim/app/services/bim/ifc_models/view_converter_service.rb b/modules/bim/app/services/bim/ifc_models/view_converter_service.rbindex 1c11c6cfdc2..260495a4a8c 100644--- a/modules/bim/app/services/bim/ifc_models/view_converter_service.rb+++ b/modules/bim/app/services/bim/ifc_models/view_converter_service.rb@@ -68,20 +68,38 @@ module Bimenddef perform_conversion!(dir)- # Step 1: IfcConvert- ifc_file = ifc_model.ifc_attachment.diskfile.path- collada_file = convert_to_collada(ifc_file, dir)+ # Step 0: avoid file name issues (e.g. umlauts) in the pipeline+ ifc_path = Pathname(ifc_model.ifc_attachment.diskfile.path)+ tmp_ifc_path = Pathname(dir).join("model.ifc")- # Step 2: Collada2GLTF- gltf_file = convert_to_gltf(collada_file, dir)+ FileUtils.symlink ifc_path.to_s, tmp_ifc_path.to_s- # Step 3: Convert to XKT- xkt_file = convert_to_xkt(gltf_file, dir)- ifc_model.xkt_attachment = File.new xkt_file+ tmp_ifc_path.to_s+ .then { |ifc_file| convert_to_collada ifc_file, dir } # Step 1: IfcConvert+ .then { |collada_file| convert_to_gltf collada_file, dir } # Step 2: Collada2GLTF+ .then { |gltf_file| convert_to_xkt gltf_file, dir } # Step 3: Convert to XKT+ .then { |xkt_file| attach_files xkt_file, ifc_path, tmp_ifc_path, dir }+ end++ def attach_files(xkt_file, ifc_path, tmp_ifc_path, dir)+ attach_xkt xkt_file, ifc_path+ attach_metadata ifc_path, tmp_ifc_path, dir+ end- # Convert metadata- metadata_file = convert_metadata(ifc_file, dir)- ifc_model.metadata_attachment = File.new metadata_file+ def attach_xkt(xkt_file, ifc_path)+ final_xkt_file_path = change_basename xkt_file, ifc_path, ".xkt"+ FileUtils.mv xkt_file, final_xkt_file_path.to_s++ ifc_model.xkt_attachment = File.new final_xkt_file_path.to_s+ end++ def attach_metadata(ifc_path, tmp_ifc_path, dir)+ metadata_file = convert_metadata tmp_ifc_path.to_s, dir+ final_metadata_file_path = change_basename metadata_file, ifc_path, ".json"++ FileUtils.mv metadata_file, final_metadata_file_path.to_s++ ifc_model.metadata_attachment = File.new final_metadata_file_path.to_send##@@ -174,6 +192,12 @@ module Bimtrueend++ def change_basename(from, to, ext)+ to = Pathname(to)++ Pathname(from).parent.join(to.basename.to_s.sub(to.extname, ext))+ endendendend