Add API documentation for document module

This commit is contained in:
Dion Moult
2022-11-23 10:56:12 +09:00
parent 09c8268494
commit b23f445946
8 changed files with 222 additions and 34 deletions
@@ -18,11 +18,50 @@
class Usecase:
def __init__(self, file, **settings):
def __init__(self, file, information=None):
"""Creates a new reference to a document to assign to products
A document may be associated with physical products, tasks, cost items,
and so on. For example, spaces, storeys, and buildings may have a list
of associated drawings so you can see which drawings (e.g. plans,
sections, details) are documenting that location. Alternatively,
equipment may have associated training manuals, operation and
maintenance manuals or detailed assembly drawings. Resources may be
training certification required, schedules may have gantt charts or bid
documents, and so on.
In order to associate a document with an object, a reference to that
document needs to be created. It could be a reference to the entire
document, or a reference to a particular page or chapter. See
ifcopenshell.api.document.assign_document for more information.
:param information: The IfcDocumentInformation that the reference will
be created for
:type information: ifcopenshell.entity_instance.entity_instance
:return: The newly created IfcDocumentReference entity
:rtype: ifcopenshell.entity_instance.entity_instance
Example::
document = ifcopenshell.api.run("document.add_information", model)
ifcopenshell.api.run("document.edit_information", model,
information=document,
attributes={"Identification": "A-GA-6100", "Name": "Overall Plan",
"Location": "A-GA-6100 - Overall Plan.pdf"})
# In this case, we don't specify any more information, and so the
# reference is for the entire document, as opposed to a single page or
# chapter or section.
reference = ifcopenshell.api.run("document.add_reference", model, information=document)
# Alternatively, we can specify a single section, such as by a
# subheading code.
reference2 = ifcopenshell.api.run("document.add_reference", model, information=document)
ifcopenshell.api.run("document.edit_reference", model,
reference=reference2, attributes={"Identification": "2.1.15"})
"""
self.file = file
self.settings = {"information": None}
for key, value in settings.items():
self.settings[key] = value
self.settings = {"information": information}
def execute(self):
if self.file.schema == "IFC2X3":