MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / create_new

Method create_new

src/bcf/bcf/v2/topic.py:148–185  ·  view source on GitHub ↗

Create a new BCF topic. Args: title: The title of the topic. description: The description of the topic. author: The author of the topic. topic_type: The type of the topic. topic_status: The status of the topic.

(
        cls,
        title: str,
        description: str,
        author: str,
        topic_type: str = "",
        topic_status: str = "",
        xml_handler: Optional[AbstractXmlParserSerializer] = None,
    )

Source from the content-addressed store, hash-verified

146
147 @classmethod
148 def create_new(
149 cls,
150 title: str,
151 description: str,
152 author: str,
153 topic_type: str = "",
154 topic_status: str = "",
155 xml_handler: Optional[AbstractXmlParserSerializer] = None,
156 ) -> TopicHandler:
157 """
158 Create a new BCF topic.
159
160 Args:
161 title: The title of the topic.
162 description: The description of the topic.
163 author: The author of the topic.
164 topic_type: The type of the topic.
165 topic_status: The status of the topic.
166 xml_handler: The XML parser/serializer to use.
167
168 Returns:
169 The BCF topic definition.
170 """
171 creation_date = XmlDateTime.from_datetime(datetime.datetime.now())
172 guid = str(uuid.uuid4())
173 topic = mdl.Topic(
174 title=title,
175 description=description,
176 creation_author=author,
177 creation_date=creation_date,
178 guid=guid,
179 topic_type=topic_type,
180 topic_status=topic_status,
181 )
182 markup = mdl.Markup(topic=topic)
183 obj = cls(topic_dir=Path(guid), xml_handler=xml_handler or XmlParserSerializer())
184 obj.markup = markup
185 return obj
186
187 def save(self, destination_zip: ZipFileInterface) -> None:
188 """

Callers 1

add_viewpointMethod · 0.45

Calls 1

XmlParserSerializerClass · 0.90

Tested by

no test coverage detected