ifcpatch#

Subpackages#

Submodules#

Package Contents#

ifcpatch._extract_docs(cls, method_name, boilerplate_args)#
ifcpatch.execute(args)#

Execute a patch recipe

The details of how the patch recipe is executed depends on the definition of the recipe, as well as the arguments passed to the recipe. See the documentation for each patch recipe separately to understand more.

Parameters
  • args (dict) – A dictionary of arguments, corresponding to the parameters listed subsequent to this in this docstring.

  • input (str) – A filepath to the incoming IFC file.

  • file (ifcopenshell.file.file) – An IFC model to apply the patch recipe to.

  • recipe (str) – The name of the recipe. This is the same as the filename of the recipe. E.g. “ExtractElements”.

  • log (str,optional) – A filepath to a logfile.

  • arguments (list) – A list of zero or more positional arguments, depending on the patch recipe. Some patch recipes will require you to specify arguments, some won’t.

Returns

The result of the patch. This is typically a patched model, either as an object or as a string.

Return type

ifcopenshell.file.file,str

Example:

output = ifcpatch.execute({
    "input": "input.ifc",
    "file": ifcopenshell.open("input.ifc"),
    "recipe": "ExtractElements",
    "arguments": [".IfcWall"],
})
ifcpatch.write(output, "output.ifc")
ifcpatch.extract_docs(submodule_name: str, cls_name: str, method_name: str = '__init__', boilerplate_args: Iterable[str] = None)#

Extract class docstrings and method arguments

Parameters
  • submodule_name – Submodule from which to extract the class

  • cls_name – Class from which to extract the docstring and method arguments

  • method_name – Class Method name from which to extract arguments

  • boilerplate_args – String iterable containing arguments that shall not be parsed

ifcpatch.write(output, filepath)#

Write the output of an IFC patch to a file

Typically a patch output would be a patched IFC model file object, or as a string. This function lets you agnostically write that output to a filepath.

Parameters
  • output (ifcopenshell.file.file,str) – The results from ifcpatch.execute()

  • filepath (str) – A filepath to where the results of the patched model should be written to.

Returns

None

Return type

None