Extract description from BCF files and write it in Revit or excel

Hallo,
I’m looking to create a Dynamo form that allows me to import BCF files into Revit and perform various operations based on the BCF data. I’ve explored the BCF Manager plugin for Revit but found it insufficient for my needs.
I need to get the IFC-GUID and a description from the BCF and write to the element in Revit, for me also would work if I able to export this information to excel.

Any suggestions, code snippets, or recommended workflows for accomplishing these tasks would be highly appreciated. Thank you for your assistance!

Could you share a sample BCF data file? Also what would you like your output to look like?

@Daan
I checked
.bcf is simply xml


markup.7z (776 Bytes)

1 Like

How would this xml-file look if you have multiple elements? I’m not following the structure.

Hi not sure if it could work havent tried dont work so much with bcf…but in RIE package there are a node…written in python

1 Like

I think I got it, let me know if this works:

import xml.etree.ElementTree as ET

def extract_topic_comments(xml_file):
    tree = ET.parse(xml_file)
    root = tree.getroot()

    topic_comments = {}

    for topic in root.iter('Topic'):
        guid = topic.get('Guid')
        comment_element = topic.find('Comment')
        comment = comment_element.text if comment_element is not None else None
        topic_comments[guid] = comment

    return topic_comments

OUT = extract_topic_comments(IN[0])
Used XML-Text
<?xml version="1.0" encoding="UTF-8"?>
<Markup>
	<Header>
		<File IfcProject="3JgX2xwnv0FxIRphXSbwoS">
			<Filename>2165</Filename>
			<Date>2017-07-19T08:29:47+00:00</Date>
		</File>
		<File IfcProject="2le571mtb3fP$WKRXcn6LA">
			<Filename>716099</Filename>
			<Date>2017-07-19T06:22:13+00:00</Date>
		</File>
		<File IfcProject="3JgX2xwnv0FxIRphXSbwoS">
			<Filename>2165</Filename>
			<Date>2017-07-19T08:38:44+00:00</Date>
		</File>
		<File IfcProject="0LTDLg3sz7b86YAmrNSW68">
			<Filename>716099</Filename>
			<Date>2017-05-03T10:30:31+00:00</Date>
		</File>
	</Header>
	<Topic Guid="97218b2f-427c-45cd-841a-30773b2bc40b" TopicType="Error" TopicStatus="Active">
		<Title>Detail 300-39/40</Title>
		<Index>78</Index>
		<CreationDate>2017-06-21T10:31:25+00:00</CreationDate>
		<CreationAuthor>hjo</CreationAuthor>
		<ModifiedDate>2017-07-21T08:50:02+00:00</ModifiedDate>
		<ModifiedAuthor>hjo</ModifiedAuthor>
		<AssignedTo>str</AssignedTo>
		<Description>HSB constructie(BBO)</Description>
		<Comment>CommentValueHere</Comment>
	</Topic>
	<Topic Guid="97218b2f-427c-45cd-841a-30773b2bc40c" TopicType="Error" TopicStatus="Active">
		<Title>Detail 300-39/40</Title>
		<Index>78</Index>
		<CreationDate>2017-06-21T10:31:25+00:00</CreationDate>
		<CreationAuthor>hjo</CreationAuthor>
		<ModifiedDate>2017-07-21T08:50:02+00:00</ModifiedDate>
		<ModifiedAuthor>hjo</ModifiedAuthor>
		<AssignedTo>str</AssignedTo>
		<Description>HSB constructie(BBO)</Description>
		<Comment>CommentValueHere2</Comment>
	</Topic>
	<Viewpoints Guid="670f0328-09e9-45b8-b1b0-e3e90ac0fbff">
		<Viewpoint>viewpoint.bcfv</Viewpoint>
		<Snapshot>snapshot.png</Snapshot>
	</Viewpoints>
</Markup>


2023-06-15 Extract Comment and GUID from BCF-File.dyn (7.5 KB)

2 Likes

Thanks for the answer :slight_smile:
not for my purpose
The original BCF is a BCFzip file which contains the BCF. I need to extract the IFC Guid from the viewpoint and the description from the markup.
Any Ideas?




Not installed_Ed.7z (30.8 KB)