Write more documentation

Sphinx autoapi also now only shows subpackages 1 level deep. This prevents us having a huge long list. Also don't show private or special members. Also show imported members so ifcopenshell.file and ifcopenshell.entity_instance works in docs too.
This commit is contained in:
Dion Moult
2024-05-07 17:32:47 +10:00
parent 722201a1af
commit d76462ca42
11 changed files with 248 additions and 74 deletions
+17 -11
View File
@@ -550,20 +550,26 @@ class file:
def __iter__(self):
return iter(self[id] for id in self.wrapped_data.entity_names())
def write(self, path: "os.PathLike | str", format=None, zipped=False) -> None:
def write(self, path: "os.PathLike | str", format: Optional[str] = None, zipped: bool = False) -> None:
"""Write ifc model to file.
:param format: Force use of a specific format. Guessed from file name if None.
Supported formats : .ifc, .ifcXML, .ifcZIP (equivalent to format=".ifc" with zipped=True)
For zipped .ifcXML use format=".ifcXML" with zipped=True
:param format: Force use of a specific format. Guessed from file name
if None. Supported formats : .ifc, .ifcXML, .ifcZIP (equivalent to
format=".ifc" with zipped=True) For zipped .ifcXML use
format=".ifcXML" with zipped=True
:type format: str
:param zipped: zip the file after it is written
:type zipped: bool
Examples:
>>> model.write("path/to/model.ifc")
>>> model.write("path/to/model.ifcXML")
>>> model.write("path/to/model.ifcZIP")
>>> model.write("path/to/model.ifcZIP", format=".ifcXML", zipped=True)
>>> model.write("path/to/model.anyextension", format=".ifcXML")
Example:
.. code:: python
model.write("path/to/model.ifc")
model.write("path/to/model.ifcXML")
model.write("path/to/model.ifcZIP")
model.write("path/to/model.ifcZIP", format=".ifcXML", zipped=True)
model.write("path/to/model.anyextension", format=".ifcXML")
"""
path = Path(path)
path.parent.mkdir(parents=True, exist_ok=True)
@@ -595,7 +601,7 @@ class file:
return
@staticmethod
def from_string(s: str) -> file:
def from_string(s: str) -> "file":
return file(ifcopenshell_wrapper.read(s))
@staticmethod