Skip to content
This repository was archived by the owner on Nov 24, 2024. It is now read-only.

Commit ac632d0

Browse files
authored
Merge pull request #1 from IfcOpenShell/v0.6.0
同步源库
2 parents f369678 + 85a78a6 commit ac632d0

File tree

38 files changed

+2199
-525
lines changed

38 files changed

+2199
-525
lines changed

src/bcf/README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# bcf
2+
3+
A simple Python implementation of BCF. The data model is described in `data.py`.
4+
Manipulation of BCF-XML is available via `bcfxml.py` and manipulation of BCF-API
5+
is available via `bcfapi.py`.
6+
7+
Currently supports BCF version 2.1.
8+
9+
## bcfxml
10+
11+
The `bcfxml` module lets you interact with the BCF-XML standard.
12+
13+
```
14+
from bcf.bcfxml import BcfXml
15+
16+
bcfxml = BcfXml()
17+
18+
# Load a project
19+
project = bcfxml.get_project("/path/to/file.bcf")
20+
21+
# The project is also stored in the module
22+
# project == bcfxml.project
23+
24+
print(project.name)
25+
26+
# To edit a project, just modify the object directly
27+
bcfxml.project.name = "New name"
28+
bcfxml.edit_project()
29+
30+
# The BCF file is extracted to this temporary directory
31+
print(bcfxml.filepath)
32+
33+
# Get a dictionary of topics
34+
topics = bcfxml.get_topics()
35+
36+
# Note: topics == bcfxml.topics
37+
for guid, topic in bcfxml.topics.items():
38+
print("Topic guid is", guid)
39+
print("Topic guid is", topic.guid)
40+
print("Topic title is", topic.title)
41+
42+
# Fetch extra data about a topic
43+
header = bcfxml.get_header(guid)
44+
comments = bcfxml.get_comments(guid)
45+
viewpoints = bcfxml.get_viewpoints(guid)
46+
47+
# Note: comments == topic.comments, and so on
48+
for comment_guid, comment in comments.items():
49+
print(comment_guid)
50+
print(comment.comment)
51+
print(comment.author)
52+
53+
# Get a particular topic
54+
topic = bcfxml.get_topic(guid)
55+
56+
# Modify a topic
57+
topic.title = "New title"
58+
bcfxml.edit_topic(topic)
59+
```

0 commit comments

Comments
 (0)